GlassFish 5.0 exception and port 4848 not respondi

2020-03-23 23:36发布

问题:

Yesterday i downloaded GlassFish 5.0 and JDK9. When I'm trying to run server with asadmin start-domain GlassFish send to me exception

When I try to use "asadmin start-domainAfter" I got respond: "Remote server does not listen request on [localhost 4848]. Is the serwer up?"

Any can help me with this? I looked for solution at google, I tried kill process using port 4848, change port 4848 in domain.xml on another one, nothing helps.

It's my firts time with glassfish I don't know what to do. Anyone can help me?

I'm working at windows 7, InteliJ Ultimate 2017.2.4, JRE 1.8 and JDK 9.

回答1:

GlassFish 5.0 not starting on JDK 9 is a known issue.

GlassFish 5.0 is certified only on JDK 8 (u144) as stated in the release notes: https://javaee.github.io/glassfish/doc/5.0/release-notes.pdf



回答2:

I use Windows 10 and I have installed JDK and JRE for version 9 and 8u141, 8u151, 8u144 (installed for test about this problem) For exception I had had the same problem : the command "asadmin start-version" throw an exception.

Just check the version from CMD console :

C:\Users\xxxxx>**java -version**
java version "9.0.1"
Java(TM) SE Runtime Environment (build 9.0.1+11)
Java HotSpot(TM) 64-Bit Server VM (build 9.0.1+11, mixed mode)

Problem JAVA_HOME and PATH environment viariables are JDK8u151 ???

To solve the problem, the documentation advice that :

Alternatively, you can specifically set the Java path with the AS_JAVA property in the in the as-install/config/asenv.conf file.

C:\DEVENV\glassfish5\glassfish\config>dir
 Le volume dans le lecteur C s’appelle OS
 Le numéro de série du volume est 10BF-2BBE

 Répertoire de C:\DEVENV\glassfish5\glassfish\config

08/09/2017  07:27    <DIR>          .
08/09/2017  07:27    <DIR>          ..
12/01/2018  17:44             3 516 asenv.bat
...

Consequently, I add the last line below :

set AS_IMQ_LIB=..\..\mq\lib
set AS_IMQ_BIN=..\..\mq\bin
set AS_CONFIG=..\config
set AS_INSTALL=..
set AS_DEF_DOMAINS_PATH=..\domains
set AS_DEF_NODES_PATH=..\nodes
set AS_DERBY_INSTALL=..\..\javadb
**set AS_JAVA=C:\Program Files\Java\jdk1.8.0_151**

Relaunch CMD console and start server with asadmin start-domain : it works properly....enjoy.



回答3:

As mentioned above GlassFish 5.0 leverages new features in Java SE 8, and is certified today on Java SE 8. Even though we have a lot of work in front of us with the transition to the Eclipse Foundation, our current intent is to certify Java SE 9 in an upcoming GlassFish 5 release.

JDK 9 should be supported in the next update, i.e. GlassFish 5.0.1 See end of https://blogs.oracle.com/theaquarium/java-ee-8-is-final-and-glassfish-50-is-released



回答4:

If you are on a mac or linux machine, add the following to config/asenv.conf in your glassfish installation directory.

set AS_JAVA="path to your jdk 8"

For example, in Mac OS it will be

AS_JAVA="/Library/Java/JavaVirtualMachines/jdk1.8.0_161.jdk/Contents/Home"


回答5:

Anyone having problems with NullPointerException, look out for your system PATH Variables. Be sure that they point to an acceptable JDK (As it was said before: GlassFish 5.0 is certified only to work on JDK 8u144). This NullPointerException is caused by using an incompartible JDK as mentioned here: https://docs.oracle.com/cd/E19226-01/820-7688/gipqi/index.html

In my case the PATH variable was correctly pointing to java8u144 bin, but my PATH also contained a pointer to C:\ProgramData\Oracle\Java\javapath. And someway an old version of java SDK was stored on \ProgramData\Oracle so GlassFish was using this old version of java as SDK.