glassfish
  1. glassfish
  2. GLASSFISH-20888

when excute list-jndi-entries command,java.lang.NullPointerException is happenning

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 4.0
    • Fix Version/s: 4.1
    • Component/s: admin
    • Labels:
      None
    • Environment:

      window32

      Description

      after execute the following command
      1.asadmin start-domain
      2.asadmin list-jndi-entries --context ejb/mgmt/MEJB
      the following exception will be printted at the server.log of DAS
      java.lang.NullPointerException
      at org.glassfish.enterprise.iiop.impl.IiopFolbGmsClient.getAllClusterInstanceInfo(IiopFolbGmsClient.java:443)
      at org.glassfish.enterprise.iiop.impl.IiopFolbGmsClient.<init>(IiopFolbGmsClient.java:152)
      at org.glassfish.enterprise.iiop.impl.GlassFishORBManager.setFOLBProperties(GlassFishORBManager.java:423)
      at org.glassfish.enterprise.iiop.impl.GlassFishORBManager.initORB(GlassFishORBManager.java:459)
      at org.glassfish.enterprise.iiop.impl.GlassFishORBManager.getORB(GlassFishORBManager.java:264)
      at org.glassfish.enterprise.iiop.impl.GlassFishORBFactoryImpl.createORB(GlassFishORBFactoryImpl.java:93)
      at org.glassfish.enterprise.iiop.api.GlassFishORBHelper.getORB(GlassFishORBHelper.java:163)
      at org.glassfish.enterprise.iiop.api.GlassFishORBHelper.getProtocolManager(GlassFishORBHelper.java:231)
      at com.sun.ejb.containers.BaseContainer.initializeProtocolManager(BaseContainer.java:830)
      at com.sun.ejb.containers.BaseContainer.<init>(BaseContainer.java:590)
      at com.sun.ejb.containers.StatelessSessionContainer.<init>(StatelessSessionContainer.java:143)
      at com.sun.ejb.containers.StatelessSessionContainer.<init>(StatelessSessionContainer.java:137)
      at com.sun.ejb.containers.StatelessContainerFactory.createContainer(StatelessContainerFactory.java:61)
      at org.glassfish.ejb.startup.EjbApplication.loadContainers(EjbApplication.java:221)
      at org.glassfish.ejb.startup.EjbDeployer.load(EjbDeployer.java:291)
      at org.glassfish.ejb.startup.EjbDeployer.load(EjbDeployer.java:99)
      at org.glassfish.internal.data.ModuleInfo.load(ModuleInfo.java:206)
      at org.glassfish.internal.data.ApplicationInfo.load(ApplicationInfo.java:313)
      at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:496)
      at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:219)
      at org.glassfish.kernel.javaee.MEJBNamingObjectProxy.deployMEJB(MEJBNamingObjectProxy.java:129)
      at org.glassfish.kernel.javaee.MEJBNamingObjectProxy.create(MEJBNamingObjectProxy.java:96)
      at com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:480)
      at com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:438)
      at com.sun.enterprise.naming.impl.SerialContext.list(SerialContext.java:786)
      at javax.naming.InitialContext.list(InitialContext.java:455)
      at javax.naming.InitialContext.list(InitialContext.java:455)
      at com.sun.enterprise.admin.monitor.jndi.JndiNameLookupHelper.getJndiEntriesByContextPath(JndiNameLookupHelper.java:95)
      at org.glassfish.admin.monitor.cli.ListJndiEntries.getNames(ListJndiEntries.java:134)
      at org.glassfish.admin.monitor.cli.ListJndiEntries.execute(ListJndiEntries.java:96)
      at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:539)
      at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:535)
      at java.security.AccessController.doPrivileged(Native Method)
      at javax.security.auth.Subject.doAs(Subject.java:356)
      at com.sun.enterprise.v3.admin.CommandRunnerImpl$2.execute(CommandRunnerImpl.java:534)
      at com.sun.enterprise.v3.admin.CommandRunnerImpl$3.run(CommandRunnerImpl.java:565)
      at com.sun.enterprise.v3.admin.CommandRunnerImpl$3.run(CommandRunnerImpl.java:557)
      at java.security.AccessController.doPrivileged(Native Method)
      at javax.security.auth.Subject.doAs(Subject.java:356)
      at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:556)
      at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1464)
      at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1300(CommandRunnerImpl.java:109)
      at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1846)
      at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1722)
      at org.glassfish.admin.rest.resources.admin.CommandResource.executeCommand(CommandResource.java:404)
      at org.glassfish.admin.rest.resources.admin.CommandResource.execCommandSimpInMultOut(CommandResource.java:234)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:601)
      at org.glassfish.jersey.server.model.internal.ResourceMethodInvocationHandlerFactory$1.invoke(ResourceMethodInvocationHandlerFactory.java:81)
      at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher$1.run(AbstractJavaResourceMethodDispatcher.java:140)
      at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.invoke(AbstractJavaResourceMethodDispatcher.java:158)
      at org.glassfish.jersey.server.model.internal.JavaResourceMethodDispatcherProvider$ResponseOutInvoker.doDispatch(JavaResourceMethodDispatcherProvider.java:152)
      at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.dispatch(AbstractJavaResourceMethodDispatcher.java:101)
      at org.glassfish.jersey.server.model.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:353)
      at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:343)
      at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:102)
      at org.glassfish.jersey.server.ServerRuntime$1.run(ServerRuntime.java:237)
      at org.glassfish.jersey.internal.Errors$1.call(Errors.java:271)
      at org.glassfish.jersey.internal.Errors$1.call(Errors.java:267)
      at org.glassfish.jersey.internal.Errors.process(Errors.java:315)
      at org.glassfish.jersey.internal.Errors.process(Errors.java:297)
      at org.glassfish.jersey.internal.Errors.process(Errors.java:267)
      at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:318)
      at org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:211)
      at org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:982)
      at org.glassfish.jersey.grizzly2.httpserver.GrizzlyHttpContainer.service(GrizzlyHttpContainer.java:330)
      at org.glassfish.admin.rest.adapter.JerseyContainerCommandService$3.service(JerseyContainerCommandService.java:173)
      at org.glassfish.admin.rest.adapter.RestAdapter.service(RestAdapter.java:179)
      at com.sun.enterprise.v3.services.impl.ContainerMapper$HttpHandlerCallable.call(ContainerMapper.java:496)
      at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:175)
      at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:191)
      at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:168)
      at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:187)
      at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
      at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:288)
      at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:206)
      at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:136)
      at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:114)
      at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)
      at org.glassfish.grizzly.portunif.PUFilter.handleRead(PUFilter.java:231)
      at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
      at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:288)
      at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:206)
      at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:136)
      at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:114)
      at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)
      at org.glassfish.grizzly.portunif.PUFilter.handleRead(PUFilter.java:231)
      at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
      at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:288)
      at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:206)
      at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:136)
      at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:114)
      at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)
      at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:837)
      at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:113)
      at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:115)
      at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:55)
      at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:135)
      at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:565)
      at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:545)
      at java.lang.Thread.run(Thread.java:722)

        Activity

        Hide
        Terry2013 added a comment -

        Hi,Chris Kasso

        After a few investigation about the source, I found the reason why NullPointerException happens.

        org.glassfish.enterprise.iiop.impl.IiopFolbGmsClient
            private Map<String,ClusterInstanceInfo> getAllClusterInstanceInfo() {
                final Cluster myCluster = myServer.getCluster() ;★1
                fineLog( "getAllClusterInstanceInfo: myCluster {0}", myCluster ) ;
        
                final Config myConfig = getConfigForServer( myServer ) ;
                fineLog( "getAllClusterInstanceInfo: myConfig {0}", myConfig ) ;
        
                final Map<String,ClusterInstanceInfo> result =
                    new HashMap<String,ClusterInstanceInfo>() ;
        
                for (Server server : myCluster.getInstances()) { ★2
                    ClusterInstanceInfo cii = getClusterInstanceInfo( server, myConfig,
                        false) ;
                    if (cii != null) {
                        result.put( server.getName(), cii ) ;
                    }
                }
        
                fineLog( "getAllClusterInstanceInfo: result {0}", result ) ;
                return result ;
            }
        

        ★1.When myServer is DAS, myServer.getCluster() method return null.
        ★2.But when myCluster.getInstances() method is invoked , this method does not check whether myCluster is null.

        Show
        Terry2013 added a comment - Hi,Chris Kasso After a few investigation about the source, I found the reason why NullPointerException happens. org.glassfish.enterprise.iiop.impl.IiopFolbGmsClient private Map< String ,ClusterInstanceInfo> getAllClusterInstanceInfo() { final Cluster myCluster = myServer.getCluster() ;★1 fineLog( "getAllClusterInstanceInfo: myCluster {0}" , myCluster ) ; final Config myConfig = getConfigForServer( myServer ) ; fineLog( "getAllClusterInstanceInfo: myConfig {0}" , myConfig ) ; final Map< String ,ClusterInstanceInfo> result = new HashMap< String ,ClusterInstanceInfo>() ; for (Server server : myCluster.getInstances()) { ★2 ClusterInstanceInfo cii = getClusterInstanceInfo( server, myConfig, false ) ; if (cii != null ) { result.put( server.getName(), cii ) ; } } fineLog( "getAllClusterInstanceInfo: result {0}" , result ) ; return result ; } ★1.When myServer is DAS, myServer.getCluster() method return null. ★2.But when myCluster.getInstances() method is invoked , this method does not check whether myCluster is null.
        Hide
        Terry2013 added a comment -

        Hi Chris,

        I modify the following code, it works fine,could you please confirm it?
        If the modification is OK, I will commit it.

        org.glassfish.enterprise.iiop.impl.IiopFolbGmsClient
        --- IiopFolbGmsClient.java	(revision 63160)
        +++ IiopFolbGmsClient.java	(working copy)
        @@ -440,11 +440,15 @@
                 final Map<String,ClusterInstanceInfo> result =
                     new HashMap<String,ClusterInstanceInfo>() ;
         
        -        for (Server server : myCluster.getInstances()) {
        -            ClusterInstanceInfo cii = getClusterInstanceInfo( server, myConfig,
        -                false) ;
        -            if (cii != null) {
        -                result.put( server.getName(), cii ) ;
        +        //When myServer is DAS's situation, myCluster is null.
        +        //null check is needed.
        +        if (myCluster != null) {
        +            for (Server server : myCluster.getInstances()) {
        +                ClusterInstanceInfo cii = getClusterInstanceInfo(server,
        +                        myConfig, false);
        +                if (cii != null) {
        +                    result.put(server.getName(), cii);
        +                }
                     }
                 }
         

        Thank you.

        Show
        Terry2013 added a comment - Hi Chris, I modify the following code, it works fine,could you please confirm it? If the modification is OK, I will commit it. org.glassfish.enterprise.iiop.impl.IiopFolbGmsClient --- IiopFolbGmsClient.java (revision 63160) +++ IiopFolbGmsClient.java (working copy) @@ -440,11 +440,15 @@ final Map< String ,ClusterInstanceInfo> result = new HashMap< String ,ClusterInstanceInfo>() ; - for (Server server : myCluster.getInstances()) { - ClusterInstanceInfo cii = getClusterInstanceInfo( server, myConfig, - false ) ; - if (cii != null ) { - result.put( server.getName(), cii ) ; + //When myServer is DAS's situation, myCluster is null . + // null check is needed. + if (myCluster != null ) { + for (Server server : myCluster.getInstances()) { + ClusterInstanceInfo cii = getClusterInstanceInfo(server, + myConfig, false ); + if (cii != null ) { + result.put(server.getName(), cii); + } } } Thank you.
        Hide
        Chris Kasso added a comment -

        The fix looks fine to me.

        Show
        Chris Kasso added a comment - The fix looks fine to me.
        Hide
        Terry2013 added a comment -

        the issue has been fixed in r63167.

        Show
        Terry2013 added a comment - the issue has been fixed in r63167.

          People

          • Assignee:
            Chris Kasso
            Reporter:
            lzg5039
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: