"Exception while loading the app" without a stack trace
Asked Answered
C

6

8

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?

Congenital answered 25/8, 2011 at 18:16 Comment(2)
This looks like it's going nowhere. If any development tools programmer sees this, remember: good error messages are a feature!Congenital
This is actually flagged as a Glassfish issue and should be fixed in Glassfish 4.0, accordong to the issue. See java.net/jira/browse/GLASSFISH-18599, unfortunately this helps neither you or me now.Dorsman
C
6

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.

Congenital answered 31/8, 2011 at 22:56 Comment(0)
S
4

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.

Sewel answered 31/8, 2011 at 22:27 Comment(1)
Thanks for the suggestion, I'll look into running my applications on JBoss. Do you know has this bug been reported to the Seam / GlassFish folks?Congenital
S
2

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.

Stiegler answered 16/12, 2011 at 13:2 Comment(1)
This solved my problem! Thanks... would have taken a long time before i would tried that :)Perrins
N
2

I had the same problem when adding an interceptor that wasn't serializable in Glassfish 3.1.2.2. Just got a NullPointerException without any further explanation.

It works fine when I made the interceptor implement Serializable.

Normanormal answered 11/9, 2012 at 8:56 Comment(0)
V
2

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!

Vilhelmina answered 22/5, 2013 at 10:4 Comment(0)
R
0

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.

Remontant answered 4/4, 2014 at 15:4 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.