9

I am trying to secure a web application so that I can use a secure data transport layer TLS/SSL with HTTPS. I am using glassfish server 5. After starting the server I did a https://localhost:8181 and it gave me this exception:

    Warning:   GRIZZLY0013: Exception during FilterChain execution
java.lang.NoClassDefFoundError: sun/security/ssl/SupportedEllipticCurvesExtension
    at sun.security.ssl.HelloExtensions.<init>(HelloExtensions.java:82)
    at sun.security.ssl.HandshakeMessage$ClientHello.<init>(HandshakeMessage.java:362)
    at sun.security.ssl.ServerHandshaker.processMessage(ServerHandshaker.java:223)
    at sun.security.ssl.Handshaker.processLoop(Handshaker.java:984)
    at sun.security.ssl.Handshaker$1.run(Handshaker.java:924)
    at sun.security.ssl.Handshaker$1.run(Handshaker.java:921)
    at java.security.AccessController.doPrivileged(Native Method)
    at sun.security.ssl.Handshaker$DelegatedTask.run(Handshaker.java:1379)
    at org.glassfish.grizzly.ssl.SSLUtils.executeDelegatedTask(SSLUtils.java:274)
    at org.glassfish.grizzly.ssl.SSLBaseFilter.doHandshakeStep(SSLBaseFilter.java:708)
    at org.glassfish.grizzly.ssl.SSLBaseFilter.doHandshakeStep(SSLBaseFilter.java:622)
    at org.glassfish.grizzly.ssl.SSLBaseFilter.handleRead(SSLBaseFilter.java:334)
    at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
    at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:284)
    at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:201)
    at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:133)
    at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:112)
    at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)
    at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:539)
    at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:112)
    at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:117)
    at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:56)
    at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:137)
    at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:593)
    at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:573)
    at java.lang.Thread.run(Thread.java:748)

The browser(firefox) shows this: error

What could be the problem?

6 Answers6

13

This is looks to be the same issue as this bug, which is caused by a change in Java 8 162, where that class was renamed. Which was a fix for this bug in OpenJDK which was changed here, but unfortunately that was a breaking change that introduced this issue as they renaming the class.

An alternative is to use Payara 5.182, a fork of glassfish which includes a fix for it.

Jonathan Coustick
  • 1,127
  • 9
  • 19
  • This appears to be fixed in Glassfish 5.0.1 (which is still in development, so you have to download a nightly build for now). – Doug McClean Jun 28 '18 at 21:07
8

I looked into the bug mentioned by @Jonathan Coustick in his answer. The root of the problem is that Glassfish (or Payara) uses an old version of grizzly. So, I thought maybe replacing grizzly-npn-bootstrap.jar with a newer version would solve the problem.

This JAR file is located in <glassfish-root>/glassfish/modules/endorsed directory (for GlassFish server) <payara-root>/glassfish/lib directory (for Payara server). Versions prior to 1.7 are subject to this error . So, I got the latest version (currently, 1.9) from maven.org, and it worked like a charm.

Here's the download link.

Sadeq Dousti
  • 3,346
  • 6
  • 35
  • 53
  • I had to upgrade my JDK to 1.8.0_201 too. – Xavier Lambros Feb 18 '19 at 15:02
  • I tried to fix my glassfish this way but I still get the same error for NoClassDefFoundError: sun/security/ssl/HelloExtension although it is provided by this jar.. – team17 Aug 01 '20 at 16:53
  • 2
    It worked for me by removing the sun folder of the grizzly-npn-bootstrap.jar (glassfish 5.1 with jdk 8 261) – team17 Aug 02 '20 at 10:25
1

I got the same in intelliJ,I had dk1.8.0_111.jdk, I downloaded jdk1.8.0_301.jdk and changed the JDK path to point to jdk1.8.0_301.jdk Home in intelliJ. Since I am using a MAC the path was: /Library/Java/JavaVirtualMachines/jdk1.8.0_301.jdk/Contents/Home

It fixed my issue.

sidibe
  • 51
  • 5
0

Wow. That's a hell of a a bug. In my case, I used Java JDK 8.121 and tried to open a TLS URLConnection from my Glassfish 5.1 server. The result was this exception:

java.lang.NoClassDefFoundError: sun/security/ssl/HandshakeStateManager

The solution was to update the JDK to version 8.201.

Vova
  • 160
  • 2
  • 12
0

I found same error in payara server. remove "grizzly-npn-bootstrap.jar" file from payara server.

In payara server location for "grizzly-npn-bootstrap.jar" file is "[root-payara]/glassfish/lib".

Default [root-payara] folder in windows "c:/users/[user-name]/Payara-server"

Jay Kukadiya
  • 553
  • 6
  • 9
-5

NoClassDefFoundError An error is typically generated when class information is not loaded into memory. It is necessary to check whether the location reference of the actual class file is invalid or whether the class file exists.

전원표
  • 170
  • 1
  • 11