Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Nullpointer when I startup GlassFish server

Tags:

glassfish

I use Glassfish application server and according to the README file, it just said open CMD, type some commands, but I got Nullpointer. I need someone to help me. I am on Windows.

asadmin start-domain

The error is:

Exception in thread "main" java.lang.NullPointerException
        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)
like image 431
wyh Avatar asked May 28 '26 07:05

wyh


1 Answers

As you mentioned in your comment the problem is Java 9.

Glassfish currently only works with Java 7 or Java 8.

Related Glassfish issues on Github:

  • asadmin start-domain fails with NullPointerException when JAVA_HOME set to JDK 9 or JDK 10 build
  • Umbrella Issue for Glassfish testing with JDK 9
  • [GF-JDK9] Exception when starting GF with JDK9

The last issue contains a workaround:

In order to work around this issue please edit the glassfish/bin/asadmin file and change the line # to following
Old
exec "$JAVA" -jar "$AS_INSTALL_LIB/client/appserver-cli.jar" "$@"
Changed
exec "$JAVA" --add-modules java.annotations.common -jar "$AS_INSTALL_LIB/client/appserver-cli.jar" "$@"

See also:

  • GlassFish 5.0 exception and port 4848 not responding
like image 121
unwichtich Avatar answered Jun 01 '26 20:06

unwichtich