How can one get a NoClassDefFound for a JDK class/jar?

34 Views Asked by At

In updating a version of a dependency, I began getting a java.lang.NoClassDefFoundError: javax/net/ssl/SSLSession. javax.net.ssl.SSLSession is a JDK class found in rt.jar. How can updating a dependency cause a JDK jar to not be found?

EDIT: the answer for me is that such a dep change can't cause this result. There was a base image change that was not known at the time of asking that was responsible.

I am leaving the question up as I think the replies and comments could be helpful to someone coming here for a similar issue. To such people I recommend: double check you classpath and double check your jdk directory.

1

There are 1 best solutions below

0
queeg On

Be aware you are not looking at a ClassNotFoundException.

The ApiDoc states about NoClassDefFoundError: Thrown if the Java Virtual Machine or a ClassLoader instance tries to load in the definition of a class (as part of a normal method call or as part of creating a new instance using the new expression) and no definition of the class could be found. The searched-for class definition existed when the currently executing class was compiled, but the definition can no longer be found.