Hi there,
hope you can help me.
First of all, is it right that xjc in JAXB 2.0 doesn't create an implementation folder as JAXB 1.0 does? (Because this might be the solution of my problem :-))
When I try to compile a test code, I'm getting the following error message:
javax.xml.bind.JAXBException: Provider com.sun.xml.bind.v2.ContextFactory not found
- with linked exception:
[java.lang.ClassNotFoundException: com.sun.xml.bind.v2.ContextFactory]
at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:151)
at javax.xml.bind.ContextFinder.find(ContextFinder.java:299)
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.java:244)
at Test.main(Test.java:24)
Caused by: java.lang.ClassNotFoundException: com.sun.xml.bind.v2.ContextFactory
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:268)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:116)
... 5 more
So the problem is based on the creation of a JAXBContext.
Does anyone know a solution?
In the project folder I have a folder named "datastructure" (containing the files I got from the xjc) and the main-java-file which looks like this:
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
import datastructure.*;
public class Test {
public static void main(String[] args) {
try {
JAXBContext jc = JAXBContext.newInstance("datastructure");
...
} catch (JAXBException je) {
je.printStackTrace();
}
}
}
Is it right to give only "datastructure" as the parameter for newInstance()?
Thanks in advance!