Tomcat can't find classes on OpenJDK 11

1.4k Views Asked by At

After moving from OracleJDK 8 to OpenJDK 11, our Tomcat 8 doesn't start anymore with the following exception:

Caused by: java.lang.ClassNotFoundException: org.ietf.jgss.GSSContext
    at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:471)
    at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:588)
    at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
    ... 43 common frames omitted

Our Spring Boot (Kotlin+Java) project is built by Gradle 5.2.1, and what I've tried is adding the following configuration to our build.gradle:

   compileJava {
      inputs.property("moduleName", moduleName)
      doFirst {
        options.compilerArgs = [
          '--module-path', classpath.asPath,
          '--add-modules', 'java.security.jgss'
        ]
        classpath = files()
      }
    }

Unfortunately, this doesn't solve things. If someone has suggestions, that would be appreciated!

1

There are 1 best solutions below

0
On

Okay, I found out how to make it work:

I have to add --add-modules java.security.jgss to my VM options in IntelliJ, (and to to Gradle (see below), and then it works.

bootRun {
  jvmArgs = ["--add-modules", "java.security.jgss"]
}