0

I'm currently working on a webservice using Netbeans 11.3 on a local Glassfish-server version 5.1.0 JDK/JRE version 1.8.0_221

When trying to post by using the webservice i receive the following error msg:

java.lang.NoClassDefFoundError: sun/security/ssl/HandshakeStateManager
    at sun.security.ssl.Handshaker.init(Handshaker.java:282)
    at sun.security.ssl.Handshaker.<init>(Handshaker.java:242)
    at sun.security.ssl.ClientHandshaker.<init>(ClientHandshaker.java:160)
    at sun.security.ssl.SSLSocketImpl.initHandshaker(SSLSocketImpl.java:1339)
    at sun.security.ssl.SSLSocketImpl.doneConnect(SSLSocketImpl.java:700)
    at sun.security.ssl.SSLSocketImpl.connect(SSLSocketImpl.java:679)
    at sun.security.ssl.BaseSSLSocketImpl.connect(BaseSSLSocketImpl.java:173)
    at sun.net.NetworkClient.doConnect(NetworkClient.java:180)
    at sun.net.www.http.HttpClient.openServer(HttpClient.java:463)
    at sun.net.www.http.HttpClient.openServer(HttpClient.java:558)
    at sun.net.www.protocol.https.HttpsClient.<init>(HttpsClient.java:264)
    at sun.net.www.protocol.https.HttpsClient.New(HttpsClient.java:367)
    at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.getNewHttpClient(AbstractDelegateHttpsURLConnection.java:191)
    at sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1156)
    at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:1050)
    at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:177)
    at sun.net.www.protocol.http.HttpURLConnection.getOutputStream0(HttpURLConnection.java:1334)
    at sun.net.www.protocol.http.HttpURLConnection.getOutputStream(HttpURLConnection.java:1309)
    at sun.net.www.protocol.https.HttpsURLConnectionImpl.getOutputStream(HttpsURLConnectionImpl.java:259) 

I've tried changing both JDK and JRE using the PCs environment variables and in the IDE but i keep getting the same error msg.

I only found 1 more thread with a similar problem to mine: java.lang.NoClassDefFoundError: sun/security/ssl/HandshakeStateManager

Where changing JDK to 1.8.0_221 resolved the issue.

Can anyone tell me why this isn't working or do you need any further information?

Thanks

joleniuz
  • 21
  • 2

1 Answers1

1

I found a fix in this thread: JavaWeb java.lang.NoClassDefFoundError: sun/security/ssl/HelloExtension

"Had basically the same problem, eventually solved it with this solution here.

In your glassfish folder go to glassfish5/glassfish/modules/endorsed/ and open the grizzly-npn-bootstrap.jar file with winrar or your preferred unzipper.

Delete the sun folder and try running your program again."

I've been stuck with this for over a week and finally found this fix. Now using the post-function works!

joleniuz
  • 21
  • 2