gpt4 book ai didi

jakarta-ee - NoSuchMethodError - MtomStreamWriter.getAttachmentMarshaller() 方法

转载 作者:行者123 更新时间:2023-12-04 14:59:23 25 4
gpt4 key购买 nike

我正在使用 wsdl 连接,当我收到响应时,出现如下错误。

enter image description here

但是,我已经有了这样一个

enter image description here

下面是我使用的所有依赖

<dependencies>
<dependency>
<groupId>com.sun.xml.ws</groupId>
<artifactId>jaxws-tools</artifactId>
<version>3.0.0</version>
</dependency>
<dependency>
<groupId>com.sun.xml.ws</groupId>
<artifactId>jaxws-rt</artifactId>
<version>3.0.0</version>
</dependency>
<dependency>
<groupId>javax.jws</groupId>
<artifactId>javax.jws-api</artifactId>
<version>1.1</version>
</dependency>
<dependency>
<groupId>javax.xml.ws</groupId>
<artifactId>jaxws-api</artifactId>
<version>2.3.1</version>
</dependency>
<dependency>
<groupId>com.sun.xml.ws</groupId>
<artifactId>rt</artifactId>
<version>2.3.1</version>
</dependency>
<dependency>
<groupId>com.sun.xml.stream.buffer</groupId>
<artifactId>streambuffer</artifactId>
<version>1.4</version>
</dependency>
<dependency>
<groupId>org.jvnet.staxex</groupId>
<artifactId>stax-ex</artifactId>
<version>1.2</version>
</dependency>
<dependency>
<groupId>javax.xml.soap</groupId>
<artifactId>javax.xml.soap-api</artifactId>
<version>1.4.0</version>
</dependency>
<dependency>
<groupId>com.sun.xml.messaging.saaj</groupId>
<artifactId>saaj-impl</artifactId>
<version>1.5.1</version>
</dependency>
<dependency>
<groupId>org.glassfish.gmbal</groupId>
<artifactId>gmbal-api-only</artifactId>
<version>4.0.2</version>
</dependency>
<dependency>
<groupId>org.jvnet.staxex</groupId>
<artifactId>stax-ex</artifactId>
<version>2.0.0</version>
</dependency>

</dependencies>

我不明白为什么会出现这样的错误。在此先感谢您的回答。

最佳答案

我在 Jakarta 和启用 MTOM 后遇到了同样的问题。
我现在使用 Java 17

Exception in thread "AWT-EventQueue-0" java.lang.NoSuchMethodError: 'jakarta.xml.bind.attachment.AttachmentMarshaller org.jvnet.staxex.util.MtomStreamWriter.getAttachmentMarshaller()'

stax-ex-1.8.jar中,该方法的返回类型是javax.xml.bind.attachment.AttachmentMarshaller,不是预期的jakarta .xml.bind.attachment.AttachmentMarshaller 显示在错误消息中。

这是我的 pom.xml 中有问题的依赖项:

...
<dependency> <!-- Not good -->
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.3.1</version>
</dependency>
<dependency> <!-- Not good -->
<groupId>org.glassfish.jaxb</groupId>
<artifactId>jaxb-runtime</artifactId>
<version>2.3.1</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>jakarta.xml.ws</groupId>
<artifactId>jakarta.xml.ws-api</artifactId>
<version>3.0.1</version>
</dependency>
<dependency>
<groupId>com.sun.xml.ws</groupId>
<artifactId>jaxws-rt</artifactId>
<version>3.0.2</version>
</dependency>
...

以下是新的良好依赖项:

...
<!-- JAXB API v3.0.1 -->
<dependency>
<groupId>jakarta.xml.bind</groupId>
<artifactId>jakarta.xml.bind-api</artifactId>
<version>3.0.1</version>
</dependency>
<!-- JAXB v3.0.2 reference implementation -->
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-impl</artifactId>
<version>3.0.2</version>
<scope>runtime</scope>
</dependency>

<dependency>
<groupId>jakarta.xml.ws</groupId>
<artifactId>jakarta.xml.ws-api</artifactId>
<version>3.0.1</version>
</dependency>
<dependency>
<groupId>com.sun.xml.ws</groupId>
<artifactId>jaxws-rt</artifactId>
<version>3.0.2</version>
</dependency>
...

stax-ex-1.8.jar 现在被替换为 stax-ex-2.0.1.jar
然后,我的客户端网络服务 Jakarta JAX-WS 在启用 MTOM 的情况下工作正常。

关于jakarta-ee - NoSuchMethodError - MtomStreamWriter.getAttachmentMarshaller() 方法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/67258558/

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