I have an EAR that contains a WAR and a EJB-JAR.
The WAR has a ServletContextListener into which an EJB is injected. This is the step that fails when restarting glassfish. It seems that the WAR is being loaded before the EJB-JAR . If I simply undeploy/deploy the EAR, this problem does not occur. The stack trace is below.
java.lang.RuntimeException: WEB5007: Exception during handling of afterListenerInstantiated event
at com.sun.web.server.WebContainerListener.containerEvent(WebContainerListener.java:123)
at org.apache.catalina.core.ContainerBase.fireContainerEvent(ContainerBase.java:1384)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4184)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4760)
at com.sun.enterprise.web.WebModule.start(WebModule.java:292)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1095)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:924)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1095)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:520)
at org.apache.catalina.startup.Embedded.start(Embedded.java:920)
at com.sun.enterprise.web.WebContainer.start(WebContainer.java:794)
at com.sun.enterprise.web.PEWebContainer.startInstance(PEWebContainer.java:722)
at com.sun.enterprise.web.PEWebContainerLifecycle.onStartup(PEWebContainerLifecycle.java:72)
at com.sun.enterprise.server.ondemand.ServiceGroup.startLifecycleServices(ServiceGroup.java:266)
at com.sun.enterprise.server.ondemand.WebServiceGroup.startLifecycleServices(WebServiceGroup.java:210)
at com.sun.enterprise.server.ondemand.WebServiceGroup.start(WebServiceGroup.java:60)
at com.sun.enterprise.server.ondemand.ServiceGroup$1.run(ServiceGroup.java:180)
at com.sun.enterprise.server.ondemand.ServiceGroup.startChildren(ServiceGroup.java:177)
at com.sun.enterprise.server.ondemand.MainServiceGroup.start(MainServiceGroup.java:45)
at com.sun.enterprise.server.ondemand.ServerEntryListenerImpl.notifyEntry(ServerEntryListenerImpl.java:72)
at com.sun.enterprise.server.ondemand.entry.ServerEntryHelper.sendEvent(ServerEntryHelper.java:62)
at com.sun.enterprise.server.ondemand.entry.ServerEntryHelper.generateAppLoaderEntryContext(ServerEntryHelper.java:47)
at com.sun.enterprise.server.AbstractLoader.generateEntryContext(AbstractLoader.java:831)
at com.sun.enterprise.server.AbstractLoader.notifyAppEvent(AbstractLoader.java:837)
at com.sun.enterprise.server.ApplicationLoader.load(ApplicationLoader.java:172)
at com.sun.enterprise.server.TomcatApplicationLoader.load(TomcatApplicationLoader.java:113)
at com.sun.enterprise.server.AbstractManager.load(AbstractManager.java:206)
at com.sun.enterprise.server.ApplicationLifecycle.onStartup(ApplicationLifecycle.java:204)
at com.sun.enterprise.server.ApplicationServer.onStartup(ApplicationServer.java:326)
at com.sun.enterprise.server.ondemand.OnDemandServer.onStartup(OnDemandServer.java:112)
Caused by: com.sun.enterprise.InjectionException: Exception attempting to inject Resolved Ejb-Ref com.nbs.fagi.NbsFagiServerStarter/server_at_jndi: - > NbsFagiServerBean into class com.nbs.fagi.NbsFagiServerStarter
at com.sun.enterprise.util.InjectionManagerImpl._inject(InjectionManagerImpl.java:373)
at com.sun.enterprise.util.InjectionManagerImpl.inject(InjectionManagerImpl.java:193)
at com.sun.enterprise.util.InjectionManagerImpl.injectInstance(InjectionManagerImpl.java:104)
at com.sun.web.server.WebContainerListener.injectInstance(WebContainerListener.java:172)
at com.sun.web.server.WebContainerListener.containerEvent(WebContainerListener.java:110)
at org.apache.catalina.core.ContainerBase.fireContainerEvent(ContainerBase.java:1384)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4184)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4760)
at com.sun.enterprise.web.WebModule.start(WebModule.java:292)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1095)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:924)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1095)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:520)
at org.apache.catalina.startup.Embedded.start(Embedded.java:920)
at com.sun.enterprise.web.WebContainer.start(WebContainer.java:794)
at com.sun.enterprise.web.PEWebContainer.startInstance(PEWebContainer.java:722)
at com.sun.enterprise.web.PEWebContainerLifecycle.onStartup(PEWebContainerLifecycle.java:72)
at com.sun.enterprise.server.ondemand.ServiceGroup.startLifecycleServices(ServiceGroup.java:266)
at com.sun.enterprise.server.ondemand.WebServiceGroup.startLifecycleServices(WebServiceGroup.java:210)
at com.sun.enterprise.server.ondemand.WebServiceGroup.start(WebServiceGroup.java:60)
at com.sun.enterprise.server.ondemand.ServiceGroup$1.run(ServiceGroup.java:180)
at com.sun.enterprise.server.ondemand.ServiceGroup.startChildren(ServiceGroup.java:177)
at com.sun.enterprise.server.ondemand.MainServiceGroup.start(MainServiceGroup.java:45)
at com.sun.enterprise.server.ondemand.ServerEntryListenerImpl.notifyEntry(ServerEntryListenerImpl.java:72)
at com.sun.enterprise.server.ondemand.entry.ServerEntryHelper.sendEvent(ServerEntryHelper.java:62)
at com.sun.enterprise.server.ondemand.entry.ServerEntryHelper.generateAppLoaderEntryContext(ServerEntryHelper.java:47)
at com.sun.enterprise.server.AbstractLoader.generateEntryContext(AbstractLoader.java:831)
at com.sun.enterprise.server.AbstractLoader.notifyAppEvent(AbstractLoader.java:837)
at com.sun.enterprise.server.ApplicationLoader.load(ApplicationLoader.java:172)
at com.sun.enterprise.server.TomcatApplicationLoader.load(TomcatApplicationLoader.java:113)
at com.sun.enterprise.server.AbstractManager.load(AbstractManager.java:206)
at com.sun.enterprise.server.ApplicationLifecycle.onStartup(ApplicationLifecycle.java:204)
at com.sun.enterprise.server.ApplicationServer.onStartup(ApplicationServer.java:326)
at com.sun.enterprise.server.ondemand.OnDemandServer.onStartup(OnDemandServer.java:112)
at com.sun.enterprise.server.PEMain.run(PEMain.java:326)
at com.sun.enterprise.server.PEMain.main(PEMain.java:260)
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 com.sun.enterprise.server.PELaunch.main(PELaunch.java:272)
Caused by: javax.naming.NameNotFoundException: No object bound for java:comp/env/com.nbs.fagi.NbsFagiServerStarter/server [Root exception is java.lang.NullPointerException: ]
at com.sun.enterprise.naming.java.javaURLContext.lookup(javaURLContext.java:196)
at com.sun.enterprise.naming.SerialContext.lookup(SerialContext.java:307)
at javax.naming.InitialContext.lookup(InitialContext.java:392)
at com.sun.enterprise.util.InjectionManagerImpl._inject(InjectionManagerImpl.java:274)
... 40 more
Caused by: java.lang.NullPointerException:
at com.sun.ejb.EJBUtils.resolveEjbRefObject(EJBUtils.java:283)
at com.sun.enterprise.naming.NamingManagerImpl.lookup(NamingManagerImpl.java:855)
at com.sun.enterprise.naming.java.javaURLContext.lookup(javaURLContext.java:156)
at com.sun.enterprise.naming.SerialContext.lookup(SerialContext.java:307)
at javax.naming.InitialContext.lookup(InitialContext.java:392)
at com.sun.enterprise.util.InjectionManagerImpl._inject(InjectionManagerImpl.java:274)
at com.sun.enterprise.util.InjectionManagerImpl.inject(InjectionManagerImpl.java:193)
at com.sun.enterprise.util.InjectionManagerImpl.injectInstance(InjectionManagerImpl.java:104)
at com.sun.web.server.WebContainerListener.injectInstance(WebContainerListener.java:172)
at com.sun.web.server.WebContainerListener.containerEvent(WebContainerListener.java:110)
at org.apache.catalina.core.ContainerBase.fireContainerEvent(ContainerBase.java:1384)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4184)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4760)
at com.sun.enterprise.web.WebModule.start(WebModule.java:292)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1095)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:924)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1095)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:520)
at org.apache.catalina.startup.Embedded.start(Embedded.java:920)
at com.sun.enterprise.web.WebContainer.start(WebContainer.java:794)
at com.sun.enterprise.web.PEWebContainer.startInstance(PEWebContainer.java:722)
at com.sun.enterprise.web.PEWebContainerLifecycle.onStartup(PEWebContainerLifecycle.java:72)
at com.sun.enterprise.server.ondemand.ServiceGroup.startLifecycleServices(ServiceGroup.java:266)
at com.sun.enterprise.server.ondemand.WebServiceGroup.startLifecycleServices(WebServiceGroup.java:210)
at com.sun.enterprise.server.ondemand.WebServiceGroup.start(WebServiceGroup.java:60)
at com.sun.enterprise.server.ondemand.ServiceGroup$1.run(ServiceGroup.java:180)
at com.sun.enterprise.server.ondemand.ServiceGroup.startChildren(ServiceGroup.java:177)
at com.sun.enterprise.server.ondemand.MainServiceGroup.start(MainServiceGroup.java:45)
at com.sun.enterprise.server.ondemand.ServerEntryListenerImpl.notifyEntry(ServerEntryListenerImpl.java:72)
at com.sun.enterprise.server.ondemand.entry.ServerEntryHelper.sendEvent(ServerEntryHelper.java:62)
[Message sent by forum member 'kryptolus' (kryptolus)]
http://forums.java.net/jive/thread.jspa?messageID=220273