MOXy/JAXB ClassCastException: attempting to cast bundleresource://.../JAXBContext.class to jar:file: [message #630236] |
Fri, 01 October 2010 09:34 |
Eclipse User |
|
|
|
Originally posted by: guen.my-lounge.net
Hi,
the marshaller throws in my equinox osgi environment the following
exception:
Caused by: javax.xml.bind.JAXBException: ClassCastException: attempting
to cast
bundleresource://150.fwk29293232:5/javax/xml/bind/JAXBContex t.class to
jar:file:/C:/Programme/Java/jdk1.6.0_14/jre/lib/rt.jar!/java x/xml/bind/JAXBContext.class.
Please make sure that you are specifying the proper ClassLoader.
The code for marhalling looks like this:
JAXBContext context = JAXBContext.newInstance( someObj.getClass() );
marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE );
marshaller.marshal( someObj, writer );
The "someObj" is JAXB annotated, but sits in a different bundle. The
wired thing is, that I have running JUnit-Plugin test where marschalling
throws no exception. If I run the same code with a OSGi launch config,
the exception occurs!? Where is the difference? - I totally stuck on
this :-(
Thanks for any help!
greetz,
guen
Part of Exception StackTrace:
Caused by: javax.xml.bind.JAXBException: ClassCastException: attempting
to cast
bundleresource://150.fwk29293232:5/javax/xml/bind/JAXBContex t.class to
jar:file:/C:/Programme/Java/jdk1.6.0_14/jre/lib/rt.jar!/java x/xml/bind/JAXBContext.class.
Please make sure that you are specifying the proper ClassLoader.
at
javax.xml.bind.ContextFinder.handleClassCastException(Contex tFinder.java:96)
~[jaxb-api-2.1.jar:na]
at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java: 205)
~[jaxb-api-2.1.jar:na]
at javax.xml.bind.ContextFinder.find(ContextFinder.java:363)
~[jaxb-api-2.1.jar:na]
at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:574)
~[jaxb-api-2.1.jar:na]
at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:522)
~[jaxb-api-2.1.jar:na]
at
de.goldmind.bizpanel.reporting.core.cdo.manager.ReportManage r.createReportJob(ReportManager.java:56)
~[na:na]
... 59 common frames omitted
|
|
|
|
Powered by
FUDForum. Page generated in 0.04468 seconds