users@glassfish.java.net

NameNotFoundException thrown during undeployment of a WAR containing EJBs

From: <forums_at_java.net>
Date: Mon, 26 Sep 2011 07:14:44 -0500 (CDT)

Hi all,

       The following exception stacktrace was produced during
undeployment of a Web Archive containing EJBs with an explicit global and
portable JNDI name:

[#|2011-09-26T17:39:47.229+0530|WARNING|glassfish3.1.1|javax.enterprise.system.container.web.com.sun.enterprise.web|_ThreadID=20;_ThreadName=Thread-4;|WEB0610:
[/WebEJBExample] failed to unbind namespace
javax.naming.NameNotFoundException: Cannot find name to unbind
    at
com.sun.enterprise.naming.impl.TransientContext.doUnbind(TransientContext.java:398)
    at
com.sun.enterprise.naming.impl.TransientContext.unbind(TransientContext.java:420)
    at
com.sun.enterprise.naming.impl.TransientContext.unbind(TransientContext.java:424)
    at
com.sun.enterprise.naming.impl.TransientContext.unbind(TransientContext.java:424)
    at
com.sun.enterprise.naming.impl.SerialContextProviderImpl.unbind(SerialContextProviderImpl.java:124)
    at
com.sun.enterprise.naming.impl.SerialContext.unbind(SerialContext.java:740)
    at javax.naming.InitialContext.unbind(InitialContext.java:416)
    at javax.naming.InitialContext.unbind(InitialContext.java:416)
    at
com.sun.enterprise.naming.impl.GlassfishNamingManagerImpl.unpublishObject(GlassfishNamingManagerImpl.java:246)
    at
com.sun.enterprise.container.common.impl.ComponentEnvManagerImpl.unbindFromComponentNamespace(ComponentEnvManagerImpl.java:355)
    at
com.sun.enterprise.web.WebModuleContextConfig.unbindFromComponentNamespace(WebModuleContextConfig.java:454)
    at
com.sun.enterprise.web.WebModuleContextConfig.stop(WebModuleContextConfig.java:447)
    at
com.sun.enterprise.web.WebModuleContextConfig.lifecycleEvent(WebModuleContextConfig.java:174)
    at
org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:149)
    at
org.apache.catalina.core.StandardContext.stop(StandardContext.java:5603)
    at com.sun.enterprise.web.WebModule.stop(WebModule.java:527)
    at
org.apache.catalina.core.ContainerBase.removeChild(ContainerBase.java:1049)
    at
com.sun.enterprise.web.WebContainer.unloadWebModule(WebContainer.java:2211)
    at
com.sun.enterprise.web.WebContainer.unloadWebModule(WebContainer.java:2166)
    at com.sun.enterprise.web.WebApplication.stop(WebApplication.java:159)
    at org.glassfish.internal.data.EngineRef.stop(EngineRef.java:169)
    at org.glassfish.internal.data.ModuleInfo.stop(ModuleInfo.java:302)
    at
org.glassfish.internal.data.ApplicationInfo.stop(ApplicationInfo.java:322)
    at
com.sun.enterprise.v3.server.ApplicationLifecycle.unload(ApplicationLifecycle.java:999)
    at
com.sun.enterprise.v3.server.ApplicationLifecycle.undeploy(ApplicationLifecycle.java:1025)
    at
org.glassfish.deployment.admin.UndeployCommand.execute(UndeployCommand.java:330)
    at
com.sun.enterprise.v3.admin.CommandRunnerImpl$1.execute(CommandRunnerImpl.java:355)
    at
com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:370)
    at
com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1064)
    at
com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1200(CommandRunnerImpl.java:96)
    at
com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1244)
    at
com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1232)
    at
com.sun.enterprise.v3.admin.AdminAdapter.doCommand(AdminAdapter.java:459)
    at
com.sun.enterprise.v3.admin.AdminAdapter.service(AdminAdapter.java:209)
    at
com.sun.grizzly.tcp.http11.GrizzlyAdapter.service(GrizzlyAdapter.java:168)
    at
com.sun.enterprise.v3.server.HK2Dispatcher.dispath(HK2Dispatcher.java:117)
    at
com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:238)
    at
com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:828)
    at
com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:725)
    at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1019)
    at
com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:225)
    at
com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137)
    at
com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104)
    at
com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90)
    at
com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79)
    at
com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54)
    at
com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59)
    at com.sun.grizzly.ContextTask.run(ContextTask.java:71)
    at
com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532)
    at
com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513)
    at java.lang.Thread.run(Thread.java:662)
|#]

The error appears to occur when Glassfish attempts to undeploy the web module
after undeploying the EJB module. The EJB module appears to be the one that
owns the portable JNDI name, and when the web module attempts to unbind the
non-existent JNDI name, the afore-mentioned exception is thrown. This has
grave consequences in a more complicated scenario (like the usage of
Hibernate as a JPA provider within the application), as the web-module does
not appear to be completely undeployed, resulting in vague exceptions being
thrown on a subsequent deployment and use of the application.

Surprisingly, the exception is not thrown when the EJB module is packaged in
a EAR file, as an ejb-jar file. Also, no exceptions are thrown when no
portable JNDI names are specified for the EJB using the @EJB annotation.

A testcase (an Eclipse project) to reproduce this is attached.


--
[Message sent by forum member 'Vineet.Reynolds']
View Post: http://forums.java.net/node/846953