jdk1.5中的javax.xml.bind.JAXBException [java.lang.ClassNotFoundException:com.sun.xml.bind.v2.ContextFactory] ​​

时间:2016-07-18 06:59:49

标签: java xml jaxb

我收到错误:

  

javax.xml.bind.JAXBException     - 链接异常:[java.lang.ClassNotFoundException:com.sun.xml.bind.v2.ContextFactory] ​​at 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 at   javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:522)at at   com.zhongway.jtjk.cutoverinfo.CutOverInforequest.getCutOVERinfoxml(CutOverInforequest.java:29)     在   com.zhongway.jtjk.cutoverinfo.CutOverInforequest.main(CutOverInforequest.java:247)   引起: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 at   java.lang.ClassLoader.loadClass(ClassLoader.java:251)at   javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:191)...   另外5个

我添加了以下罐子:

 javax.xml.bind-2.0.jar   jaxb-2.0-m13-1.jar   jaxb-api-2.0-ea3.jar

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

1 个答案:

答案 0 :(得分:7)

在pom.xml文件中添加以下依赖项。

    <dependency>
        <groupId>com.sun.xml.bind</groupId>
        <artifactId>jaxb-impl</artifactId>
        <version>2.2.11</version>
    </dependency>