Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 365671

Summary: Virgo Configuration MBean assumes ConfigurationAdmin Dictionary is String,String
Product: [RT] Virgo Reporter: szetheli+eclipse
Component: runtimeAssignee: Glyn Normington <glyn.normington>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: glyn.normington
Version: unspecified   
Target Milestone: 3.5.0.M01   
Hardware: PC   
OS: Windows 7   
Whiteboard:
Attachments:
Description Flags
Exception report from virgo dump none

Description szetheli+eclipse CLA 2011-12-05 16:44:35 EST
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.
Comment 1 szetheli+eclipse CLA 2011-12-05 16:45:33 EST
Created attachment 207950 [details]
Exception report from virgo dump
Comment 2 Glyn Normington CLA 2011-12-06 05:56:52 EST
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.
Comment 3 Glyn Normington CLA 2011-12-06 05:58:04 EST
It would be worth adding a unit test for this case to ConfigurationAdminConfigurationInfoTests.
Comment 4 Glyn Normington CLA 2011-12-12 05:17:37 EST
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.
Comment 5 Glyn Normington CLA 2011-12-13 09:08:09 EST
Added a test and fixed in kernel commit 9ff5202f914148e40f6f843e3f6e932556995cd3.