Replacements for deprecated JPMS modules with Java EE APIs
Java 9 deprecated six modules that contain Java EE APIs and they are going to be removed soon:
-
java.activation with
javax.activation
package -
java.corba with
javax.activity
,javax.rmi
,javax.rmi.CORBA
, andorg.omg.*
packages -
java.transaction with
javax.transaction
package -
java.xml.bind with all
javax.xml.bind.*
packages -
java.xml.ws with
javax.jws
,javax.jws.soap
,javax.xml.soap
, and alljavax.xml.ws.*
packages -
java.xml.ws.annotation with
javax.annotation
package
Which maintained third-party artifacts provide those APIs? It doesn't matter how well they provide those APIs or which other features they have to offer - all that matters is, are they a drop-in replacement for these modules/packages?
To make it easier to collect knoweldge, I answered with what I know so far and made the answer a community wiki. I hope people will extend it instead of writing their own answers.
Before you vote to close:
- 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.
Instead of using the deprecated Java EE modules, use the following artifacts.
JAF (java.activation)
JavaBeans Activation Framework (now Jakarta Activation) is a standalone technology (available on Maven Central):
<dependency>
<groupId>com.sun.activation</groupId>
<artifactId>jakarta.activation</artifactId>
<version>1.2.2</version>
</dependency>
(Source)
CORBA (java.corba)
From 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)
Stand alone version:
<dependency>
<groupId>jakarta.transaction</groupId>
<artifactId>jakarta.transaction-api</artifactId>
<version>1.3.3</version>
</dependency>
(Source)
JAXB (java.xml.bind)
Since Java EE was rebranded to Jakarta EE, JAXB is now provided by new artifacts:
<!-- 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 Reference Implementation page.
The alternative runtime was brought up by Abhijit Sarkar.
schemagen
and xjc
can be downloaded from there too as part of a standalone JAXB distribution.
See also linked answer.
JAX-WS (java.xml.ws)
Reference implementation:
<!-- 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>
Standalone distribution download (contains wsgen
and wsimport
).
Common Annotations (java.xml.ws.annotation)
Java Commons Annotations (available on Maven Central):
<dependency>
<groupId>jakarta.annotation</groupId>
<artifactId>jakarta.annotation-api</artifactId>
<version>1.3.5</version>
</dependency>
(Source)
JAXB (java.xml.bind) for JDK9
Working perfectly in my desktop applications on 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>
I needed to replace JAX-WS (java.xml.ws) and JAXB (java.xml.bind) for my Spring Boot 2 based application and ended up with these JARs (Gradle build):
// replacements for deprecated JDK module java.xml.ws
runtimeOnly 'javax.xml.ws:jaxws-api:2.3.0' // javax.xml.ws.* classes
runtimeOnly 'javax.jws:jsr181-api:1.0-MR1' // for javax.jws.* classes
// replacement for deprecated JDK module java.xml.bind
runtimeOnly 'javax.xml.bind:jaxb-api'
runtimeOnly 'org.glassfish.jaxb:jaxb-runtime:2.3.0.1'
runtimeOnly 'org.glassfish:javax.json:1.1.2'
runtimeOnly 'org.eclipse:yasson:1.0.1'
(You may need compile
or other scope, runtimeOnly
was enough for us.)
I noticed that https://mvnrepository.com/artifact/com.sun.xml.bind/jaxb-core is described as "Old" and using this answer went for org.glassfish
based stuff that brought in org.eclipse.yasson
as well.
Now it's really messy situation, it works, but how should anyone be sure it's the best replacement, right?