简体   繁体   English

Glassfish 服务器未启动。 空点异常

[英]Glassfish server does not start. NullPointeException

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.我试图在文件asenv.bat中设置路径 -> set path = C:/.../Java/bin - 没有帮助。 Tried so to launch: asadmin start-domain domain1 - did not help.尝试启动: asadmin start-domain domain1 - 没有帮助。

Installed: jdk-9.0.1 Also tried on the 8th, did not help.安装: jdk-9.0.1 8号也试过了,没用。 What to do???该怎么办???

OK, Glassfish 5.1 doesn't exist for the moment.好的,Glassfish 5.1 暂时不存在。 Continue with Glassfish 5.0 with this solution:使用此解决方案继续使用 Glassfish 5.0:

Just set the AS_JAVA variable in your asenv.bat file located here: C:\\DEVENV\\glassfish5\\glassfish\\config .只需asenv.bat位于以下位置的asenv.bat文件中设置AS_JAVA变量: C:\\DEVENV\\glassfish5\\glassfish\\config

File to edit: add last line要编辑的文件:添加最后一行代码截图

Relaunch your server....enjoy :重新启动您的服务器....享受: 用于启动服务器的重新启动命令的屏幕截图

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, however GlassFish 6 works on JDK 11. GlassFish 5 不适用于 JDK9,但 GlassFish 6 可用于 JDK 11。

For me it didn't work what @Vifier Lockla did.对我来说,@Vifier Lockla 所做的没有用。 I had to change the path/glassfish5/glassfish/config/asenv.conf file in a linux mint machine.我不得不在 linux mint 机器中更改 path/glassfish5/glassfish/config/asenv.conf 文件。 At the bottom of the file the path of the jdk 1.8, ie文件底部jdk 1.8的路径,即

AS_JAVA="/usr/lib/jvm/jdk1.8.0_191"

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。

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它有效

When you download the glassfish zip file from the internet and extract it.当您从 Internet 下载 glassfish zip 文件并解压缩时。 Its a good practice to read the the readme file.阅读自述文件是一个好习惯。 In my case the under the "prerequisites" title in the readme file, it specified: GlassFish 5.0 requires Oracle JDK 8 Update 144. I downloaded and installed the JDK 8 update 144 as demanded.就我而言,在自述文件的“先决条件”标题下,它指定:GlassFish 5.0 需要 Oracle JDK 8 更新 144。我按要求下载并安装了 JDK 8 更新 144。 It worked instantly.它立即起作用。 I initially had JDK 14.0.2 and it was displaying the error @Aleksandr posted.我最初使用的是 JDK 14.0.2,它显示了@Aleksandr 发布的错误。

I made the same mistake as the OP, because the release notes said specifically "GlassFish Server Open Source Edition Release 5.0 requires Oracle JDK 8 Update 144 or later" under heading Required JDK Versions in release notes.我犯了与 OP 相同的错误,因为发行说明在发行说明中的​​“必需的 JDK 版本”标题下特别指出“GlassFish Server 开源版 5.0 版需要 Oracle JDK 8 更新 144 或更高版本”。

However what you can do is drop down each version to see which is the latest jdk version that glassfish 5 will be compatible with Or Just download Java SE Development Kit 8 from https://www.oracle.com/in/java/technologies/javase/javase8-archive-downloads.html .但是,您可以做的是下拉每个版本以查看 glassfish 5 将兼容的最新 jdk 版本 或者只需从https://www.oracle.com/in/java/technologies/下载 Java SE Development Kit 8 javase/javase8-archive-downloads.html

You also have to add the java variable in asenv.bat as kindly commented by Vifier Lockla.您还必须按照 Vifier Lockla 的友好评论在 asenv.bat 中添加 java 变量。 Thanks to Vifier for the suggestion.感谢 Vifier 的建议。

for me I changed to the directory where glassfish is对我来说,我更改为 glassfish 所在的目录

cd /opt CD /选择

then然后

sudo glassfish5/bin/asadmin start-domain sudo glassfish5/bin/asadmin 启动域

I am sure this works我确定这有效

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM