java Glassfish 服务器未启动。空指针异常
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/47458119/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Glassfish server does not start. NullPointeException
提问by Aleksandr
I just downloaded the GlassFish 5.0 archive - Full Platform, unzipped it, I run it through the command line.
我刚刚下载了 GlassFish 5.0 存档 - 完整平台,解压缩它,我通过命令行运行它。
asadmin start-domain
asadmin 起始域
problem:
问题:
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)
I tried to set the path in the file asenv.bat-> set path = C:/.../Java/bin- did not help. Tried so to launch: asadmin start-domain domain1- did not help.
我试图在文件asenv.bat 中设置路径-> set path = C:/.../Java/bin- 没有帮助。尝试启动:asadmin start-domain domain1- 没有帮助。
Installed: jdk-9.0.1Also tried on the 8th, did not help. What to do???
已安装:jdk-9.0.18号也试过了,没用。该怎么办???
回答by Vifier Lockla
OK, Glassfish 5.1 doesn't exist for the moment. Continue with Glassfish 5.0 with this solution:
好的,Glassfish 5.1 暂时不存在。使用此解决方案继续使用 Glassfish 5.0:
Just set the AS_JAVA
variable in your asenv.bat
file located here: C:\DEVENV\glassfish5\glassfish\config
.
只需AS_JAVA
在asenv.bat
位于此处的文件中设置变量:C:\DEVENV\glassfish5\glassfish\config
.
File to edit: add last line
要编辑的文件:添加最后一行
Relaunch your server....enjoy :
重新启动您的服务器....享受:
回答by Jonathan Coustick
This looks to be this issue - https://github.com/eclipse-ee4j/glassfish/issues/22130.
这看起来是这个问题 - https://github.com/eclipse-ee4j/glassfish/issues/22130。
GlassFish 5 does not work on JDK9, it may be fixed for 5.1.
GlassFish 5 不适用于 JDK9,它可能会在 5.1 上修复。
回答by Symeon Mattes
For me it didn't work what @Vifier Lockla did. I had to change the path/glassfish5/glassfish/config/asenv.conf file in a linux mint machine. At the bottom of the file the path of the jdk 1.8, i.e.
对我来说,@Vifier Lockla 所做的没有用。我不得不在 linux mint 机器中更改 path/glassfish5/glassfish/config/asenv.conf 文件。文件底部jdk 1.8的路径,即
AS_JAVA="/usr/lib/jvm/jdk1.8.0_191"
回答by Peddi
GlassFish 5.1 also not working with Java 9 or later versions.
GlassFish 5.1 也不适用于 Java 9 或更高版本。
glassfish 5.1 also needs java 8 with the AS_JAVA hack in asenv.conf/bat file.
glassfish 5.1 还需要 java 8 和 asenv.conf/bat 文件中的 AS_JAVA hack。
回答by Mohd Zamri Bin Mat Jusoh
Edit asenv.bat put set AS_JAVA=/usr/lib/jvm/java-8-oracle and asenv.conf AS_JAVA="/usr/lib/jvm/java-8-oracle"
编辑 asenv.bat put set AS_JAVA=/usr/lib/jvm/java-8-oracle 和 asenv.conf AS_JAVA="/usr/lib/jvm/java-8-oracle"
It works
有用