00:00

Removed Java EE and CORBA Modules in Java 11

Last updated: · Removed in Java 11

Java 11 removed nine modules that contained Java EE and CORBA technologies, including JAXB (javax.xml.bind), JAX-WS (javax.xml.ws) and CORBA. They had been deprecated in Java 9. The change is defined by JEP 320.

This tutorial lists what was removed, shows the exact compiler error you get, and explains how to migrate by adding the libraries as normal dependencies.

1. Why Were These Modules Removed?

These technologies were bundled with Java SE for convenience in the Java 6 era, but they were really part of Java EE and evolved separately. Keeping two copies in sync was costly, and the versions inside the JDK fell behind. Since standalone versions are available from Maven Central, removing them makes the JDK smaller and lets applications choose the version they need.

2. Modules Removed by JEP 320

ModuleTechnology
java.xml.wsJAX-WS web services, plus SAAJ and Web Services Metadata
java.xml.bindJAXB XML binding
java.activationJavaBeans Activation Framework (JAF)
java.xml.ws.annotationCommon Annotations such as @PostConstruct
java.corbaCORBA, RMI-IIOP
java.transactiona subset of the JTA API
java.se.eeaggregator module for the six modules above
jdk.xml.ws, jdk.xml.bindtools such as wsimport, xjc and schemagen

3. Practical Examples

Example 1: The compile error after upgrading

Code that compiled on Java 8 fails on Java 11 because the package no longer exists in the JDK. This is the real output of javac --release 11.

UsesJaxb.java
import javax.xml.bind.JAXBContext;     // part of the JDK up to Java 10 only

public class UsesJaxb {
    public static void main(String[] args) throws Exception {
        JAXBContext context = JAXBContext.newInstance(String.class);
        System.out.println(context);
    }
}
Compiler output
UsesJaxb.java:1: error: package javax.xml.bind does not exist
import javax.xml.bind.JAXBContext;     // part of the JDK up to Java 10 only
                     ^
UsesJaxb.java:5: error: cannot find symbol
        JAXBContext context = JAXBContext.newInstance(String.class);
        ^
  symbol:   class JAXBContext
  location: class UsesJaxb
UsesJaxb.java:5: error: cannot find symbol
        JAXBContext context = JAXBContext.newInstance(String.class);
                              ^
  symbol:   variable JAXBContext
  location: class UsesJaxb
3 errors

Example 2: Checking which modules exist

CheckModules.java
import java.util.List;

public class CheckModules {
    public static void main(String[] args) {
        List<String> removed = List.of(
                "java.xml.ws", "java.xml.bind", "java.activation",
                "java.xml.ws.annotation", "java.corba", "java.transaction",
                "java.se.ee", "jdk.xml.ws", "jdk.xml.bind");

        for (String name : removed) {
            boolean present = ModuleLayer.boot().findModule(name).isPresent();
            System.out.println(String.format("%-24s %s", name, present ? "present" : "not in this JDK"));
        }
        System.out.println("java.xml (JAXP) still present: "
                + ModuleLayer.boot().findModule("java.xml").isPresent());
    }
}
Output
java.xml.ws              not in this JDK
java.xml.bind            not in this JDK
java.activation          not in this JDK
java.xml.ws.annotation   not in this JDK
java.corba               not in this JDK
java.transaction         not in this JDK
java.se.ee               not in this JDK
jdk.xml.ws               not in this JDK
jdk.xml.bind             not in this JDK
java.xml (JAXP) still present: true

Only these EE and CORBA modules were removed. The core XML APIs in java.xml, such as DOM, SAX and StAX, remain part of Java SE.

4. How to Migrate

Migration path for removed modules Code that used a removed module fails to compile on Java 11. Adding the standalone library from Maven Central restores it; newer versions use the jakarta namespace. Java 8 code uses javax.xml.bind Java 11 package does not exist add dependency JAXB API + runtime builds again or move to jakarta.*
Figure 1: The fix is a dependency change, not a code rewrite.
pom.xml
<!-- Same javax.xml.bind package, standalone library -->
<dependency>
  <groupId>javax.xml.bind</groupId>
  <artifactId>jaxb-api</artifactId>
  <version>2.3.1</version>
</dependency>
<dependency>
  <groupId>org.glassfish.jaxb</groupId>
  <artifactId>jaxb-runtime</artifactId>
  <version>2.3.9</version>
</dependency>

For new projects, use the Jakarta versions (for example jakarta.xml.bind:jakarta.xml.bind-api), which use the jakarta.xml.bind package.

5. Important Points and Best Practices

  • Run jdeps --jdk-internals and check for javax.xml.bind, javax.xml.ws and javax.activation imports before upgrading.
  • Add both the API and an implementation (runtime) for JAXB and JAX-WS.
  • CORBA has no maintained replacement inside the JDK; consider a third-party ORB or a different protocol.
  • Java 11 also deprecated the Nashorn JavaScript engine (JEP 335); it was removed in Java 15.

6. Summary

  • Java 11 (JEP 320) removed nine Java EE and CORBA modules.
  • JAXB, JAX-WS, JAF, Common Annotations, CORBA and part of JTA are no longer in the JDK.
  • Affected code fails with "package ... does not exist" errors.
  • The fix is to add the libraries from Maven Central, ideally the Jakarta versions.

Related Tutorials

7. References