Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » Java Architecture for XML Binding (JAXB) - Class not found
Java Architecture for XML Binding (JAXB) - Class not found [message #551105] Thu, 05 August 2010 09:16 Go to next message
MoJo is currently offline MoJoFriend
Messages: 7
Registered: July 2010
Junior Member
Hi,

I am looking for some JAXB experts help!

To save some formatted data, I want to use Java Architecture for XML Binding (JAXB). It is my first time and immediately I got some problems.

It doesn't matter, which version of JAXB I use. Everytime, with

JAXBContext.newInstance(Data.class)

I get the following ClassNotFoundException:

javax.xml.bind.JAXBException
- with linked exception:
[java.lang.ClassNotFoundException: com.sun.xml.internal.bind.v2.ContextFactory]
at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java: 186)
at javax.xml.bind.ContextFinder.find(ContextFinder.java:375)
at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:618)
at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:565)


Did somebody got the same problem and fixed it?

Would be glad for answers.

Thx
Re: Java Architecture for XML Binding (JAXB) - Class not found [message #551163 is a reply to message #551105] Thu, 05 August 2010 13:30 Go to previous messageGo to next message
Blaise Doughan is currently offline Blaise DoughanFriend
Messages: 163
Registered: July 2009
Senior Member

JAXB is a standard runtime with multiple implementations, just like JPA. There error you are seeing is that the Metro JAXB implementation (the RI) cannot be found.

If you want to use the EclipseLink JAXB (MOXy) implementation simply add the eclipselink.jar to your classpath and add a file named jaxb.properties with the following entry in with your model classes:

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

If you want to use Metro JAXB it is included in Java SE 6, or can be found at https://jaxb.dev.java.net/

For more information on MOXy see:
- http://www.eclipse.org/eclipselink/moxy.php
- http://wiki.eclipse.org/EclipseLink/Examples/MOXy
- http://bdoughan.blogspot.com

-Blaise

Blaise Doughan
Team Lead, EclipseLink JAXB & SDO


Re: Java Architecture for XML Binding (JAXB) - Class not found [message #551439 is a reply to message #551163] Fri, 06 August 2010 13:02 Go to previous message
MoJo is currently offline MoJoFriend
Messages: 7
Registered: July 2010
Junior Member
Thank you Blaise for your answer.

For testing, I created a new project, which includes all needed jars. This works fine. The xml file is written and readed. But this was a "usual" java application. Smile

Now, the reason why I need help is, that the exception occur in a rcp application.

I include the jars via the manifest -> runtime -> classpath. I also tried to fix it by release this jars into a seperate bundle. But everytime I got this ava.lang.ClassNotFoundException: com.sun.xml.internal.bind.v2.ContextFactory]!

... and the class is in the included jars Wink

Is there anybody, who can help?
Previous Topic:foreign key constraint problem
Next Topic:Difficulties Unmarshalling Timestamp
Goto Forum:
  


Current Time: Tue Mar 19 11:25:14 GMT 2024

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

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

Back to the top