gpt4 book ai didi

java - 错误注入(inject) : org. jvnet.mjiip.v_2.XJC2Mojo java.lang.NoClassDefFoundError: com/sun/xml/bind/api/ErrorListener

转载 作者:行者123 更新时间:2023-11-30 06:58:51 24 4
gpt4 key购买 nike

我正在使用 Maven 将我的 WSDL 文件转换为 Java 类,但是当我提供以下 Jar 时:-org.jvnet.jaxb2.maven2--->maven-jaxb2-plugin version 0.8.3/0.12.3但是我收到以下错误

    [INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building SOAPSpring 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[WARNING] The POM for org.glassfish.jaxb:jaxb-runtime:jar:2.2.11 is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details
[WARNING] The POM for org.glassfish.jaxb:jaxb-xjc:jar:2.2.11 is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details
[INFO]
[INFO] --- maven-jaxb2-plugin:0.12.3:generate (generate) @ SOAPSpring ---
[WARNING] Error injecting: org.jvnet.mjiip.v_2.XJC2Mojo
java.lang.NoClassDefFoundError: com/sun/xml/bind/api/ErrorListener
at java.lang.ClassLoader.defineClass1(Native Method)

我的 POM 文件看起来像......

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>SOAPSpring</groupId>
<artifactId>SOAPSpring</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<name>SOAPSpring</name>
<description>SOAPSpring</description>

<properties>
<jaxb2.plugin.version>0.8.3</jaxb2.plugin.version>
</properties>
<dependencies>
<dependency>
<groupId>org.jvnet.jaxb2.maven2</groupId>
<artifactId>maven-jaxb2-plugin</artifactId>
<version>${jaxb2.plugin.version}</version>
</dependency>
<!-- <dependency>
<groupId>org.jvnet.jaxb2.maven2</groupId>
<artifactId>maven-jaxb2-plugin-core</artifactId>
<version>0.12.3</version>
</dependency>
<dependency>
<groupId>com.sun.xml.ws</groupId>
<artifactId>jaxws-rt</artifactId>
<version>2.2.8</version>
</dependency> -->
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>2.3</version>
<configuration>
<warSourceDirectory>WebContent</warSourceDirectory>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
<plugin>
<groupId>org.jvnet.jaxb2.maven2</groupId>
<artifactId>maven-jaxb2-plugin</artifactId>
<version>${jaxb2.plugin.version}</version>
<executions>
<execution>
<id>generate</id>
<goals>
<goal>generate</goal>
</goals>
</execution>
</executions>
<configuration>
<packageName>com.exide.pensionWSDL</packageName>
<wsdl>true</wsdl>
<xmlschema>false</xmlschema>
<schemaFiles>pension.wsdl</schemaFiles>
<schemaDirectory>${project.basedir}/src/main/resources
</schemaDirectory>
<outputDirectory>${project.basedir}/src/main/java</outputDirectory>
<clearOutputDir>true</clearOutputDir>
</configuration>
</plugin>
</plugins>
</build>

最佳答案

我在使用 JRE 而不是 JDK 时遇到了同样的错误。我建议您确保使用 JDK。

问候,

关于java - 错误注入(inject) : org. jvnet.mjiip.v_2.XJC2Mojo java.lang.NoClassDefFoundError: com/sun/xml/bind/api/ErrorListener,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32218579/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com