glassfish
  1. glassfish
  2. GLASSFISH-16973

Unable to deploy EJB application to second embedded glassfish instance.

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Critical Critical
    • Resolution: Unresolved
    • Affects Version/s: 3.1.1, 4.0
    • Fix Version/s: future release
    • Component/s: orb
    • Labels:
      None
    • Environment:

      any

      Description

      This is a case where :

      1. I create a embedded glassfish instance, start it, deploy a ejb app, and stop/dispose the instance. Note that the application is not undeployed prior to the stop (the case is slightly different from GLASSFISH-16965)

      2. I create a second embedded glassfish instance, start it, deploy the same app as in (1), stop/dispose the instance.

      But the deployment of ejb app to the second instance fails with

       "java.lang.RuntimeException: Error while binding JNDI name org.glassfish.tests.embedded.ejb.remoteejb.RemoteEJBInf__3_x_Internal_RemoteBusinessHome__ for EJB : RemoteEJB". 

      Steps to reproduce:

      1. Download the attached Test.java
      2. Download remoteejb.jar from GLASSFISH-16546
      3. Set S1AS_HOME to point to your 3.1.1 installation
      4. javac -g -cp $S1AS_HOME/lib/embedded/glassfish-embedded-static-shell.jar Test.java
      5. java -cp $S1AS_HOME/lib/embedded/glassfish-embedded-static-shell.jar: Test; // I have attached my console output.
      
      

      I happen to exercise this case because of the workaround mentioned in GLASSFISH-16916 by Harshad. Unfortunately the workaround does not work because of this issue.

      1. console.log.txt
        22 kB
        Bhavanishankar
      2. Test.java
        4 kB
        Bhavanishankar

        Activity

        Hide
        marina vatkina added a comment -

        One more area not designed for a restart in the same VM...

        Show
        marina vatkina added a comment - One more area not designed for a restart in the same VM...
        Hide
        marina vatkina added a comment -

        Note that embeddable EJB Container works fine because it completely disposes GFRuntime.

        Show
        marina vatkina added a comment - Note that embeddable EJB Container works fine because it completely disposes GFRuntime.
        Hide
        Cheng Fang added a comment - - edited

        There was an error when calling unpublishCosNamingObject for EJB internal home jndi name during shutdown. So these 2 entries remain in TransientContext bindings. My proposal is to ignore this orb failure and continue to unbind them from TransientContext.

        The stacktrace:

        java.lang.NullPointerException
        	at com.sun.corba.ee.impl.orb.ORBImpl.getInvocationInfo(ORBImpl.java:1911)
        	at com.sun.corba.ee.impl.protocol.CorbaClientDelegateImpl.getClientRequestDispatcher(CorbaClientDelegateImpl.java:308)
        	at com.sun.corba.ee.impl.protocol.CorbaClientDelegateImpl.releaseReply(CorbaClientDelegateImpl.java:290)
        	at org.omg.CORBA.portable.ObjectImpl._releaseReply(ObjectImpl.java:474)
        	at org.omg.CosNaming._NamingContextStub.unbind(_NamingContextStub.java:301)
        	at com.sun.jndi.cosnaming.CNCtx.callUnbind(CNCtx.java:712)
        	at com.sun.jndi.cosnaming.CNCtx.unbind(CNCtx.java:768)
        	at com.sun.jndi.cosnaming.CNCtx.unbind(CNCtx.java:752)
        	at javax.naming.InitialContext.unbind(InitialContext.java:416)
        	at com.sun.enterprise.naming.impl.GlassfishNamingManagerImpl.unpublishCosNamingObject(GlassfishNamingManagerImpl.java:260)
        	at com.sun.ejb.containers.BaseContainer$JndiInfo.unpublish(BaseContainer.java:5618)
        	at com.sun.ejb.containers.BaseContainer.doContainerCleanup(BaseContainer.java:4298)
        	at com.sun.ejb.containers.BaseContainer.onShutdown(BaseContainer.java:4237)
        	at org.glassfish.ejb.startup.EjbApplication.stop(EjbApplication.java:307)
        	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.disable(ApplicationLifecycle.java:1971)
        	at com.sun.enterprise.v3.server.ApplicationLoaderService.stopApplication(ApplicationLoaderService.java:454)
        	at com.sun.enterprise.v3.server.ApplicationLoaderService.preDestroy(ApplicationLoaderService.java:422)
        	at com.sun.hk2.component.AbstractCreatorInhabitantImpl.dispose(AbstractCreatorInhabitantImpl.java:83)
        	at com.sun.hk2.component.SingletonInhabitant.release(SingletonInhabitant.java:81)
        	at com.sun.hk2.component.EventPublishingInhabitant.release(EventPublishingInhabitant.java:108)
        	at com.sun.hk2.component.LazyInhabitant.release(LazyInhabitant.java:133)
        	at com.sun.enterprise.v3.server.AppServerStartup.stop(AppServerStartup.java:425)
        	at com.sun.enterprise.glassfish.bootstrap.GlassFishImpl.stop(GlassFishImpl.java:88)
        	at Test.main(Test.java:22)
        
        Show
        Cheng Fang added a comment - - edited There was an error when calling unpublishCosNamingObject for EJB internal home jndi name during shutdown. So these 2 entries remain in TransientContext bindings. My proposal is to ignore this orb failure and continue to unbind them from TransientContext. The stacktrace: java.lang.NullPointerException at com.sun.corba.ee.impl.orb.ORBImpl.getInvocationInfo(ORBImpl.java:1911) at com.sun.corba.ee.impl.protocol.CorbaClientDelegateImpl.getClientRequestDispatcher(CorbaClientDelegateImpl.java:308) at com.sun.corba.ee.impl.protocol.CorbaClientDelegateImpl.releaseReply(CorbaClientDelegateImpl.java:290) at org.omg.CORBA.portable.ObjectImpl._releaseReply(ObjectImpl.java:474) at org.omg.CosNaming._NamingContextStub.unbind(_NamingContextStub.java:301) at com.sun.jndi.cosnaming.CNCtx.callUnbind(CNCtx.java:712) at com.sun.jndi.cosnaming.CNCtx.unbind(CNCtx.java:768) at com.sun.jndi.cosnaming.CNCtx.unbind(CNCtx.java:752) at javax.naming.InitialContext.unbind(InitialContext.java:416) at com.sun.enterprise.naming.impl.GlassfishNamingManagerImpl.unpublishCosNamingObject(GlassfishNamingManagerImpl.java:260) at com.sun.ejb.containers.BaseContainer$JndiInfo.unpublish(BaseContainer.java:5618) at com.sun.ejb.containers.BaseContainer.doContainerCleanup(BaseContainer.java:4298) at com.sun.ejb.containers.BaseContainer.onShutdown(BaseContainer.java:4237) at org.glassfish.ejb.startup.EjbApplication.stop(EjbApplication.java:307) 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.disable(ApplicationLifecycle.java:1971) at com.sun.enterprise.v3.server.ApplicationLoaderService.stopApplication(ApplicationLoaderService.java:454) at com.sun.enterprise.v3.server.ApplicationLoaderService.preDestroy(ApplicationLoaderService.java:422) at com.sun.hk2.component.AbstractCreatorInhabitantImpl.dispose(AbstractCreatorInhabitantImpl.java:83) at com.sun.hk2.component.SingletonInhabitant.release(SingletonInhabitant.java:81) at com.sun.hk2.component.EventPublishingInhabitant.release(EventPublishingInhabitant.java:108) at com.sun.hk2.component.LazyInhabitant.release(LazyInhabitant.java:133) at com.sun.enterprise.v3.server.AppServerStartup.stop(AppServerStartup.java:425) at com.sun.enterprise.glassfish.bootstrap.GlassFishImpl.stop(GlassFishImpl.java:88) at Test.main(Test.java:22)
        Hide
        Cheng Fang added a comment - - edited

        Tried this following fix in GlassFishNamingManagerImpl, the attached the test passed:

        Index: src/main/java/com/sun/enterprise/naming/impl/GlassfishNamingManagerImpl.java
        ===================================================================
        --- src/main/java/com/sun/enterprise/naming/impl/GlassfishNamingManagerImpl.java	(revision 47909)
        +++ src/main/java/com/sun/enterprise/naming/impl/GlassfishNamingManagerImpl.java	(working copy)
        @@ -258,7 +258,7 @@
         
                 try {
                     getCosContext().unbind(name);
        -        } catch(NamingException cne) {
        +        } catch(Exception cne) {
                    _logger.log(Level.WARNING, "Error during CosNaming.unbind for " + name); 
                 }
        
        Show
        Cheng Fang added a comment - - edited Tried this following fix in GlassFishNamingManagerImpl, the attached the test passed: Index: src/main/java/com/sun/enterprise/naming/impl/GlassfishNamingManagerImpl.java =================================================================== --- src/main/java/com/sun/enterprise/naming/impl/GlassfishNamingManagerImpl.java (revision 47909) +++ src/main/java/com/sun/enterprise/naming/impl/GlassfishNamingManagerImpl.java (working copy) @@ -258,7 +258,7 @@ try { getCosContext().unbind(name); - } catch (NamingException cne) { + } catch (Exception cne) { _logger.log(Level.WARNING, "Error during CosNaming.unbind for " + name); }
        Hide
        Cheng Fang added a comment -

        Assign to orb team to evaluate the ORB NPE.

        Show
        Cheng Fang added a comment - Assign to orb team to evaluate the ORB NPE.
        Hide
        Harshad Vilekar added a comment -

        Defer the restart requirement. There are missing defensive null value checks at some places in the ORB code.

        Show
        Harshad Vilekar added a comment - Defer the restart requirement. There are missing defensive null value checks at some places in the ORB code.

          People

          • Assignee:
            Harshad Vilekar
            Reporter:
            Bhavanishankar
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated: