Removed Java EE and CORBA Modules 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
| Module | Technology |
|---|---|
java.xml.ws | JAX-WS web services, plus SAAJ and Web Services Metadata |
java.xml.bind | JAXB XML binding |
java.activation | JavaBeans Activation Framework (JAF) |
java.xml.ws.annotation | Common Annotations such as @PostConstruct |
java.corba | CORBA, RMI-IIOP |
java.transaction | a subset of the JTA API |
java.se.ee | aggregator module for the six modules above |
jdk.xml.ws, jdk.xml.bind | tools 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.
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);
}
}
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
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());
}
}
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
<!-- 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-internalsand check forjavax.xml.bind,javax.xml.wsandjavax.activationimports 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
- Java 11 Features
- Strong Encapsulation of JDK Internals (Java 17)
- Serialization in Java
- HTTP Client API
7. References
Frequently Asked Questions (FAQ)
Q1. Why do I get "package javax.xml.bind does not exist" on Java 11?
JAXB was removed from the JDK in Java 11 by JEP 320. Add the JAXB API and an implementation as dependencies.
Q2. Which modules were removed in Java 11?
java.xml.ws, java.xml.bind, java.activation, java.xml.ws.annotation, java.corba, java.transaction, java.se.ee, jdk.xml.ws and jdk.xml.bind.
Q3. Is javax.xml.parsers also removed?
No. The core XML processing APIs (JAXP: DOM, SAX, StAX, XSLT) are in the java.xml module and remain part of Java SE.
Q4. When were these modules deprecated?
In Java 9, where they were marked as deprecated for removal and not resolved by default.