“加载应用程序时出现异常”没有堆栈跟踪
我正在将我的应用程序从 GlassFish 3.0.1 迁移到 GlassFish 3.1.1。部署失败,并显示以下错误消息:
SEVERE: Exception while loading the app
SEVERE: Exception while shutting down application container
SEVERE: Exception while shutting down application container : java.lang.NullPointerException
SEVERE: java.lang.RuntimeException: Error occurred during deployment: Exception while shutting down application container : java.lang.NullPointerException. Please see server.log for more details.
没有堆栈跟踪。我将根日志记录级别打开为“FINEST”,并且第一个 SEVERE 消息出现在 Weld 消息之后:
//...
FINE: WELD-000105 Enabled interceptor types for Manager
Enabled alternatives: [] []
Registered contexts: [interface javax.enterprise.context.SessionScoped, interface javax.enterprise.context.RequestScoped, interface javax.inject.Singleton, interface javax.enterprise.context.Dependent, interface javax.enterprise.context.ApplicationScoped, interface javax.enterprise.context.ConversationScoped]
Registered beans: 0
Specialized beans: 0
: []
在类似这样的几条消息之前(对于几个不同的类):
FINE: PWC4451: File cannot be read /opt/sun/glassfish-3.1.1/glassfish/domains/domain1/applications/QmsWeb/WEB-INF/classes/org/jboss/seam/transaction/SeamTransaction.class
FINE: PWC4451: File cannot be read /opt/sun/glassfish-3.1.1/glassfish/domains/domain1/applications/QmsWeb/WEB-INF/classes/org/jboss/seam/transaction/SeamTransaction.class
FINE: PWC4451: File cannot be read /opt/sun/glassfish-3.1.1/glassfish/domains/domain1/applications/QmsWeb/WEB-INF/classes/net/sf/ehcache/config/TerracottaConfiguration$ValueMode.class
//...
可能导致此错误的原因是什么?这些 PWC4451 消息是否表明某些库未加载?
I'm migrating my app from GlassFish 3.0.1 to GlassFish 3.1.1. Deployment fails, with the following error messages:
SEVERE: Exception while loading the app
SEVERE: Exception while shutting down application container
SEVERE: Exception while shutting down application container : java.lang.NullPointerException
SEVERE: java.lang.RuntimeException: Error occurred during deployment: Exception while shutting down application container : java.lang.NullPointerException. Please see server.log for more details.
There is no stack trace. I turned on the root logging level to FINEST, and the first SEVERE message occurs after a Weld message:
//...
FINE: WELD-000105 Enabled interceptor types for Manager
Enabled alternatives: [] []
Registered contexts: [interface javax.enterprise.context.SessionScoped, interface javax.enterprise.context.RequestScoped, interface javax.inject.Singleton, interface javax.enterprise.context.Dependent, interface javax.enterprise.context.ApplicationScoped, interface javax.enterprise.context.ConversationScoped]
Registered beans: 0
Specialized beans: 0
: []
And before several messages like these (for several different classes):
FINE: PWC4451: File cannot be read /opt/sun/glassfish-3.1.1/glassfish/domains/domain1/applications/QmsWeb/WEB-INF/classes/org/jboss/seam/transaction/SeamTransaction.class
FINE: PWC4451: File cannot be read /opt/sun/glassfish-3.1.1/glassfish/domains/domain1/applications/QmsWeb/WEB-INF/classes/org/jboss/seam/transaction/SeamTransaction.class
FINE: PWC4451: File cannot be read /opt/sun/glassfish-3.1.1/glassfish/domains/domain1/applications/QmsWeb/WEB-INF/classes/net/sf/ehcache/config/TerracottaConfiguration$ValueMode.class
//...
What could be causing this error? Could these PWC4451 messages be indicating that some libraries aren't being loaded?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
这是由于 @ViewScoped bean 未实现 Serialized。显然,我们使用的旧版本 Weld 并没有发现钝化范围 bean 不可序列化这一点令人反感,但这个版本却因此默默地失败了。哦,好吧,希望这可以节省一些时间。
This was due to a @ViewScoped bean that did not implement Serializable. Apparently, an older version of Weld that we were using didn't find it objectionable that a passivating-scoped bean wasn't Serializable, but this one failed silently because of it. Oh well, hope this saves someone some time.
经过三个小时的调试后,我尝试在 JBoss 6 中部署应用程序,解决了类似的问题。
似乎来自 Weld 的几条错误消息没有在 Glassfish 下正确记录。就我而言,我使用 @Stateless @RequestScoped 注释了 EJB(这是非法的,必须是 @Statefull)。
使用 Glassfish,我只能看到“加载应用程序时出错”,而在 JBoss 6 中,我得到了正确的错误消息,指示有问题的代码。
我建议您尝试在 JBoss 6 上进行部署,删除所有阻止 Weld 部署程序扫描应用程序并验证 CDI 内容的部分(例如,具有特定 JNDI 路径的@Resource)。
After three hours of debugging I fixed a problem like this trying to deploy the application in JBoss 6.
It seems like several error messages from Weld don't get logged properly under Glassfish. In my case I annotated an EJB with @Stateless @RequestScoped (that is illegal, must be @Statefull).
With Glassfish I could only see that "error while loading the app", while in JBoss 6 I get the correct error message indicating the offending code.
I suggest that you try deploying on JBoss 6 stripping out all the parts (@Resource with specific JNDI path, for instance) that prevent the Weld deployer to scan the application and validate the CDI stuff.
就我而言,问题是我的 beans.xml 由空的“beans”元素组成,该元素曾经有效,但显然不再有效。当我用完全空的 0 字节 beans.xml 替换它时,它起作用了。
In my case, the problem was that my beans.xml consisted of the empty "beans" element, which used to work but apparently doesn't anymore. It worked when I replaced it with a completely empty, 0-byte beans.xml.
在添加
Glassfish 3.1.2.2
中不可序列化的拦截器时,我遇到了同样的问题。刚刚得到一个NullPointerException
,没有任何进一步的解释。当我让拦截器实现
Serialized
时,它工作得很好。I had the same problem when adding an interceptor that wasn't serializable in
Glassfish 3.1.2.2
. Just got aNullPointerException
without any further explanation.It works fine when I made the interceptor implement
Serializable
.我遇到的这个问题的原因和解决方案:
- 目标未更新(确保进行 Maven 清理,目标文件夹可能被锁定,尝试手动删除它并重建你的耳朵(有过几次这个问题)
- JDBC 池问题:刷新它们
- EJB 的构造函数问题(注意是创建 bean 的容器):容器需要能够启动它们。 必须存在不带参数的默认构造函数
因此,如果不起作用,则 :
团队->比较->最新的工作版本,并将 Web 服务的每个 EJB bean 或 DTO 视为可能的错误原因。评论您的更改并重试部署以定位您的问题。
无论如何,这是一个令人讨厌的错误:(祝你好运!
Reason and solutions I have encountered regarding this problem:
- target not updated (make sure to do a maven clean, target folder might be locked, try to manually remove it and rebuild your ear (had this problem a few times)
- problem with JDBC pools: flush them
- constructor problem with EJB's (note it's the container who creates your beans): the container needs to be able to initiate them. So a default constructor with no arguments has to be present
if that doesn't work:
team->compare to -> latest working version and consider every EJB bean or DTO for webservices as a possible cause of error. Comment your changes and retry to deploy to locate your problem.
In any way it's a nasty error :( Good luck!
就我而言,本着拦截器的精神,我的拦截器很容易找到,因为我在那里玩。
我在拦截器上添加了无辜的@Interceptor,即使我将其与注释一起使用。
我的 glassfish 版本是 3.1.2.2。
此页面表示它是可选的 Inteceptor Javadoc。
In my case and in the spirit of Interceptors, mine was kind of easy to find because i was playing around there.
I adding the innocent @Interceptor on my interceptor even though i'm using it with annotations.
My version of glassfish is 3.1.2.2.
This page says that it is optional Inteceptor Javadoc.