Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » java.lang.ClassCastException: com.sun.xml.bind.v2.runtime.JAXBContextImpl cannot be cast to javax.xm(Deploying War file in JBOSS server, its pointing different JAR)
java.lang.ClassCastException: com.sun.xml.bind.v2.runtime.JAXBContextImpl cannot be cast to javax.xm [message #718537] Wed, 24 August 2011 16:10 Go to next message
chitti babu is currently offline chitti babuFriend
Messages: 9
Registered: February 2011
Junior Member
Hi I am getting same error,

But i am using Eclipse , jdk 6, Jboss 5, Sporing message listener. Weblogic 11g is using to send messages . Getting messages from WL Queue to my app thru some logic.
I am able to print xml messages in the console, but getting exception before unmarshal this,

Code :
JAXBContext jc = JAXBContext.newInstance("com.bopeep.gen");
Unmarshaller unmarshaller = jc.createUnmarshaller();
// unmarshall into Classes from a File
bilgMsg = (BILGMSG) unmarshaller.unmarshal( new StreamSource( new StringReader(stringMessage)));

Please see the below error and help to resolve this
Exception:
11:41:49,475 WARN [DefaultMessageListenerContainer] Execution of JMS message listener failed, and no ErrorHandler has been set.
java.lang.ClassCastException: com.sun.xml.bind.v2.runtime.JAXBContextImpl cannot be cast to javax.xml.bind.JAXBContext
at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:149)
at javax.xml.bind.ContextFinder.find(ContextFinder.java:285)
at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:372)
at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:337)
at javax.xml.bind.JAXBContext.newInstance(JAXBContext
  • Attachment: server.log
    (Size: 24.02KB, Downloaded 110 times)
Re: java.lang.ClassCastException: com.sun.xml.bind.v2.runtime.JAXBContextImpl cannot be cast to java [message #719379 is a reply to message #718537] Fri, 26 August 2011 21:04 Go to previous messageGo to next message
Blaise Doughan is currently offline Blaise DoughanFriend
Messages: 163
Registered: July 2009
Senior Member

Hi Chitti,

Are you attempting to use EclipseLink MOXy as your JAXB provider or the reference implementation? If you wish to use MOXy be sure to specify a file named jaxb.properties in with your domain classes with the following entry:

javax.xml.bind.context.factory=org.eclipse.persistence.jaxb.JAXBContextFactory


You also appear to be hitting a ClassLoader issue. You can try using

JAXBContext jc = JAXBContext.newInstance("com.bopeep.gen", DomainClass.class.getClassLoader());


-Blaise
Re: java.lang.ClassCastException: com.sun.xml.bind.v2.runtime.JAXBContextImpl cannot be cast to java [message #721062 is a reply to message #719379] Wed, 31 August 2011 19:53 Go to previous messageGo to next message
chitti babu is currently offline chitti babuFriend
Messages: 9
Registered: February 2011
Junior Member
Hi Blaise,

I am not using EclipseLink MOXy as my JAXB provider .

I am using only JBOSS eap 5 Server and jdk1.6 version.
I am not downloading any jars explicitly like using artifacts, its using JBOSS -jaxb-impl.jar and jaxb-api.jar files.

i am trying to add
JAXBContext jc = JAXBContext.newInstance("com.bopeep.gen", DomainClass.class.getClassLoader());

but how to get DomainClass?
I added this parameter, but not able to get this DomainClass.class API.

Thanks

[Updated on: Wed, 31 August 2011 20:52]

Report message to a moderator

(no subject) [message #721076 is a reply to message #719379] Wed, 31 August 2011 19:53 Go to previous messageGo to next message
chitti babu is currently offline chitti babuFriend
Messages: 9
Registered: February 2011
Junior Member
Duplicate:

Ignore this message.

[Updated on: Thu, 01 September 2011 15:01]

Report message to a moderator

Re: java.lang.ClassCastException: com.sun.xml.bind.v2.runtime.JAXBContextImpl cannot be cast to java [message #721360 is a reply to message #721062] Thu, 01 September 2011 15:00 Go to previous messageGo to next message
chitti babu is currently offline chitti babuFriend
Messages: 9
Registered: February 2011
Junior Member

I coudnt fine DomainClass.class.getClassLoader().

I used like below.
JAXBContext jc = JAXBContext.newInstance("com.dnb.bopeep.gen", this.getClass().getClassLoader());

but got the same exception.
(no subject) [message #721365 is a reply to message #721076] Thu, 01 September 2011 15:00 Go to previous message
chitti babu is currently offline chitti babuFriend
Messages: 9
Registered: February 2011
Junior Member
I coudnt fine DomainClass.class.getClassLoader().

I used like below.
JAXBContext jc = JAXBContext.newInstance("com.dnb.bopeep.gen", this.getClass().getClassLoader());

but got the same exception.
Previous Topic:(no subject)
Next Topic:(no subject)
Goto Forum:
  


Current Time: Mon Dec 22 13:39:42 GMT 2014

Powered by FUDForum. Page generated in 0.02106 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software