3

I have installed glassfish 5 in ubuntu and put it under the directory /opt, but when I typed asadmin start-domain I face this error:

Exception in thread "main" java.lang.NullPointerException: Cannot invoke "org.glassfish.hk2.api.DynamicConfigurationService.createDynamicConfiguration()" because "dcs" is null
at com.sun.enterprise.module.common_impl.AbstractModulesRegistryImpl.initializeServiceLocator(AbstractModulesRegistryImpl.java:152)     
at com.sun.enterprise.module.common_impl.AbstractModulesRegistryImpl.newServiceLocator(AbstractModulesRegistryImpl.java:144)    
at com.sun.enterprise.module.common_impl.AbstractModulesRegistryImpl.createServiceLocator(AbstractModulesRegistryImpl.java:218)     
at com.sun.enterprise.module.common_impl.AbstractModulesRegistryImpl.createServiceLocator(AbstractModulesRegistryImpl.java:224)     
at com.sun.enterprise.module.single.StaticModulesRegistry.createServiceLocator(StaticModulesRegistry.java:88)   
at com.sun.enterprise.admin.cli.CLIContainer.getServiceLocator(CLIContainer.java:217)   
at com.sun.enterprise.admin.cli.CLIContainer.getLocalCommand(CLIContainer.java:255)     
at com.sun.enterprise.admin.cli.CLICommand.getCommand(CLICommand.java:231)  
at com.sun.enterprise.admin.cli.AdminMain.executeCommand(AdminMain.java:371)    
at com.sun.enterprise.admin.cli.AdminMain.doMain(AdminMain.java:306)    
at org.glassfish.admin.cli.AsadminMain.main(AsadminMain.java:57)

How can I solve this problem?

5
  • 1
    Which JDK are you using? GF 5 only supports up to JDK 8 if I am not mistaken. Commented Feb 1, 2021 at 22:44
  • Does this answer your question? Glassfish server does not start. NullPointeException Commented Feb 2, 2021 at 10:02
  • @ChristophJohn java -version -> java version "15.0.2" 2021-01-19 Java(TM) SE Runtime Environment (build 15.0.2+7-27) Java HotSpot(TM) 64-Bit Server VM (build 15.0.2+7-27, mixed mode, sharing \n javac -version : javac 15.0.2 does these infos clarify the problem ? Commented Feb 2, 2021 at 16:18
  • Yes. See my comment and the comment from Jonathan. Commented Feb 2, 2021 at 16:43
  • @JonathanCoustick i did and i edit asevent.bat/conf but i didn't work the same problem occurs Commented Feb 2, 2021 at 16:55

4 Answers 4

6

Glassfish version 5 shows that behaviour when run with openjdk15 (at least in my machine) I have configured (see below) it to run with JDK-8 and it starts correctly.

set JAVA_HOME="Your_path_to_jdk8"
set PATH="%JAVA_HOME%/bin;%PATH%"

in windows, or

export JAVA_HOME="Your_path_to_jdk8"
export PATH="${JAVA_HOME}/bin:${PATH}"

in unix/linux. Add this to the script you use to start it, so the environment directs Glassfish to the proper place to find java binaries.

Sign up to request clarification or add additional context in comments.

Comments

3

You have to put

set AS_JAVA=C:\Program Files\Java\jdk1.5.0_16

on this directory of you glassfish server:

C:\Users\Usuario\Documents\glassfish-5.0.1\glassfish5\glassfish\config\asenv

Comments

2

I had the same problem with glassfish 6. Make sure you have JDK installed.

Also the glassfish documentation says you have to set JAVA_HOME environment variable an then the PATH variable to point to JAVA_HOME/bin.

On Linux I edited my ~/.bash_profile:

export JAVA_HOME=/usr/lib64/jvm/java-8-openjdk
export PATH=$JAVA_HOME/bin:$PATH

Comments

0

Downgrading form JDK 17 to JDK 8 worked. JDK 11 also didn't work.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.