Exception in thread "main" javax.xml.bind.JAXBException: Implementation of JAXB-API has not been found on module path or classpath.
- with linked exception:
[java.lang.ClassNotFoundException: com.sun.xml.internal.bind.v2.ContextFactory]
at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:278)
at javax.xml.bind.ContextFinder.find(ContextFinder.java:421)
at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:721)
at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:662)
at clasesjaxb.Ejemplo1_JAXB.main(Ejemplo1_JAXB.java:28)
Caused by: java.lang.ClassNotFoundException: com.sun.xml.internal.bind.v2.ContextFactory
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
at javax.xml.bind.ServiceLoaderUtil.nullSafeLoadClass(ServiceLoaderUtil.java:122)
at javax.xml.bind.ServiceLoaderUtil.safeLoadClass(ServiceLoaderUtil.java:155)
at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:276)
... 4 more
Stephan van Hulst wrote:Where did you get the JAXB RI zip from?
The problem is that you only added the API library to the class path, but not the implementation. Since I don't use Eclipse, I don't know if it allows you to separately specify which dependencies go on the classpath only at runtime, but if it does then there's where you would place the implementation library.
Issues with dependencies are MUCH easier to solve if you use Maven for your projects.
Stephan van Hulst wrote:Where did you get the JAXB RI zip from?
The problem is that you only added the API library to the class path, but not the implementation. Since I don't use Eclipse, I don't know if it allows you to separately specify which dependencies go on the classpath only at runtime, but if it does then there's where you would place the implementation library.
Issues with dependencies are MUCH easier to solve if you use Maven for your projects.
Experience keeps a dear School, but Fools will learn in no other.
---
Benjamin Franklin - Postal official and Weather observer
Stephan van Hulst wrote:You need to find the version of EclipseLink that is compatible with your version of JAXB.
javax.xml.bind.context.factory=org.eclipse.persistence.jaxb.JAXBContextFactory
Stephan van Hulst wrote:Again, from where did you get the JAXB RI library from? And why did you choose that version?
Exception in thread "main" java.lang.NoClassDefFoundError: com/sun/istack/Pool
at com.sun.xml.bind.v2.runtime.JAXBContextImpl$JAXBContextBuilder.build(JAXBContextImpl.java:1156)
at com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:165)
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
at java.base/java.lang.reflect.Method.invoke(Method.java:577)
at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:297)
at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:286)
at javax.xml.bind.ContextFinder.find(ContextFinder.java:409)
at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:721)
at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:662)
at classjaxb.Ejemplo1_JAXB.main(Ejemplo1_JAXB.java:29)
Caused by: java.lang.ClassNotFoundException: com.sun.istack.Pool
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
... 10 more
Stephan van Hulst wrote:What version of Java are you using in NetBeans?