问题
I have a spring boot application deployed in Glassfish 5.0. When trying to access a REST service in this application with spring security basic auth, I'm getting the below error:
java.lang.NoSuchMethodError: sun.security.ssl.SessionId.checkLength(Lsun/security/ssl/ProtocolVersion;)V
The application works fine in Tomcat server. This error is occurring only in glassfish server.
My JAVA_HOME
is already set to jdk1.8.0_31
.
What could be the issue ?
Below is the error when I'm trying to access the service using postman:
回答1:
which means underlying jar lib in glass fish doesn't contain the class'smethod as springboot expected
回答2:
The jar file that contains the method sun.security.ssl.SessionId.checkLength
may not be deployed in glass fish server. The package is expecting into the glass fish server. So find the package in which the sun.security.ssl.SessionId
class is declared and and deploy the jar file of the package in the glass fish server. the package contains in your library list but the library is not deployed in glass fish server.
sun.security.ssl.SessionId class is a part of jdk8. So make sure your glassfish server using jdk8. it may not work in jdk7.
来源:https://stackoverflow.com/questions/45731810/glassfish-spring-boot-error