Java lang nullpointerexception glassfish

Ошибка Glassfish5: исключение в потоке «main» java.lang.NullPointerException

Я установил glassfish 5 в ubuntu и поместил его в каталог /opt , но когда я набрал asadmin start-domain , я столкнулся с этой ошибкой:

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) 

Как я могу решить эту проблему?

Источник

Saved searches

Use saved searches to filter your results more quickly

You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

asadmin start-domain fails with NullPointerException when JAVA_HOME set to JDK 9 or JDK 10 build #22130

asadmin start-domain fails with NullPointerException when JAVA_HOME set to JDK 9 or JDK 10 build #22130

Comments

Environment Details

  • GlassFish Version (and build number): 5.0-b15 i
  • JDK version: jdk-9+180 or jdk-10+16
  • OS: OS X
  • Database: N/A
Читайте также:  Java arraylist with integers

Problem Description

asadmin start-domain fails with NullPointerException.

Steps to reproduce

$ export JAVA_HOME=.
$ asadmin start-domain
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)

Impact of Issue

Just checking to see if it runs on JDK 9.

The text was updated successfully, but these errors were encountered:

@Hoderich Commented
I’ve finnally solved the issue in my computer. Even rolling back to release 8.152, which was working before, the error persists. Then I’ve found in the environment variables C:\ProgramData\Oracle\Java\javapath, and in that directory the 3 programs were still using the release 9, I copied the equivalent from 8.52 and it worked

@couryrr Commented
Is there an expected fix for this? I just grabbed the nightly from May 12th and it still seems present.

@dmatej Commented
Fails even the build of Payara on Ubuntu where is the JDK10 set as default, despite it is overriden by JAVA_HOME in ~/.mavenrc — the cause is that the Payara uses AS_JAVA property instead and if it is not set it takes the default java program provided by the OS.

[INFO] --- glassfishbuild-maven-plugin:3.2.20.payara-p1:exec (create-domain) @ payara-minimal --- [INFO] executable: /home/dmatej/work/repo/git/Payara/nucleus/distributions/payara-minimal/target/stage/nucleus/bin/nadmin [INFO] commandLineArgs: --user admin create-domain --nopassword --savelogin=true --checkports=false --portbase=5000 --keytooloptions CN=localhost domain1 [INFO] [exec] Exception in thread "main" java.lang.NullPointerException [INFO] [exec] at com.sun.enterprise.module.common_impl.AbstractModulesRegistryImpl.initializeServiceLocator(AbstractModulesRegistryImpl.java:152) [INFO] [exec] at com.sun.enterprise.module.common_impl.AbstractModulesRegistryImpl.newServiceLocator(AbstractModulesRegistryImpl.java:144) [INFO] [exec] at com.sun.enterprise.module.common_impl.AbstractModulesRegistryImpl.createServiceLocator(AbstractModulesRegistryImpl.java:218) [INFO] [exec] at com.sun.enterprise.module.common_impl.AbstractModulesRegistryImpl.createServiceLocator(AbstractModulesRegistryImpl.java:224) [INFO] [exec] at com.sun.enterprise.module.single.StaticModulesRegistry.createServiceLocator(StaticModulesRegistry.java:88) [INFO] [exec] at com.sun.enterprise.admin.cli.CLIContainer.getServiceLocator(CLIContainer.java:212) [INFO] [exec] at com.sun.enterprise.admin.cli.CLIContainer.getLocalCommand(CLIContainer.java:244) [INFO] [exec] at com.sun.enterprise.admin.cli.CLICommand.getCommand(CLICommand.java:229) [INFO] [exec] at com.sun.enterprise.admin.cli.AdminMain.executeCommand(AdminMain.java:362) [INFO] [exec] at com.sun.enterprise.admin.cli.AdminMain.doMain(AdminMain.java:298) [INFO] [exec] at com.sun.enterprise.admin.cli.AdminMain.main(AdminMain.java:206) 

You can override the AS_JAVA environment property in the asenv.conf file (in old Glassfish versions it was always there but then it was impossible to override it for usage with Docker etc). It is not there now but it is still supported. So you can add the property to your asenv.conf or set the environment property like this:

export AS_JAVA=/usr/lib/jvm/jdk1.8.0 

It works even in the build 🙂

P.S.: Sorry, I did not notice that this is glassfish’s site and not payara’s, but the problem and solution is perhaps same.

Источник

Оцените статью