javax.naming.NameNotFoundException: Cannot find name to unbind

Oracle Community | Vineet.Reynolds | 5 years ago
  1. 0

    Original Java.net forum thread is http://www.java.net/forum/topic/glassfish/glassfish/namenotfoundexception-thrown-during-undeployment-war-containing-ejbs --- 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.

    Java.net JIRA | 5 years ago | Vineet Reynolds
    javax.naming.NameNotFoundException: Cannot find name to unbind
  2. 0

    NameNotFoundException thrown during undeployment of a WAR containing EJBs

    Oracle Community | 5 years ago | Vineet.Reynolds
    javax.naming.NameNotFoundException: Cannot find name to unbind
  3. 0

    Deploy EJB in multiple wars to same app server (Glassfish)

    Stack Overflow | 3 years ago | sdoca
    javax.naming.NameNotFoundException: Cannot find name to unbind
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    Glassfish 3.1 exception using ActiveMQ RA

    Oracle Community | 6 years ago | joseguerra
    javax.naming.NameNotFoundException: Cannot find name to unbind

    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. javax.naming.NameNotFoundException

      Cannot find name to unbind

      at com.sun.enterprise.naming.impl.TransientContext.doUnbind()
    2. Glassfish Naming
      SerialContext.unbind
      1. com.sun.enterprise.naming.impl.TransientContext.doUnbind(TransientContext.java:398)
      2. com.sun.enterprise.naming.impl.TransientContext.unbind(TransientContext.java:420)
      3. com.sun.enterprise.naming.impl.TransientContext.unbind(TransientContext.java:424)
      4. com.sun.enterprise.naming.impl.TransientContext.unbind(TransientContext.java:424)
      5. com.sun.enterprise.naming.impl.SerialContextProviderImpl.unbind(SerialContextProviderImpl.java:124)
      6. com.sun.enterprise.naming.impl.SerialContext.unbind(SerialContext.java:740)
      6 frames
    3. Java RT
      InitialContext.unbind
      1. javax.naming.InitialContext.unbind(InitialContext.java:416)
      2. javax.naming.InitialContext.unbind(InitialContext.java:416)
      2 frames
    4. Glassfish Naming
      GlassfishNamingManagerImpl.unpublishObject
      1. com.sun.enterprise.naming.impl.GlassfishNamingManagerImpl.unpublishObject(GlassfishNamingManagerImpl.java:246)
      1 frame
    5. Container Common
      ComponentEnvManagerImpl.unbindFromComponentNamespace
      1. com.sun.enterprise.container.common.impl.ComponentEnvManagerImpl.unbindFromComponentNamespace(ComponentEnvManagerImpl.java:355)
      1 frame
    6. Glassfish
      WebModuleContextConfig.lifecycleEvent
      1. com.sun.enterprise.web.WebModuleContextConfig.unbindFromComponentNamespace(WebModuleContextConfig.java:454)
      2. com.sun.enterprise.web.WebModuleContextConfig.stop(WebModuleContextConfig.java:447)
      3. com.sun.enterprise.web.WebModuleContextConfig.lifecycleEvent(WebModuleContextConfig.java:174)
      3 frames
    7. Glassfish Core
      StandardContext.stop
      1. org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:149)
      2. org.apache.catalina.core.StandardContext.stop(StandardContext.java:5603)
      2 frames
    8. Glassfish
      WebModule.stop
      1. com.sun.enterprise.web.WebModule.stop(WebModule.java:527)
      1 frame
    9. Glassfish Core
      ContainerBase.removeChild
      1. org.apache.catalina.core.ContainerBase.removeChild(ContainerBase.java:1049)
      1 frame
    10. Glassfish
      WebApplication.stop
      1. com.sun.enterprise.web.WebContainer.unloadWebModule(WebContainer.java:2211)
      2. com.sun.enterprise.web.WebContainer.unloadWebModule(WebContainer.java:2166)
      3. com.sun.enterprise.web.WebApplication.stop(WebApplication.java:159)
      3 frames
    11. Private APIs of Glassfish
      ApplicationInfo.stop
      1. org.glassfish.internal.data.EngineRef.stop(EngineRef.java:169)
      2. org.glassfish.internal.data.ModuleInfo.stop(ModuleInfo.java:302)
      3. org.glassfish.internal.data.ApplicationInfo.stop(ApplicationInfo.java:322)
      3 frames
    12. Kernel Classes
      ApplicationLifecycle.undeploy
      1. com.sun.enterprise.v3.server.ApplicationLifecycle.unload(ApplicationLifecycle.java:999)
      2. com.sun.enterprise.v3.server.ApplicationLifecycle.undeploy(ApplicationLifecycle.java:1025)
      2 frames
    13. Embedded GlassFish Web
      UndeployCommand.execute
      1. org.glassfish.deployment.admin.UndeployCommand.execute(UndeployCommand.java:330)
      1 frame
    14. Kernel Classes
      AdminAdapter.service
      1. com.sun.enterprise.v3.admin.CommandRunnerImpl$1.execute(CommandRunnerImpl.java:355)
      2. com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:370)
      3. com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1064)
      4. com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1200(CommandRunnerImpl.java:96)
      5. com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1244)
      6. com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1232)
      7. com.sun.enterprise.v3.admin.AdminAdapter.doCommand(AdminAdapter.java:459)
      8. com.sun.enterprise.v3.admin.AdminAdapter.service(AdminAdapter.java:209)
      8 frames
    15. Grizzly WS
      GrizzlyAdapter.service
      1. com.sun.grizzly.tcp.http11.GrizzlyAdapter.service(GrizzlyAdapter.java:168)
      1 frame
    16. Kernel Classes
      ContainerMapper.service
      1. com.sun.enterprise.v3.server.HK2Dispatcher.dispath(HK2Dispatcher.java:117)
      2. com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:238)
      2 frames
    17. Grizzly WS
      AbstractThreadPool$Worker.run
      1. com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:828)
      2. com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:725)
      3. com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1019)
      4. com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:225)
      5. com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137)
      6. com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104)
      7. com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90)
      8. com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79)
      9. com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54)
      10. com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59)
      11. com.sun.grizzly.ContextTask.run(ContextTask.java:71)
      12. com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532)
      13. com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513)
      13 frames
    18. Java RT
      Thread.run
      1. java.lang.Thread.run(Thread.java:662)
      1 frame