glassfish
  1. glassfish
  2. GLASSFISH-19104

NullPointerException was thrown out when delete a nonexistent lifecycle module

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Critical Critical
    • Resolution: Fixed
    • Affects Version/s: 4.0_b54
    • Fix Version/s: 4.0_b56_ms5
    • Component/s: lifecycle_modules
    • Labels:
      None
    • Environment:

      Windows XP, Windows 7

      Description

      [Bug Description]
      When executed "delete-lifecycle-module" command by specifing a name that does not exist, it will be failed and the NullPointerException was thrown out.

      [Operations]
      STEP1 Start the domain

      asadmin> start-domain
      Waiting for domain1 to start ..............................
      Successfully started the domain : domain1
      domain Location: D:\glassfish3\glassfish\domains\domain1
      Log File: D:\glassfish3\glassfish\domains\domain1\logs\server.log
      Admin Port: 4848
      Command start-domain executed successfully.

      STEP2. Execute the delete-lifecycle-module to delete a lifecycle-module that does not exist.

      asadmin> delete-lifecycle-module not_exist
      remote failure: User is not authorized for this command
      java.lang.NullPointerException
      Command delete-lifecycle-module failed.

      [affected versions]
      1 4.0_b54
      2 Glassfish's trunk until 2012/09/25

        Activity

        Hide
        zhouronghui added a comment -

        The patch of GLASSFISH-19104

        Show
        zhouronghui added a comment - The patch of GLASSFISH-19104
        Hide
        zhouronghui added a comment -

        Dear Tom

        I think it's caused by the NULL check was omitted
        in DeleteLifecycleModuleCommand#getAccessChecks,
        and I made a patch for this issue and attached to
        the ISSUE. Would you please check it?

        PS:
        The NullPointerException was thrown out and
        the stack trace in server.log was as follows:

         
        [#|2012-09-25T15:46:58.318+0900|SEVERE|44.0|javax.enterprise.system.tools.admin.security.authorization|_ThreadID=12;_ThreadName=admin-listener(1);|org.glassfish.deployment.admin.DeleteLifecycleModuleCommand
        java.lang.NullPointerException
        	at java.net.URI$Parser.parse(URI.java:3004)
        	at java.net.URI.<init>(URI.java:577)
        	at java.net.URI.create(URI.java:839)
        	at com.sun.enterprise.admin.util.CommandSecurityChecker.resourceURIFromAccessCheck(CommandSecurityChecker.java:244)
        	at com.sun.enterprise.admin.util.CommandSecurityChecker.checkAccessRequired(CommandSecurityChecker.java:189)
        	at com.sun.enterprise.admin.util.CommandSecurityChecker.authorize(CommandSecurityChecker.java:139)
        ~omitted~
        	at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:558)
        	at java.lang.Thread.run(Thread.java:662)
        |#]
        
        Show
        zhouronghui added a comment - Dear Tom I think it's caused by the NULL check was omitted in DeleteLifecycleModuleCommand#getAccessChecks, and I made a patch for this issue and attached to the ISSUE. Would you please check it? PS: The NullPointerException was thrown out and the stack trace in server.log was as follows: [#|2012-09-25T15:46:58.318+0900|SEVERE|44.0|javax.enterprise.system.tools.admin.security.authorization|_ThreadID=12;_ThreadName=admin-listener(1);|org.glassfish.deployment.admin.DeleteLifecycleModuleCommand java.lang.NullPointerException at java.net.URI$Parser.parse(URI.java:3004) at java.net.URI.<init>(URI.java:577) at java.net.URI.create(URI.java:839) at com.sun.enterprise.admin.util.CommandSecurityChecker.resourceURIFromAccessCheck(CommandSecurityChecker.java:244) at com.sun.enterprise.admin.util.CommandSecurityChecker.checkAccessRequired(CommandSecurityChecker.java:189) at com.sun.enterprise.admin.util.CommandSecurityChecker.authorize(CommandSecurityChecker.java:139) ~omitted~ at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:558) at java.lang.Thread.run(Thread.java:662) |#]
        Hide
        Hong Zhang added a comment -

        As Tim helped make this part of the security changes, I will let Tim take a look to see if the attached patch is the best place to fix (or should the NPE check made in CommandSecurityChecker.resourceURIFromAccessCheck so other similar code paths are covered as well).

        Show
        Hong Zhang added a comment - As Tim helped make this part of the security changes, I will let Tim take a look to see if the attached patch is the best place to fix (or should the NPE check made in CommandSecurityChecker.resourceURIFromAccessCheck so other similar code paths are covered as well).
        Hide
        Tim Quinn added a comment -

        Fix checked in.

        Project: glassfish
        Repository: svn
        Revision: 56123
        Author: tjquinn
        Date: 2012-09-25 15:54:10 UTC
        Link:

        Log Message:
        ------------
        Fix for 19104.

        The code which prepares the access check did not adequately protect against a null resource name being used (which happens if the specified life cycle module does not exist).

        Revisions:
        ----------
        56123

        Modified Paths:
        ---------------
        trunk/main/nucleus/deployment/admin/src/main/java/org/glassfish/deployment/admin/DeleteLifecycleModuleCommand.java

        Show
        Tim Quinn added a comment - Fix checked in. Project: glassfish Repository: svn Revision: 56123 Author: tjquinn Date: 2012-09-25 15:54:10 UTC Link: Log Message: ------------ Fix for 19104. The code which prepares the access check did not adequately protect against a null resource name being used (which happens if the specified life cycle module does not exist). Revisions: ---------- 56123 Modified Paths: --------------- trunk/main/nucleus/deployment/admin/src/main/java/org/glassfish/deployment/admin/DeleteLifecycleModuleCommand.java
        Hide
        Hari92 added a comment -

        I'm getting the below error while deploying a war which is worked earlier in Tomcat but not working in Glassfish 4.0
        [2016-04-13T00:02:23.156+0530] [glassfish 4.0] [SEVERE] [NCLS-ADMIN-00011] [javax.enterprise.system.tools.admin.security.authorization] [tid: _ThreadID=37 _ThreadName=admin-listener(4)] [timeMillis: 1460485943156] [levelValue: 1000] [[
        An unexpected exception occurred.
        java.lang.RuntimeException: java.lang.NullPointerException
        at org.glassfish.deployment.admin.DeployCommand.preAuthorization(DeployCommand.java:314)
        at com.sun.enterprise.admin.util.CommandSecurityChecker$1.run(CommandSecurityChecker.java:187)
        at com.sun.enterprise.admin.util.CommandSecurityChecker$1.run(CommandSecurityChecker.java:183)
        at java.security.AccessController.doPrivileged(Native Method)
        at javax.security.auth.Subject.doAs(Subject.java:360)
        at com.sun.enterprise.admin.util.CommandSecurityChecker.authorize(CommandSecurityChecker.java:183)
        at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1203)
        at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1500(CommandRunnerImpl.java:108)
        at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1762)
        at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1674)
        at org.glassfish.admin.rest.resources.admin.CommandResource.executeCommand(CommandResource.java:396)
        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:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:497)
        at org.glassfish.jersey.server.model.internal.ResourceMethodInvocationHandlerFactory$1.invoke(ResourceMethodInvocationHandlerFactory.java:81)
        at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.invoke(AbstractJavaResourceMethodDispatcher.java:125)
        at org.glassfish.jersey.server.model.internal.JavaResourceMethodDispatcherProvider$ResponseOutInvoker.doDispatch(JavaResourceMethodDispatcherProvider.java:152)
        at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.dispatch(AbstractJavaResourceMethodDispatcher.java:91)
        at org.glassfish.jersey.server.model.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:346)
        at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:341)
        at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:101)
        at org.glassfish.jersey.server.ServerRuntime$1.run(ServerRuntime.java:224)
        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:317)
        at org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:198)
        at org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:946)
        at org.glassfish.jersey.grizzly2.httpserver.GrizzlyHttpContainer.service(GrizzlyHttpContainer.java:331)
        at org.glassfish.admin.rest.adapter.JerseyContainerCommandService$3.service(JerseyContainerCommandService.java:165)
        at org.glassfish.admin.rest.adapter.RestAdapter.service(RestAdapter.java:181)
        at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:246)
        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:189)
        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:838)
        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:564)
        at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:544)
        at java.lang.Thread.run(Thread.java:745)
        Caused by: java.lang.NullPointerException
        at com.sun.enterprise.deployment.deploy.shared.InputJarArchive$ArchiveJarEntrySource.<init>(InputJarArchive.java:581)
        at com.sun.enterprise.deployment.deploy.shared.InputJarArchive$ArchiveJarEntrySource.<init>(InputJarArchive.java:573)
        at com.sun.enterprise.deployment.deploy.shared.InputJarArchive.createEntryEnumeration(InputJarArchive.java:451)
        at com.sun.enterprise.deployment.deploy.shared.InputJarArchive.entries(InputJarArchive.java:203)
        at com.sun.enterprise.deployment.deploy.shared.InputJarArchive.access$100(InputJarArchive.java:74)
        at com.sun.enterprise.deployment.deploy.shared.InputJarArchive$1.enumeration(InputJarArchive.java:166)
        at com.sun.enterprise.deployment.deploy.shared.InputJarArchive$CollectionWrappedEnumeration.<init>(InputJarArchive.java:724)
        at com.sun.enterprise.deployment.deploy.shared.InputJarArchive.getDirectories(InputJarArchive.java:161)
        at org.glassfish.javaee.full.deployment.EarDetector.isEARFromIntrospecting(EarDetector.java:142)
        at org.glassfish.javaee.full.deployment.EarDetector.handles(EarDetector.java:110)
        at com.sun.enterprise.v3.server.ApplicationLifecycle.getArchiveHandler(ApplicationLifecycle.java:211)
        at org.glassfish.deployment.admin.DeployCommand.preAuthorization(DeployCommand.java:246)
        ... 52 more
        ]]

        Show
        Hari92 added a comment - I'm getting the below error while deploying a war which is worked earlier in Tomcat but not working in Glassfish 4.0 [2016-04-13T00:02:23.156+0530] [glassfish 4.0] [SEVERE] [NCLS-ADMIN-00011] [javax.enterprise.system.tools.admin.security.authorization] [tid: _ThreadID=37 _ThreadName=admin-listener(4)] [timeMillis: 1460485943156] [levelValue: 1000] [[ An unexpected exception occurred. java.lang.RuntimeException: java.lang.NullPointerException at org.glassfish.deployment.admin.DeployCommand.preAuthorization(DeployCommand.java:314) at com.sun.enterprise.admin.util.CommandSecurityChecker$1.run(CommandSecurityChecker.java:187) at com.sun.enterprise.admin.util.CommandSecurityChecker$1.run(CommandSecurityChecker.java:183) at java.security.AccessController.doPrivileged(Native Method) at javax.security.auth.Subject.doAs(Subject.java:360) at com.sun.enterprise.admin.util.CommandSecurityChecker.authorize(CommandSecurityChecker.java:183) at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1203) at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1500(CommandRunnerImpl.java:108) at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1762) at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1674) at org.glassfish.admin.rest.resources.admin.CommandResource.executeCommand(CommandResource.java:396) 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:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:497) at org.glassfish.jersey.server.model.internal.ResourceMethodInvocationHandlerFactory$1.invoke(ResourceMethodInvocationHandlerFactory.java:81) at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.invoke(AbstractJavaResourceMethodDispatcher.java:125) at org.glassfish.jersey.server.model.internal.JavaResourceMethodDispatcherProvider$ResponseOutInvoker.doDispatch(JavaResourceMethodDispatcherProvider.java:152) at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.dispatch(AbstractJavaResourceMethodDispatcher.java:91) at org.glassfish.jersey.server.model.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:346) at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:341) at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:101) at org.glassfish.jersey.server.ServerRuntime$1.run(ServerRuntime.java:224) 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:317) at org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:198) at org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:946) at org.glassfish.jersey.grizzly2.httpserver.GrizzlyHttpContainer.service(GrizzlyHttpContainer.java:331) at org.glassfish.admin.rest.adapter.JerseyContainerCommandService$3.service(JerseyContainerCommandService.java:165) at org.glassfish.admin.rest.adapter.RestAdapter.service(RestAdapter.java:181) at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:246) 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:189) 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:838) 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:564) at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:544) at java.lang.Thread.run(Thread.java:745) Caused by: java.lang.NullPointerException at com.sun.enterprise.deployment.deploy.shared.InputJarArchive$ArchiveJarEntrySource.<init>(InputJarArchive.java:581) at com.sun.enterprise.deployment.deploy.shared.InputJarArchive$ArchiveJarEntrySource.<init>(InputJarArchive.java:573) at com.sun.enterprise.deployment.deploy.shared.InputJarArchive.createEntryEnumeration(InputJarArchive.java:451) at com.sun.enterprise.deployment.deploy.shared.InputJarArchive.entries(InputJarArchive.java:203) at com.sun.enterprise.deployment.deploy.shared.InputJarArchive.access$100(InputJarArchive.java:74) at com.sun.enterprise.deployment.deploy.shared.InputJarArchive$1.enumeration(InputJarArchive.java:166) at com.sun.enterprise.deployment.deploy.shared.InputJarArchive$CollectionWrappedEnumeration.<init>(InputJarArchive.java:724) at com.sun.enterprise.deployment.deploy.shared.InputJarArchive.getDirectories(InputJarArchive.java:161) at org.glassfish.javaee.full.deployment.EarDetector.isEARFromIntrospecting(EarDetector.java:142) at org.glassfish.javaee.full.deployment.EarDetector.handles(EarDetector.java:110) at com.sun.enterprise.v3.server.ApplicationLifecycle.getArchiveHandler(ApplicationLifecycle.java:211) at org.glassfish.deployment.admin.DeployCommand.preAuthorization(DeployCommand.java:246) ... 52 more ]]
        Hide
        Hari92 added a comment -

        C:\Soft64\glassfish-4.0\glassfish4\glassfish\bin>asadmin deploy --force=true C:\Users\HA288049\Desktop\recoengine\recoengine.war
        remote failure: Error during authorization
        java.lang.RuntimeException: java.lang.NullPointerException
        Command deploy failed.

        Show
        Hari92 added a comment - C:\Soft64\glassfish-4.0\glassfish4\glassfish\bin>asadmin deploy --force=true C:\Users\HA288049\Desktop\recoengine\recoengine.war remote failure: Error during authorization java.lang.RuntimeException: java.lang.NullPointerException Command deploy failed.

          People

          • Assignee:
            Tim Quinn
            Reporter:
            zhouronghui
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: