我目前正在使用无状态会话Bean运行一个简单的EJB应用程序。我正在使用Personal Glassfish 3.0开发NetBeans 6.8,并且我已经在我的系统上安装了Java EE和Java SE。我不知道它是否相关,但我运行的是Windows7 64位版本。我实现的会话Bean只有一个方法sayHello();它只是在屏幕上打印你好。当我尝试运行应用程序时,我收到以下错误:
pre-init:
init-private:
init-userdir:
init-user:
init-project:
do-init:
post-init:
init-check:
init:
deps-jar:
deps-j2ee-archive:
MyEnterprise-app-client.init:
MyEnterprise-ejb.init:
MyEnterprise-ejb.deps-jar:
MyEnterprise-ejb.compile:
MyEnterprise-ejb.library-inclusion-in-manifest:
MyEnterprise-ejb.dist-ear:
MyEnterprise-app-client.deps-jar:
MyEnterprise-app-client.compile:
MyEnterprise-app-client.library-inclusion-in-manifest:
MyEnterprise-app-client.dist-ear:
MyEnterprise-ejb.init:
MyEnterprise-ejb.deps-jar:
MyEnterprise-ejb.compile:
MyEnterprise-ejb.library-inclusion-in-manifest:
MyEnterprise-ejb.dist-ear:
pre-pre-compile:
pre-compile:
do-compile:
post-compile:
compile:
pre-dist:
post-dist:
dist-directory-deploy:
pre-run-deploy:
Starting Personal GlassFish v3 Domain
Personal GlassFish v3 Domain is running.
Undeploying ...
Initializing...
Initial deploying MyEnterprise to C:\Users\Naqsam\Documents\NetBeansProjects\MyEnterprise\dist\gfdeploy\MyEnterprise
Completed initial distribution of MyEnterprise
post-run-deploy:
run-deploy:
run-display-browser:
run-ac:
pre-init:
init-private:
init-userdir:
init-user:
init-project:
do-init:
post-init:
init-check:
init:
deps-jar:
deps-j2ee-archive:
MyEnterprise-app-client.init:
MyEnterprise-ejb.init:
MyEnterprise-ejb.deps-jar:
MyEnterprise-ejb.compile:
MyEnterprise-ejb.library-inclusion-in-manifest:
MyEnterprise-ejb.dist-ear:
MyEnterprise-app-client.deps-jar:
MyEnterprise-app-client.compile:
MyEnterprise-app-client.library-inclusion-in-manifest:
MyEnterprise-app-client.dist-ear:
MyEnterprise-ejb.init:
MyEnterprise-ejb.deps-jar:
MyEnterprise-ejb.compile:
MyEnterprise-ejb.library-inclusion-in-manifest:
MyEnterprise-ejb.dist-ear:
pre-pre-compile:
pre-compile:
do-compile:
post-compile:
compile:
pre-dist:
post-dist:
dist-directory-deploy:
pre-run-deploy:
Undeploying ...
Initial deploying MyEnterprise to C:\Users\Naqsam\Documents\NetBeansProjects\MyEnterprise\dist\gfdeploy\MyEnterprise
Completed initial distribution of MyEnterprise
post-run-deploy:
run-deploy:
Warning: Could not find file C:\Users\Naqsam\.netbeans\6.8\GlassFish_v3\generated\xml\MyEnterprise\MyEnterpriseClient.jar to copy.
Copying 1 file to C:\Users\Naqsam\Documents\NetBeansProjects\MyEnterprise\dist
Copying 4 files to C:\Users\Naqsam\Documents\NetBeansProjects\MyEnterprise\dist\MyEnterpriseClient
Copying 1 file to C:\Users\Naqsam\Documents\NetBeansProjects\MyEnterprise\dist\MyEnterpriseClient
java.lang.NullPointerException
at org.glassfish.appclient.client.acc.ACCLogger$1.run(ACCLogger.java:149)
at java.security.AccessController.doPrivileged(Native Method)
at org.glassfish.appclient.client.acc.ACCLogger.reviseLogger(ACCLogger.java:146)
at org.glassfish.appclient.client.acc.ACCLogger.init(ACCLogger.java:93)
at org.glassfish.appclient.client.acc.ACCLogger.<init>(ACCLogger.java:80)
at org.glassfish.appclient.client.AppClientFacade.createBuilder(AppClientFacade.java:360)
at org.glassfish.appclient.client.AppClientFacade.prepareACC(AppClientFacade.java:247)
at org.glassfish.appclient.client.acc.agent.AppClientContainerAgent.premain(AppClientContainerAgent.java:75)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at sun.instrument.InstrumentationImpl.loadClassAndStartAgent(InstrumentationImpl.java:323)
at sun.instrument.InstrumentationImpl.loadClassAndCallPremain(InstrumentationImpl.java:338)
Java Result: 1
run-MyEnterprise-app-client:
run:
BUILD SUCCESSFUL (total time: 1 minute 59 seconds)
服务器还会显示以下错误消息:
您认为这是什么问题?这仍然是我的第一个EJB应用程序,所以我是这个API的新手。
答案 0 :(得分:1)
删除所有EJB并重新启动Glassfish服务器。看看你是否收到任何错误。如果在没有EJB的情况下出现错误,那么Glassfish安装会出现问题。
如果Glassfish在没有EJB的情况下正常启动,那么请发布您的EJB代码。 EJB代码可能存在一些问题。
答案 1 :(得分:0)
用户Pascal Thivent非常友好地删除了包含此问题答案的帖子,原因有些奇怪和奇怪。所以我将不得不重新发布解决方案。
基本上解决方案是:
1:Glassfish发出了很多警告,因为它安装在一个路径名为“Program Files”空间的目录中。因此,要解决此问题,只需将其安装在C:/
中即可2:关于正在抛出的NullPointerException(请参阅第一篇文章并向下滚动一下),似乎有一个问题,请参阅此链接https://glassfish.dev.java.net/issues/show_bug.cgi?id=11494与glassfish和java6u18。因此,要解决此问题,请等待java在将来的更新中修复此错误,否则降级到java6u17或更低版本。
希望这可能会有所帮助。