Recently I finished migrating my application from Java 8 to OpenJDK 11. Here are few steps where we got stuck and the solutions that helped us.
Problem No 1 – JVM argument UseFastAccessorMethods argument is not supported anymore in OpenJDK 11
Solution – Removed this JVM argument from batch scripts/shell scripts.
Further Reading – https://bugs.java.com/bugdatabase/view_bug.do?bug_id=6385687
Problem No 2 – com.myApp.configuration.Module class conflicts with java.lang.Module class introduced in OpenJDK 11. Basically I had a class called Module which was now conflicting with java.lang.Module class introduced in OpenJDK 11.
Solution – Explicitly import com.myApp.configuration.Module class in required classes.
Problem No 3 – Compile/Runtime issues with commons-lang:commons-lang:2.1@jar
Solution – Upgraded to commons-lang:commons-lang:2.6@jar
Problem No 4
Jersey Rest APIs were not working (Runtime issue) with following libraries
Migrated these libraries to below libraries. Post this upgrade Jersey APIs were working fine ‘org.glassfish.jersey:jersey-bom:2.27’
Problem No 5 – Library com.sun.xml.messaging.saaj missing in OpenJDK 11 which was part of Oracle Java 8. This is used in SOAP
Solution – Explicity import library ‘com.sun.xml.messaging.saaj:saaj-impl:1.3.20’
Further Reading – https://javaee.github.io/metro-saaj/
Problem No 6 – Library com.sun.org.apache.xml.internal:resolver missing in OpenJDK 11 which was part of Oracle Java 8.
Solution – Explicitly import library compile group: ‘com.sun.org.apache.xml.internal’, name: ‘resolver’, version: ‘20050927’
Problem No 7 – Gradle compilation fails since JAVA_HOME was pointing to older Oracle Java 8 JDK
Solution – Changed JAVA_HOME environment variable to point to new OpenJDK 11
Problem No 8 – Tomcat was not starting since JRE_HOME was pointing to older Oracle Java 8 JDK
Solution – There is no JRE in OpenJDK 11. So we have to remove JRE_HOME variable
I encountered few more problems, will list the solutions soon on this page for those as well. I have tested my application on Windows 10 and CentOS 6 and 7.
Recently I read a migration which was even more comprehensive and added some points I missed, please go through this if the above is not enough.
Update – March 2022
The latest version of Java is Java 18 or JDK 18 released on March, 22nd 2022 (follow this article to check Java version on your computer). JDK 18 is a regular update release, and JDK 17 is the latest Long Term Support (LTS) release of Java SE platform (about 8 years of support from Oracle).
We are sorry that this post was not useful for you!
Let us improve this post!
Tell us how we can improve this post?