JAXB - ClassNotFoundException: com.sun.xml.bind.ContextFactory_1_0_1

I get an error:

GC 16192K->1983K(260160K), 0.0101954 secs]
avax.xml.bind.JAXBException: Provider com.sun.xml.bind.ContextFactory_1_0_1 not
- with linked exception:
java.lang.ClassNotFoundException: com.sun.xml.bind.ContextFactory_1_0_1]
       at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:152)
       at javax.xml.bind.ContextFinder.find(ContextFinder.java:258)
       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)

I added the following banks:

jaxp-api.jar, jaxb-api.jar, jsr173_1.0_api.jar, jaxb-impl.jar, jaxb1-impl.jar, jaxb-libs.jar, jaxb-xjc.jar, jax-qname.jar, jaxrpc. jar, jaxrpc-api.jar, relaxngDatatype.jar

Can someone help me on what's wrong with this code.

Note. The code works when I run the sample code.

+3
source share
1 answer

Adding this.getClass().getClassLoader()an instance to the new method should solve your problem ...

+2
source

Source: https://habr.com/ru/post/1746180/


All Articles