You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@servicemix.apache.org by ggolub <gg...@csc.com> on 2013/02/07 23:41:26 UTC

Re: Servicemix 4.4.2: JaxbException: ClassCastException after deploying a camel route

I am new to ServiceMix and have encountered the same error.  In my case I
have made zero changes to the OOB installation yet I still get the following
error:

org.osgi.service.blueprint.container.ComponentDefinitionException: Failed to
create the JAXB binder : javax.xml.bind.JAXBException: Provider
com.sun.xml.internal.bind.v2.ContextFactory could not be instantiated:
javax.xml.bind.JAXBException: ClassCastException: attempting to cast
jar:file:/C:/java/jdk1.6.0_27/jre/lib/rt.jar!/javax/xml/bind/JAXBContext.class
to bundle://80.0:1/javax/xml/bind/JAXBContext.class.  Please make sure that
you are specifying the proper ClassLoader. - with linked exception:
[javax.xml.bind.JAXBException: ClassCastException: attempting to cast
jar:file:/C:/java/jdk1.6.0_27/jre/lib/rt.jar!/javax/xml/bind/JAXBContext.class
to bundle://80.0:1/javax/xml/bind/JAXBContext.class.  Please make sure that
you are specifying the proper ClassLoader.    ]
        at
org.apache.camel.blueprint.handler.CamelNamespaceHandler.parseCamelContextNode(CamelNamespaceHandler.java:172)[152:org.apache.camel.camel-blueprint:2.8.5]
        at
org.apache.camel.blueprint.handler.CamelNamespaceHandler.parse(CamelNamespaceHandler.java:135)[152:org.apache.camel.camel-blueprint:2.8.5]
        at
org.apache.aries.blueprint.container.Parser.parseCustomElement(Parser.java:1248)[10:org.apache.aries.blueprint:0.3.1]
        at
org.apache.aries.blueprint.container.Parser.loadComponents(Parser.java:337)[10:org.apache.aries.blueprint:0.3.1]
        at
org.apache.aries.blueprint.container.Parser.populate(Parser.java:277)[10:org.apache.aries.blueprint:0.3.1]
        at
org.apache.aries.blueprint.container.BlueprintContainerImpl.doRun(BlueprintContainerImpl.java:277)[10:org.apache.aries.blueprint:0.3.1]
        at
org.apache.aries.blueprint.container.BlueprintContainerImpl.run(BlueprintContainerImpl.java:227)[10:org.apache.aries.blueprint:0.3.1]
        at
java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)[:1.6.0_27]
        at
java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)[:1.6.0_27]
        at
java.util.concurrent.FutureTask.run(FutureTask.java:138)[:1.6.0_27]
        at
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:98)[:1.6.0_27]
        at
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:206)[:1.6.0_27]
        at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)[:1.6.0_27]
        at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)[:1.6.0_27]
        at java.lang.Thread.run(Thread.java:662)[:1.6.0_27]
Caused by: javax.xml.bind.JAXBException: Provider
com.sun.xml.internal.bind.v2.ContextFactory could not be instantiated:
javax.xml.bind.JAXBException: ClassCastException: attempting to cast
jar:file:/C:/java/jdk1.6.0_27/jre/lib/rt.jar!/javax/xml/bind/JAXBContext.class
to bundle://80.0:1/javax/xml/bind/JAXBContext.class.  Please make sure that
you are specifying the proper ClassLoader.
 - with linked exception:
[javax.xml.bind.JAXBException: ClassCastException: attempting to cast
jar:file:/C:/java/jdk1.6.0_27/jre/lib/rt.jar!/javax/xml/bind/JAXBContext.class
to bundle://80.0:1/javax/xml/bind/JAXBContext.class.  Please make sure
that you are specifying the proper ClassLoader.    ]
        at
javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:187)[80:org.apache.servicemix.specs.jaxb-api-2.2:1.9.0]
        at
javax.xml.bind.ContextFinder.find(ContextFinder.java:310)[80:org.apache.servicemix.specs.jaxb-api-2.2:1.9.0]
        at
javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:412)[80:org.apache.servicemix.specs.jaxb-api-2.2:1.9.0]
        at
javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:375)[80:org.apache.servicemix.specs.jaxb-api-2.2:1.9.0]
        at
