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

时间:2010-05-19 12:43:39

标签: jaxb

我收到错误:

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)

我添加了以下罐子:

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

有人可以帮我解决这段代码的错误。

注意:当我运行示例代码时,代码可以正常工作。

1 个答案:

答案 0 :(得分:2)

在新实例方法中添加this.getClass().getClassLoader()应解决您的问题......