我正在尝试编译我的maven项目,但不能这样做。我明白了这个问题:
Exception in thread "main" java.lang.NoClassDefFoundError: com/sun/xml/bind/api/TypeReference
at com.sun.xml.ws.db.glassfish.JAXBRIContextFactory.typeInfoMappings(JAXBRIContextFactory.java:127)
at com.sun.xml.ws.db.glassfish.JAXBRIContextFactory.newContext(JAXBRIContextFactory.java:85)
... ...跳过
at com.ric.st.impl.TaskController.searchTask(TaskController.java:144)
at com.ric.st.impl.App22.main(App22.java:82)
Caused by: java.lang.ClassNotFoundException: com.sun.xml.bind.api.TypeReference
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 33 more
但是我的pom包含了这个项目所需的所有库:
<dependency>
<groupId>com.sun.xml.ws</groupId>
<artifactId>jaxws-rt</artifactId>
<version>2.2.10</version>
</dependency>
<dependency>
<groupId>com.sun.xml.ws</groupId>
<artifactId>policy</artifactId>
<version>2.7.2</version>
</dependency>
<dependency>
<groupId>com.sun.xml.stream.buffer</groupId>
<artifactId>streambuffer</artifactId>
<version>1.5.4</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.sun.xml.bind/jaxb1-impl -->
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb1-impl</artifactId>
<version>2.2.5.1</version>
</dependency>
如何更正此问题?
答案 0 :(得分:0)
缺少JAX-WS依赖库“jaxb-impl.jar”。您可以尝试将jaxb1-impl
替换为jaxb-impl
,您可以在
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-impl</artifactId>
<version>2.2.11</version>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-core</artifactId>
<version>2.2.11</version>
</dependency>