Community
Participate
Working Groups
Build Identifier: 2.1.0 ClassCastException happens when JMX org.eclipse.virgo.kernel/Configuration MBean is accessed for attributes. This then results in a Virgo kernel dump being created. We noticed this when the log drive for our service filled up due to heap dumps. I suspect the JMX monitoring tool we are using is enumerating the MBean names and attributes. The OSGi Compendium spec 4.2, 104.4.2, defines that the Configuration Properties should be Key=String, but Value may be any of the Primary Property types (OSGi spec 4.2, 3.2.7). However, ConfigurationAdminConfigurationInfo does an unchecked cast to Dictionary<String,String> Problem exists in current code: http://git.eclipse.org/c/virgo/org.eclipse.virgo.kernel.git/tree/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/config/internal/ConfigurationAdminConfigurationInfo.java Reproducible: Always Steps to Reproduce: 1. Install a Felix PersistenceManager that returns configuration that isn't value type String. In our case, it was returning a Dictionary<String,Object> where one of the values was type Boolean 2. Start virgo 3. Open JConsole to org.eclipse.virgo.kernel/Configuration/PID 4. Click on Attributes Each time you click attributes, it creates a new dump, with the attached exception.
Created attachment 207950 [details] Exception report from virgo dump
One solution would be for ConfigurationAdminConfigurationInfo to tolerate Dictionary<String,Object> by running toString against each value in the dictionary. This would have the least impact on the rest of the code while giving a reasonable outcome for types such as Boolean which have a reasonable toString implementation.
It would be worth adding a unit test for this case to ConfigurationAdminConfigurationInfoTests.
We plan to include Gemini Management in Virgo as part of the support for the new admin console. When we do, this mbean will be superseded by a mbean from Gemini Management. Meanwhile, this bug will be fixed as described in comment 2.
Added a test and fixed in kernel commit 9ff5202f914148e40f6f843e3f6e932556995cd3.