gpt4 book ai didi

java - Java 12 上的 Apache Axis 1.4

转载 作者:行者123 更新时间:2023-12-02 03:47:43 24 4
gpt4 key购买 nike

我目前正在尝试从 Java 8 项目迁移到 Java 12。(希望如此)最后一个障碍是我们被迫使用旧的 WebService。在 Java 8 中“按原样”使用 WebService 本身并不是问题,它已经工作了很多年。

wsdl 声明:

<!--WSDL created by Apache Axis version: 1.4

Built on Apr 22, 2006 -->

据我所知,新版本的 WSDL2JAVA 不再支持此类服务(因为它们依赖于 Axis 2):

WSDLToJava Error: Rpc/encoded wsdls are not supported with CXF

为了使该服务可用(使用 Java 8 12),我需要以下库:

<!-- https://mvnrepository.com/artifact/javax.xml.rpc/javax.xml.rpc-api -->
<dependency>
<groupId>javax.xml.rpc</groupId>
<artifactId>javax.xml.rpc-api</artifactId>
<version>1.1.2</version>
</dependency>

这就是问题发生的地方。该库定义了部分包javax.xml,由于它是Java系统路径,因此不再允许使用。有什么建议或解决方法吗?我是不是忽略了什么?

编辑:ZhekaKozlov 关于必须切换到 Jakarta 的说法是正确的。现在仍然有错误,因为项目中也需要Axis2。

<!-- https://mvnrepository.com/artifact/org.apache.axis2/axis2-kernel -->
<dependency>
<groupId>org.apache.axis2</groupId>
<artifactId>axis2-kernel</artifactId>
<version>1.7.9</version>
</dependency>

只要将其添加到新的 Java 12 项目中,org.w3c.dom.*(例如文档)就无法使用。

EDIT2:我终于让一切正常工作了。程序正在运行,代码中没有留下任何错误。不幸的是,我无法测试应用程序的 Axis 部分,因为它连接到的服务只能在我们的客户端环境中使用,因此必须进行测试。在 axis2 和 axis2-adb 上,我必须排除两个库:

<exclusions>
<exclusion>
<groupId>org.apache.geronimo.specs</groupId>
<artifactId>geronimo-stax-api_1.0_spec</artifactId>
</exclusion>
<exclusion>
<groupId>jaxen</groupId>
<artifactId>jaxen</artifactId>
</exclusion>
</exclusions>

他们分别阻止了 org.w3c.dom.* 和 javax.xml.stream.*。

最佳答案

自从 Java EE 更名为 Jakarta EE ,您应该使用新的工件:

<dependency>
<groupId>jakarta.xml.rpc</groupId>
<artifactId>jakarta.xml.rpc-api</artifactId>
<version>1.1.4</version>
</dependency>

新工件不再包含拆分包。

关于java - Java 12 上的 Apache Axis 1.4,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58991098/

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