'glassfish 5.1, debian 10, admin console not reachable, connection refused

I'm new to java ee and try to set up a glassfish 5.1 server on Debian 10. I got it to work with tomcat that I can reach the /manager path. I switched now to the glassfish server and could reach the admin console on http://localhost:4848 for development.

Now I'm trying to deploy a test app to the Debian server. I followed this tutorial: Tutorial

After the command:

/opt/glassfish5/bin/asadmin enable-secure-admin

The URL redirects from HTTP to https://domain:4848 and I get connection refused from the browser. With only HTTP, I could access the admin console.

This version of java I'm using

openjdk version "1.8.0_292" 
OpenJDK Runtime Environment (AdoptOpenJDK)(build 1.8.0_292-b10)
OpenJDK 64-Bit Server VM (AdoptOpenJDK)(build 25.292-b10, mixed mode)

I have Nginx installed to reverse proxy the port 8080 to 80 and use letsencrypt to get a valid SSL certificate for the subdomain I'm using.

I tried the script from this post Link to let the glassfish server use the SSL certificate from letsencrypt to maybe fix the connection refused error, but it didn't work.

When I try with wget to fetch the admin console internally, I get following error

--2022-02-05 14:26:44--  https://localhost:4848/
Resolving localhost (localhost)... 127.0.0.1 
Connecting to localhost (localhost)|127.0.0.1|:4848... connected.
GnuTLS: The TLS connection was non-properly terminated.
Unable to establish SSL connection.

Edit: I found a way to get the admin console to send valid ssl Reference. Now i need replace the old certificate with a letsencrypt certificate. I found a thread talking about using letsencrypt with glassfish but after the script run i cant start the server because I get prompted with a master password which isnt the default one. Script thread



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source