Java upgrade from 8 to 11

I would like to upgrade java from 1.8.0_292 to 11.0.11.

I installed java on the machine:

# java --version
openjdk 11.0.11 2021-04-20
OpenJDK Runtime Environment (build 11.0.11+9-Ubuntu-0ubuntu2.20.04)
OpenJDK 64-Bit Server VM (build 11.0.11+9-Ubuntu-0ubuntu2.20.04, mixed mode, sharing)

But when I chance the /opt/lucee/jdk/jre symlink from /usr/lib/jvm/java-1.8.0-openjdk-amd64/ to
/usr/lib/jvm/java-1.11.0-openjdk-amd64, lucee doesn’t start anymore.

Output of the catalina.out:

-Djava.endorsed.dirs=/opt/lucee/tomcat/endorsed is not supported. Endorsed standards and standalone APIs
in modular form will be supported via the concept of upgradeable modules.
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.

I grep’d for the java.endorsed.dirs and there are hits within some files.

What is the best way to upgrade java? Reinstall lucee? I have a fresh local lucee with java 11, should i copy all tomcat/bin/ files to my other machine?

Don’t forget to tell us about your stack!

OS: Ubuntu 20 LTS
Java Version: 1.8.0_292
Tomcat Version: 9.0.31
Lucee Version: 5.3.8.206

Hi @Michael_Diederich, when I need to update Java, I personally don’t like doing it with Symlink, just because of that. Lucee uses it’s own dedicated JDK that is stored at /opt/lucee/jre/. This is how I (personally) like to do it:

  1. Step: BACKUP EVERYTHING!!!
  2. Step: Download a JDK for your OS (e.g. from adoptopenjdk.net) and unzip it to /opt/lucee/jre_new/ )
  3. Step: Stop Lucee with $ sudo /opt/lucee/lucee_ctl stop
  4. Step: Rename the actual live JDK location from /opt/lucee/jre/ to /opt/lucee/jre_bak/
  5. Step: Rename the new JDK location from /opt/lucee/jre_new/ to /opt/lucee/jre/
  6. Step: Make sure the user running Lucee has the read permissions for those files.
  7. Step: Start Lucee with $ sudo /opt/lucee/lucee_ctl start
  8. Step: Check for errors

To upgrade Java you usually don’t need to do anything with Tomcat/bin or Tomcat, unless you are using a Tomcat that isn’t supported on the new JDK. If you want to upgrade Tomcat, consider reading this thread: https://lucee.daemonite.io/t/upgrade-tomcat-9-server-wont-start-resolved/9012/2?u=andreas and also @Knut recommendations on the following posts of that thread.

Thanks, but this doesn’t solve this issue as the option java.endorsed.dirs is not supported for java >8
It will work for upgrade 9 to 10 and to 11, but not for upgrade 8 above.

Michael, what’s the “this” in Andreas’ answer that you feel won’t solve the problem? If you’re referring to his last sentence I think it would. You’d be updating tomcat–which I suspect is likely where you found the “hits” on that arg.

As that other thread discusses, it’s NOT enough just to “copy all tomcat/bin files”. By following the other needed steps AND updating the jvm, you should be able to solve this problem, it seems.

Or if the args were in Lucee files, you could deploy a new Lucee war, as discussed there.

Or note that rather than “update” everything, you could also just install a new tomcat and/or Lucee, running the new alongside the old, migrating over admin/config, etc.

And I say “tomcat and/or Lucee” because whether you’d install either or both depends on how you choose to implement Lucee, whether using Lucee express (which implements an embedded Tomcat) or installing Tomcat and then deploying Lucee as a war. You haven’t said.

1 Like