Issue
I am getting error :
javax.xml.bind.JAXBException - with linked exception: [java.lang.ClassNotFoundException: com.sun.xml.bind.v2.ContextFactory] at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:195) at javax.xml.bind.ContextFinder.find(ContextFinder.java:381) at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:574) at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:522) at com.zhongway.jtjk.cutoverinfo.CutOverInforequest.getCutOVERinfoxml(CutOverInforequest.java:29) at com.zhongway.jtjk.cutoverinfo.CutOverInforequest.main(CutOverInforequest.java:247) 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:191) ... 5 more
I have added following jars:
javax.xml.bind-2.0.jar jaxb-2.0-m13-1.jar jaxb-api-2.0-ea3.jar
Can someone help me out what wrong with this code.
Solution
Add Below dependecy in your pom.xml file.
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-impl</artifactId>
<version>2.2.11</version>
</dependency>
Answered By - ChandraBhan Singh
Answer Checked By - David Goodson (JavaFixing Volunteer)