Java 9弃用了六个包含Java EE api的模块,它们很快就会被移除:

java。使用javax激活。激活包 java。Corba和javax。活动,javax。rmi, javax.rmi。CORBA和org.omg。*包 java。使用javax的事务。交易方案 Java.xml.bind与所有javax.xml.bind。*包 Java.xml.ws和javax。jw, javax.jws。肥皂,javax.xml。Soap和所有javax.xml.ws。*包 Java.xml.ws.annotation。注释包

哪些维护的第三方构件提供了这些api ?它们提供的api有多好,或者它们必须提供哪些其他功能并不重要——重要的是,它们是这些模块/包的临时替代品吗?

为了更容易地收集知识,我回答了我目前所知道的,并将答案创建了一个社区wiki。我希望人们能扩展它,而不是自己写答案。


在投票结束前:

Yes, there are already some questions on individual modules and an answer to this question would of course duplicate that information. But AFAIK there is no single point to learn about all of these, which I think has a lot of value. Questions asking for library recommendations are usually considered off-topic, because "they tend to attract opinionated answers and spam", but I don't think that applies here. The set of valid libraries is clearly delineated: They have to implement a specific standard. Beyond that nothing else matters, so I don't see much risk for opinion and spam.


当前回答

我在我的spring mvc项目中使用jdk 11 + ant + ivy。 我得到错误的包javax。所以我添加了javax.jws-api-1.1.jar到类路径,它工作了! 只需从https://repo1.maven.org/maven2/javax/jws/javax.jws-api/1.1/javax.jws-api-1.1.jar下载罐子 并将其添加到build.xml中的类路径中

或者将其添加到pom.xml中:

<dependency>
  <groupId>javax.jws</groupId>
  <artifactId>javax.jws-api</artifactId>
  <version>1.1</version>
</dependency>

其他回答

不要使用已弃用的Java EE模块,而是使用以下构件。

JAF (java.activation)

JavaBeans激活框架(现在是Jakarta Activation)是一个独立的技术(在Maven Central上可用):

<dependency>
    <groupId>com.sun.activation</groupId>
    <artifactId>jakarta.activation</artifactId>
    <version>1.2.2</version>
</dependency>

(源)

CORBA (java.corba)

来自JEP 320:

There will not be a standalone version of CORBA unless third parties take over maintenance of the CORBA APIs, ORB implementation, CosNaming provider, etc. Third party maintenance is possible because the Java SE Platform endorses independent implementations of CORBA. In contrast, the API for RMI-IIOP is defined and implemented solely within Java SE. There will not be a standalone version of RMI-IIOP unless a dedicated JSR is started to maintain it, or stewardship of the API is taken over by the Eclipse Foundation (the transition of stewardship of Java EE from the JCP to the Eclipse Foundation includes GlassFish and its implementation of CORBA and RMI-IIOP).

JTA (java.transaction)

独立版本:

<dependency>
    <groupId>jakarta.transaction</groupId>
    <artifactId>jakarta.transaction-api</artifactId>
    <version>1.3.3</version>
</dependency>

(源)

JAXB (java.xml.bind)

由于Java EE被重新命名为Jakarta EE, JAXB现在由新的构件提供:

<!-- API -->
<dependency>
    <groupId>jakarta.xml.bind</groupId>
    <artifactId>jakarta.xml.bind-api</artifactId>
    <version>2.3.3</version>
</dependency>

<!-- Runtime -->
<dependency>
    <groupId>com.sun.xml.bind</groupId>
    <artifactId>jaxb-impl</artifactId>
    <version>2.3.3</version>
    <scope>runtime</scope>
</dependency>

<!-- Alternative runtime -->
<dependency>
    <groupId>org.glassfish.jaxb</groupId>
    <artifactId>jaxb-runtime</artifactId>
    <version>2.3.3</version>
    <scope>runtime</scope>
</dependency>

JAXB参考实现页。

替代运行时是由Abhijit Sarkar提出的。

schemagen和xjc也可以作为独立JAXB发行版的一部分从那里下载。

参见链接的答案。

JAX-WS (java.xml.ws)

参考实现:

<!-- API -->
<dependency>
    <groupId>jakarta.xml.ws</groupId>
    <artifactId>jakarta.xml.ws-api</artifactId>
    <version>2.3.3</version>
</dependency>

<!-- Runtime -->
<dependency>
    <groupId>com.sun.xml.ws</groupId>
    <artifactId>jaxws-rt</artifactId>
    <version>2.3.3</version>
</dependency>

独立发行版下载(包含wsgen和wsimport)。

通用注释(java.xml.ws.annotation)

Java公共注解(在Maven Central上可用):

<dependency>
    <groupId>jakarta.annotation</groupId>
    <artifactId>jakarta.annotation-api</artifactId>
    <version>1.3.5</version>
</dependency>

(源)

我在我的spring mvc项目中使用jdk 11 + ant + ivy。 我得到错误的包javax。所以我添加了javax.jws-api-1.1.jar到类路径,它工作了! 只需从https://repo1.maven.org/maven2/javax/jws/javax.jws-api/1.1/javax.jws-api-1.1.jar下载罐子 并将其添加到build.xml中的类路径中

或者将其添加到pom.xml中:

<dependency>
  <groupId>javax.jws</groupId>
  <artifactId>javax.jws-api</artifactId>
  <version>1.1</version>
</dependency>

JDK9的JAXB (java.xml.bind)

在jdk9/10 EA上的桌面应用程序中完美地工作

<properties>
    <jaxb-api.version>2.3.0</jaxb-api.version>
</properties>

<!-- JAXB 2.3.0 for jdk9+ -->
<dependency>
    <groupId>javax.xml.bind</groupId>
    <artifactId>jaxb-api</artifactId>
    <version>${jaxb-api.version}</version>
</dependency>
<dependency>
    <groupId>org.glassfish.jaxb</groupId>
    <artifactId>jaxb-runtime</artifactId>
    <version>${jaxb-api.version}</version>
</dependency>
<!-- JAXB needs javax.activation module (jdk9) -->
<dependency>
    <groupId>javax.activation</groupId>
    <artifactId>javax.activation-api</artifactId>
    <version>1.2.0</version>
</dependency>

如果你有这个问题在Talend(7。),你可以在项目的默认POM.xml中添加:

<dependencies>
    <dependency>
        <groupId>javax.xml.soap</groupId>
        <artifactId>javax.xml.soap-api</artifactId>
        <version>1.4.0</version>
    </dependency>
</dependencies>

测试:

AdoptJDK 8.0.275.1-hotspot: OK AdoptJDK 11.0.9.101-hotspot: OK AdoptJDK 15.0.1.9-hotspot: KO(但这是另一个问题:不兼容的条件操作数类型Exception和TDieException) Zulu-8.50.0.1017:好的 Zulu-11.43.1015:好的

jaxws-ri似乎传递依赖于commonj.sdo:commonj.sdo:jar:2.1.1。V201112051852,显然可以从存储库http://download.eclipse.org/rt/eclipselink/maven.repo中找到