org.apache.camel.blueprint.handler.CamelNamespaceHandler.createJaxbContext(CamelNamespaceHandler.java:444)[152:org.apache.camel.camel-blueprint:2.8.5]
        at
org.apache.camel.blueprint.handler.CamelNamespaceHandler.getJaxbContext(CamelNamespaceHandler.java:431)[152:org.apache.camel.camel-blueprint:2.8.5]
        at
org.apache.camel.blueprint.handler.CamelNamespaceHandler.parseCamelContextNode(CamelNamespaceHandler.java:170)[152:org.apache.camel.camel-blueprint:2.8.5]
        ... 14 more
Caused by: javax.xml.bind.JAXBException: ClassCastException: attempting to
cast
jar:file:/C:/java/jdk1.6.0_27/jre/lib/rt.jar!/javax/xml/bind/JAXBContext.class
to bundle://80.0:1/javax/xml/bind/JAXBContext.class.  Please
make sure that you are specifying the proper ClassLoader.
        at
javax.xml.bind.ContextFinder.handleClassCastException(ContextFinder.java:107)[80:org.apache.servicemix.specs.jaxb-api-2.2:1.9.0]
        at
javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:140)[80:org.apache.servicemix.specs.jaxb-api-2.2:1.9.0]
        ... 20 more

I'm using java "1.6.0_27" 64 bit.

The steps I took were as follows:
1. Downloaded apache-servicemix-4.4.2.zip to my laptop and extracted it to a
directory.
2. Created a .xml file named "blueprint.xml" in the deploy directory with
the following contents (from the getting started guide example):
<?xml version="1.0" encoding="UTF-8"?>
<blueprint
    xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
    xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0
http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd">

    <camelContext xmlns="http://camel.apache.org/schema/blueprint">
      <route>
        <from uri="file:camel/input"/>
        <log message="Moving ${file:name} to the output directory"/>
        <to uri="file:camel/output"/>
      </route>
    </camelContext>
</blueprint>
3. started service mix by going to %SERVICEMIX_HOME% and running
bin\servicemix.bat
4. After startup I ran osgi:list and see the following:
    [ 156] [Active     ] [Failure     ] [       ] [   60] blueprint.xml
(0.0.0)
5. packages:exports | grep javax.xml.bind shows the following:
   0 # javax.xml.bind; version=0.0.0
   0 # javax.xml.bind.annotation; version=0.0.0
   0 # javax.xml.bind.annotation.adapters; version=0.0.0
   0 # javax.xml.bind.attachment; version=0.0.0
   0 # javax.xml.bind.helpers; version=0.0.0
   0 # javax.xml.bind.util; version=0.0.0
  80 javax.xml.bind.attachment; version=2.2.1
  80 javax.xml.bind.helpers; version=2.2.1
  80 javax.xml.bind.annotation; version=2.2.1
  80 javax.xml.bind.util; version=2.2.1
  80 javax.xml.bind.annotation.adapters; version=2.2.1
  80 javax.xml.bind; version=2.2.1

I'm at a loss as to why I have two class loaders referencing JAXBContext.

Any help would be greatly appreciated.

-- Gary



--
View this message in context: http://servicemix.396122.n5.nabble.com/Servicemix-4-4-2-JaxbException-ClassCastException-after-deploying-a-camel-route-tp5714220p5715786.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.

Re: Servicemix 4.4.2: JaxbException: ClassCastException after deploying a camel route

Posted by Fladnag <fl...@zerezo.com>.
Hi,

This happens when no jaxb-impl bundle was loaded.

I had the same issue when I tried to remove camel-cxf from the featuresBoot
in etc/org.apache.karaf.features.cfg

Maybe camel-cxf don't load properly for you due to another issue, check the
status with :
features:list | grep camel-cxf
if the feature is not installed, try to manually reinstall it with :
features:install -v camel-cxf
and check errors.

You can also try to manually load jaxb-impl only by typing :
osgi:install -s
mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.jaxb-impl/2.2.1.1_1




--
View this message in context: http://servicemix.396122.n5.nabble.com/Servicemix-4-4-2-JaxbException-ClassCastException-after-deploying-a-camel-route-tp5714220p5716167.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.