glassfish
  1. glassfish
  2. GLASSFISH-18539

ConnectorDescriptor throws NPE for inbound-only resource adapter

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Duplicate
    • Affects Version/s: 3.1.2_b23
    • Fix Version/s: None
    • Component/s: jca
    • Labels:
      None
    • Environment:

      linux, sun java 1.6.0_26

      Description

      I'm using a self-developed inbound only resource adapter for connecting some POS terminals using iso8583 protocol directly to glassfish.

      If I try to inject a EJB SessionContext via @Resource annotation in my business code (ejb module), GF thrown a NPE at ConnectorDescriptor:647 while trying to access the outboundRA member of the connector. This member - of course - is null!

      ConnectorDescriptor.java
        /*
           * @param type The full qualified name for connection factory interface
           * @param useDefault This param is to support the backward compatibility
           *                   of connector 1.0 resource adapter where there is
           *                   only one connection factory type.  If type is null
           *                   and useDefault is true, the only CF will be returned.
           */
          public ConnectionDefDescriptor 
          getConnectionDefinitionByCFType (String type, boolean useDefault)
          {
              // ------------ here ----------------
              Iterator it = this.outboundRA.getConnectionDefs().iterator();
              while (it.hasNext())
              {
                  ConnectionDefDescriptor desc = (ConnectionDefDescriptor) it.next();
                  
                  if (type == null)
                  {
                      if (useDefault 
                              && this.outboundRA.getConnectionDefs().size() == 1)
                          return desc;
                      else
                          return null;
                  }
                          
                  if (desc.getConnectionFactoryIntf().equals(type))
                      return desc;
              }
              return null;
          }
      

        Activity

        Hide
        sahlix added a comment -

        In the meantime I detected that deployments not using the inbound-only reource adapter also fails when injecting the EJB session context with @Resource.

        Show
        sahlix added a comment - In the meantime I detected that deployments not using the inbound-only reource adapter also fails when injecting the EJB session context with @Resource.
        Hide
        sahlix added a comment -

        As a fix, I patched the class to check on outboundRA to be null:

        ConnectorDescriptor.java
        public ConnectionDefDescriptor 
        getConnectionDefinitionByCFType (String type, boolean useDefault)
        {
            if (this.outboundRA == null) {
                return null;
            }
            ...
        
        Show
        sahlix added a comment - As a fix, I patched the class to check on outboundRA to be null: ConnectorDescriptor.java public ConnectionDefDescriptor getConnectionDefinitionByCFType ( String type, boolean useDefault) { if ( this .outboundRA == null ) { return null ; } ...
        Hide
        sahlix added a comment - - edited

        Just for the sake of completeness, here is the stacktrace that is issued without the patch:

        [#|2012-06-13T09:20:13.726+0000|SEVERE|glassfish3.1.2|javax.enterprise.system.tools.admin.org.glassfish.deployment.admin|_ThreadID=32;_ThreadName=Thread-2;|Exception while deploying the app [xxxxxx] : nullat org.glassfish.apf.AnnotationInfo@5b21b804
        nullat org.glassfish.apf.AnnotationInfo@5b21b804
                at org.glassfish.apf.impl.AnnotationProcessorImpl.process(AnnotationProcessorImpl.java:367)
                at org.glassfish.apf.impl.AnnotationProcessorImpl.process(AnnotationProcessorImpl.java:375)
                at org.glassfish.apf.impl.AnnotationProcessorImpl.processAnnotations(AnnotationProcessorImpl.java:289)
                at org.glassfish.apf.impl.AnnotationProcessorImpl.processAnnotations(AnnotationProcessorImpl.java:271)
                at org.glassfish.apf.impl.AnnotationProcessorImpl.process(AnnotationProcessorImpl.java:199)
                at org.glassfish.apf.impl.AnnotationProcessorImpl.process(AnnotationProcessorImpl.java:134)
                at com.sun.enterprise.deployment.archivist.Archivist.processAnnotations(Archivist.java:598)
                at com.sun.enterprise.deployment.archivist.Archivist.readAnnotations(Archivist.java:442)
                at com.sun.enterprise.deployment.archivist.Archivist.readAnnotations(Archivist.java:429)
                at com.sun.enterprise.deployment.archivist.Archivist.readRestDeploymentDescriptors(Archivist.java:405)
                at com.sun.enterprise.deployment.archivist.Archivist.readDeploymentDescriptors(Archivist.java:380)
                at com.sun.enterprise.deployment.archivist.Archivist.open(Archivist.java:243)
                at com.sun.enterprise.deployment.archivist.Archivist.open(Archivist.java:252)
                at com.sun.enterprise.deployment.archivist.ApplicationArchivist.readModulesDescriptors(ApplicationArchivist.java:657)
                at com.sun.enterprise.deployment.archivist.ApplicationArchivist.openWith(ApplicationArchivist.java:258)
                at com.sun.enterprise.deployment.archivist.ApplicationFactory.openWith(ApplicationFactory.java:240)
                at org.glassfish.javaee.core.deployment.DolProvider.load(DolProvider.java:175)
                at org.glassfish.javaee.core.deployment.DolProvider.load(DolProvider.java:94)
                at com.sun.enterprise.v3.server.ApplicationLifecycle.loadDeployer(ApplicationLifecycle.java:827)
                at com.sun.enterprise.v3.server.ApplicationLifecycle.setupContainerInfos(ApplicationLifecycle.java:769)
                at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:368)
                at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:240)
                at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:389)
                at com.sun.enterprise.v3.admin.CommandRunnerImpl$1.execute(CommandRunnerImpl.java:348)
                at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:363)
                at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1085)
                at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1200(CommandRunnerImpl.java:95)
                at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1291)
                at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1259)
                at com.sun.enterprise.v3.admin.AdminAdapter.doCommand(AdminAdapter.java:461)
                at com.sun.enterprise.v3.admin.AdminAdapter.service(AdminAdapter.java:212)
                at com.sun.grizzly.tcp.http11.GrizzlyAdapter.service(GrizzlyAdapter.java:179)
                at com.sun.enterprise.v3.server.HK2Dispatcher.dispath(HK2Dispatcher.java:117)
                at com.sun.enterprise.v3.services.impl.ContainerMapper$Hk2DispatcherCallable.call(ContainerMapper.java:354)
                at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:195)
                at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:849)
                at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:746)
                at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1045)
                at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:228)
                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)
        Caused by: java.lang.NullPointerException
                at com.sun.enterprise.deployment.ConnectorDescriptor.getConnectionDefinitionByCFType(ConnectorDescriptor.java:647)
                at com.sun.enterprise.deployment.ConnectorDescriptor.getConnectionDefinitionByCFType(ConnectorDescriptor.java:634)
                at com.sun.enterprise.deployment.util.DOLUtils.isRAConnectionFactory(DOLUtils.java:170)
                at com.sun.enterprise.deployment.util.DOLUtils.isRAConnectionFactory(DOLUtils.java:157)
                at com.sun.enterprise.deployment.annotation.handlers.ResourceHandler.getDescriptors(ResourceHandler.java:315)
                at com.sun.enterprise.deployment.annotation.handlers.ResourceHandler.processResource(ResourceHandler.java:229)
                at com.sun.enterprise.deployment.annotation.handlers.ResourceHandler.processAnnotation(ResourceHandler.java:148)
                at com.sun.enterprise.deployment.annotation.handlers.AbstractResourceHandler.processAnnotation(AbstractResourceHandler.java:142)
                at org.glassfish.apf.impl.AnnotationProcessorImpl.process(AnnotationProcessorImpl.java:344)
                ... 48 more
        
        Show
        sahlix added a comment - - edited Just for the sake of completeness, here is the stacktrace that is issued without the patch: [#|2012-06-13T09:20:13.726+0000|SEVERE|glassfish3.1.2|javax.enterprise.system.tools.admin.org.glassfish.deployment.admin|_ThreadID=32;_ThreadName=Thread-2;|Exception while deploying the app [xxxxxx] : nullat org.glassfish.apf.AnnotationInfo@5b21b804 nullat org.glassfish.apf.AnnotationInfo@5b21b804 at org.glassfish.apf.impl.AnnotationProcessorImpl.process(AnnotationProcessorImpl.java:367) at org.glassfish.apf.impl.AnnotationProcessorImpl.process(AnnotationProcessorImpl.java:375) at org.glassfish.apf.impl.AnnotationProcessorImpl.processAnnotations(AnnotationProcessorImpl.java:289) at org.glassfish.apf.impl.AnnotationProcessorImpl.processAnnotations(AnnotationProcessorImpl.java:271) at org.glassfish.apf.impl.AnnotationProcessorImpl.process(AnnotationProcessorImpl.java:199) at org.glassfish.apf.impl.AnnotationProcessorImpl.process(AnnotationProcessorImpl.java:134) at com.sun.enterprise.deployment.archivist.Archivist.processAnnotations(Archivist.java:598) at com.sun.enterprise.deployment.archivist.Archivist.readAnnotations(Archivist.java:442) at com.sun.enterprise.deployment.archivist.Archivist.readAnnotations(Archivist.java:429) at com.sun.enterprise.deployment.archivist.Archivist.readRestDeploymentDescriptors(Archivist.java:405) at com.sun.enterprise.deployment.archivist.Archivist.readDeploymentDescriptors(Archivist.java:380) at com.sun.enterprise.deployment.archivist.Archivist.open(Archivist.java:243) at com.sun.enterprise.deployment.archivist.Archivist.open(Archivist.java:252) at com.sun.enterprise.deployment.archivist.ApplicationArchivist.readModulesDescriptors(ApplicationArchivist.java:657) at com.sun.enterprise.deployment.archivist.ApplicationArchivist.openWith(ApplicationArchivist.java:258) at com.sun.enterprise.deployment.archivist.ApplicationFactory.openWith(ApplicationFactory.java:240) at org.glassfish.javaee.core.deployment.DolProvider.load(DolProvider.java:175) at org.glassfish.javaee.core.deployment.DolProvider.load(DolProvider.java:94) at com.sun.enterprise.v3.server.ApplicationLifecycle.loadDeployer(ApplicationLifecycle.java:827) at com.sun.enterprise.v3.server.ApplicationLifecycle.setupContainerInfos(ApplicationLifecycle.java:769) at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:368) at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:240) at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:389) at com.sun.enterprise.v3.admin.CommandRunnerImpl$1.execute(CommandRunnerImpl.java:348) at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:363) at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1085) at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1200(CommandRunnerImpl.java:95) at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1291) at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1259) at com.sun.enterprise.v3.admin.AdminAdapter.doCommand(AdminAdapter.java:461) at com.sun.enterprise.v3.admin.AdminAdapter.service(AdminAdapter.java:212) at com.sun.grizzly.tcp.http11.GrizzlyAdapter.service(GrizzlyAdapter.java:179) at com.sun.enterprise.v3.server.HK2Dispatcher.dispath(HK2Dispatcher.java:117) at com.sun.enterprise.v3.services.impl.ContainerMapper$Hk2DispatcherCallable.call(ContainerMapper.java:354) at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:195) at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:849) at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:746) at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1045) at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:228) 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) Caused by: java.lang.NullPointerException at com.sun.enterprise.deployment.ConnectorDescriptor.getConnectionDefinitionByCFType(ConnectorDescriptor.java:647) at com.sun.enterprise.deployment.ConnectorDescriptor.getConnectionDefinitionByCFType(ConnectorDescriptor.java:634) at com.sun.enterprise.deployment.util.DOLUtils.isRAConnectionFactory(DOLUtils.java:170) at com.sun.enterprise.deployment.util.DOLUtils.isRAConnectionFactory(DOLUtils.java:157) at com.sun.enterprise.deployment.annotation.handlers.ResourceHandler.getDescriptors(ResourceHandler.java:315) at com.sun.enterprise.deployment.annotation.handlers.ResourceHandler.processResource(ResourceHandler.java:229) at com.sun.enterprise.deployment.annotation.handlers.ResourceHandler.processAnnotation(ResourceHandler.java:148) at com.sun.enterprise.deployment.annotation.handlers.AbstractResourceHandler.processAnnotation(AbstractResourceHandler.java:142) at org.glassfish.apf.impl.AnnotationProcessorImpl.process(AnnotationProcessorImpl.java:344) ... 48 more
        Hide
        Jagadish added a comment -

        Looks like the issue is fixed via :
        http://java.net/jira/browse/GLASSFISH-18741

        Show
        Jagadish added a comment - Looks like the issue is fixed via : http://java.net/jira/browse/GLASSFISH-18741
        Hide
        Jagadish added a comment -

        Closing as duplicate of GLASSFISH-18741

        Show
        Jagadish added a comment - Closing as duplicate of GLASSFISH-18741

          People

          • Assignee:
            Jagadish
            Reporter:
            sahlix
          • Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: