Search code examples
sslhttpsglassfishvirtual-machinevirtualbox

Why can't access to glassfish admin console remotely?


I have a virtual machine with Centos7 in virtual box. I have installed there glassfish 5.0 from here: Full platform - glassfish 5.0. I simply unzipped the folder in /opt. I'm using "host-only".

The following is my java version:

java version "1.8.0_171"
Java(TM) SE Runtime Environment (build 1.8.0_171-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.171-b11, mixed mode)

I have enabled secure admin with the following command:

asadmin --host localhost --port 4848 enable-secure-admin

I go in vm shell and digit "ifconfig" to know the ip. Then, I go in power shell (win + x) of my windows host and type, to connect via ssh:

ssh [email protected]

Then:

cd /opt/glassfish5/bin
./asadmin start-domain domain1

Then I come back to my host, I open google chrome and:

  1. http://x.x.x.x:8080 seems fine
  2. http://x.x.x.x:4848 forces to https and then the browser tells me it's impossible to reach the website

I have tried to uninstall secure-admin (at least before glassfish gave me the exception which said that secure-admin was needed for DAS or anything like that):

./asadmin --host localhost --port 4848 disable-secure-admin

but I get the following exception:

NCLS-ADMIN-00010
javax.net.ssl.SSLHandshakeException: Remote host closed connection during handshake
Command disable-secure-admin failed.

I get the following exception in my log after calling admin console:

[2018-05-16T16:35:59.644+0200] [glassfish 5.0] [WARNING] [] [org.glassfish.grizzly.filterchain.DefaultFilterChain] [tid: _ThreadID=42 _ThreadName=admin-listener(3)] [timeMillis: 1526481359644] [levelValue: 900] [[
  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.portunif.PUFilter.handleRead(PUFilter.java:231)
        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)
]]

Solution

  • The answer is your version of Java is too new for GlassFish. I already answered this here: https://stackoverflow.com/a/49998266/212224

    To stop the java.lang.NoClassDefFoundError you need to use a version of Java no higher than 8u151

    This is due to a change in internal JDK classes which Grizzly uses for HTTP/2.

    GlassFish 5.0 does not have the latest version of Grizzly which is compatible with the latest Java 8 updates. If you are using GlassFish 5.0 and see these errors, you have 2 choices:

    1. Downgrade Java to 8u152 or earlier
    2. Download the latest GlassFish 5.0.1 nightly, where this should be fixed

    Ref: https://github.com/javaee/glassfish/issues/22436#issuecomment-374829430