Are you upgrading your applications to Java 11 ? Some old Jars may not work !!

JAVA 11

JDK 11 was released in September 2018. Java 11 has many new features but It also removed some features from the previous releases.

Java 8 to Java 11 Upgrade
Java 8 to Java 11 Upgrade


Following main components are dropped in Java 11

  • Java Applets and Java Web Start are no longer available. 
  • Some of the JavaFX, Java EE and CORBA modules have been removed from JDK 11

Deployment stack is removed

  • Java deployment technologies were deprecated in JDK 9 and removed in JDK 11.
  • Java applet and Web Start functionality, including the Java plug-in, the Java Applet Viewer, Java Control Panel, and Java Web Start, along with javaws tool, have been removed in JDK 11.


Removal of Java EE and CORBA Modules

In JDK 11, the Java EE and CORBA modules were removed. These modules were deprecated for removal in JDK 9.

The removed modules are:
  • java.xml.ws: Java API for XML Web Services (JAX-WS), Web Services Metadata for the Java Platform, and SOAP with Attachments for Java (SAAJ)
  • java.xml.bind: Java Architecture for XML Binding (JAXB)
  • java.xml.ws.annotation: The subset of the JSR-250 Common Annotations defined by Java SE to support web services
  • java.corba: CORBA
  • java.transaction: The subset of the Java Transaction API defined by Java SE to support CORBA Object Transaction Services
  • java.activation: JavaBeans Activation Framework
  • java.se.ee: Aggregator module for the six modules above
  • jdk.xml.ws: Tools for JAX-WS
  • jdk.xml.bind: Tools for JAXB
the last module JAXB is essential framework if your application is using xml marshalling code. 

Removal of Security Certificates

The following root certificate has been removed from the keystore in JDK 11:
  • Removal of GTE CyberTrust Global Root
  • The following root certificates have been removed from the truststore in JDK 11:
  • Several Symantec Root CAs
  • Baltimore Cybertrust Code Signing CA
  • SECOM Root Certificate
  • AOL and Swisscom root certificates
If your application using any of these above certificate then they may not work in JDK11.

JavaDB is removed

JavaDB, which was a rebranding of Apache Derby, is no longer included in the JDK.
JavaDB was bundled with JDK 7 and JDK 8. It was found in the db directory of the JDK installation directory.

You can download and install Apache Derby from Apache Derby Downloads.

Removed Java VisualVM

Java VisualVM is a tool that provides information about code running on a Java Virtual Machine. The jvisualvm tool was provided with JDK 6, JDK 7, and JDK 8.

Java VisualVM is no longer bundled with the JDK, but you can get it from the VisualVM open source project site.



Following is one example of  Jar file that needs an upgrade if you are using incompatible versions with JDK11.

Upgrade xercesImpl.jar

If your application using xercesImpl.jar with version lower than 2.9 then you will get error xml marshalling framework and may not work in JDK 11. Update this jar file to 2.9 version.


Below are the known errors with incompatible xercesImpl jar with JDK 11.

 com.sun.xml.bind.v2.util.XmlFactory.createParserFactory null
org.xml.sax.SAXNotRecognizedException: http://javax.xml.XMLConstants/feature/secure-processing
        at org.apache.xerces.parsers.AbstractSAXParser.setFeature(Unknown Source)
        at org.apache.xerces.jaxp.SAXParserImpl.setFeatures(Unknown Source)
        at org.apache.xerces.jaxp.SAXParserImpl.<init>(Unknown Source)
        at org.apache.xerces.jaxp.SAXParserFactoryImpl.newSAXParserImpl(Unknown Source)
        at org.apache.xerces.jaxp.SAXParserFactoryImpl.setFeature(Unknown Source)
        at com.sun.xml.bind.v2.util.XmlFactory.createParserFactory(XmlFactory.java:106)
        at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.getXMLReader(UnmarshallerImpl.java:124)
        at javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmarshallerImpl.java:140)
        at javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmarshallerImpl.java:179)
java.lang.IllegalStateException: org.xml.sax.SAXNotRecognizedException: http://javax.xml.XMLConstants/feature/secure-processing

JDK Upgrade tool : Jdeps

jdeps is a inbuilt  Java Dependency analysis tool provided as part of JDK package. 
Jdeps tool takes the input as jar file or java source files and provides compatibility with your current JDK. 
If any of classes are not supported by current JDK then jdeps will highlight them as "Removed from JDK"

Following are jdeps commands to get jar dependencies with your JDK.
jdeps -jdkinternals --recursive  C:\tomcat-7.0.55\webapps\myapp\WEB-INF\lib\* 

jdeps  -jdkinternals --recursive  dom4j.jar

JDK removed internal API, jdeps tool
Sample output of jdeps tool for dom4j_1.6.1.jar with JDK11


jdeps  -jdkinternals --recursive  ojdbc8.jar

ojdbc jar dependency with jdk11
jdeps showing ojdbc8.jar using JDK internal API


Suggestions

Run your application directly on JDK 11 before recompiling with JDK 11, In this way you will find the issues in libraries.
If you are able  to make your app running on JDK 11, here are some suggestions that can help you get the most from the Java SE Platform:

  • If needed, cross-compile to an older release of the platform using the new -–release flag in the javac tool.
  • Take advantage of your IDE’s suggestions for updating your code with the latest features.
  • Find out if your code is using deprecated APIs by running the static analysis tool jdeprscan. As already mentioned in this guide, APIs can be removed from the JDK, but only with advance notice.
  • Get familiar with new features like multi-release JAR files .

Post a Comment

Previous Post Next Post