User Tools

Site Tools


classcastexception_configurationadmin

ClassCastException on ConfigurationAdmin

If you got a ClassCastException on the ConfigurationAdmin class during a start of a bundle which uses declarative services then it might be that the start order of the bundles is not correct.

Exception:

org.apache.felix.cm.impl.ConfigurationAdminImpl cannot be cast to org.osgi.service.cm.ConfigurationAdmin

The following bundle levels provide a working configuration on my system:

g! lb apache
START LEVEL 10
 ID|State      |Level|Name
  0|Active     |    0|System Bundle (3.0.8)
 20|Active     |    2|Apache Felix Remote Shell (1.1.2)
 23|Active     |    3|Apache Felix File Install (3.1.10)
 34|Active     |    2|Apache Felix Gogo Runtime (0.8.0)
177|Resolved   |    1|Apache Felix Shell Service (1.4.1)
205|Active     |    2|Apache Felix Gogo Command (0.8.0)
242|Active     |    2|Apache Felix Configuration Admin Service (1.2.4)
269|Installed  |    1|Apache Felix Shell TUI (1.4.1)
294|Active     |    2|Apache Felix Gogo Shell (0.8.0)
309|Active     |    2|Apache Felix EventAdmin (1.2.8)
315|Active     |    2|Apache Felix Declarative Services (1.6.0)
318|Active     |    4|Apache Commons Logging (1.1.1)
319|Active     |    4|Apache Commons IO (1.4.0)
322|Active     |    4|Apache Commons Lang (2.5.0)
325|Active     |    4|Apache Commons Collections (3.2.1)
327|Active     |    4|HttpComponents Client (4.2.1)
331|Active     |    4|Apache Commons Codec (1.6.0)
332|Active     |    4|HttpComponents Core (4.2.1)
336|Active     |    4|Apache Log4J (1.2.16)
337|Active     |    2|Apache Felix Bundle Repository (1.6.6)
339|Active     |    2|Apache Felix Log Service (1.0.0)
340|Active     |    2|Apache Felix iPOJO (1.8.0)
341|Active     |    2|Apache Felix iPOJO WebConsole Plugins (1.6.0)
342|Resolved   |    2|HTTP Service (1.0.0)
343|Active     |    2|Apache Felix Web Management Console (3.1.2)
344|Active     |    2|Apache Felix Metatype Service (1.0.2)

Beware that the final framework level or your configuration may not be set high enough for the previous listed bundle levels. Update the final framework level to 4 at least.

classcastexception_configurationadmin.txt · Last modified: 2014/01/08 10:17 by mihael