1

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!

Erik Pragt
  • 13,513
  • 11
  • 58
  • 64
  • Can you confirm that you are adding `java.security.jgss` module at runtime as well ? As far as I can tell, you have added compiler args which makes this module available for compilation only. You still need to add the same options while running tomcat as well. – Kedar Joshi Feb 28 '19 at 06:51
  • Thanks Kedar. I tried looking for that, but not sure how to do that. Does this mean I have to add it to my module-info.java? – Erik Pragt Feb 28 '19 at 06:56

1 Answers1

2

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"]
}
Erik Pragt
  • 13,513
  • 11
  • 58
  • 64