Uploaded image for project: 'EJB 3.0'
  1. EJB 3.0
  2. EJBTHREE-1858

NPE if in resource-env-ref no injection target is specified

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 1.1.9
    • 1.1.7
    • core
    • None

      If an ENC entry for java:/comp/EJBContext is declared and NO injection target is specified, this results in a NPE.

      <resource-env-ref>
      <resource-env-ref-name>EnvNameOfSessionContext</resource-env-ref-name>
      <resource-env-ref-type>javax.ejb.SessionContext</resource-env-ref-type>
      <mapped-name>java:comp/EJBContext</mapped-name>
      </resource-env-ref>

      The exception is:
      ...
      Caused by: java.lang.NullPointerException
      at org.jboss.injection.InjectionUtil.createInjectors(InjectionUtil.java:105)
      at org.jboss.injection.ResourceHandler.loadXmlResourceEnvRefs(ResourceHandler.java:227)
      at org.jboss.injection.ResourceHandler.loadXml(ResourceHandler.java:343)
      at org.jboss.ejb3.EJBContainer.processMetadata(EJBContainer.java:597)
      at org.jboss.ejb3.Ejb3Deployment.processEJBContainerMetadata(Ejb3Deployment.java:434)
      at org.jboss.ejb3.Ejb3Deployment.start(Ejb3Deployment.java:543)
      ... 69 more

      Looking at the code in ResourceHandler.loadXmlResourceEnvRefs, this is the only place where the check "if(envRef.getInjectionTargets() != null)" is missing .

      I will attach a sample.

            jaikiran Jaikiran Pai (Inactive)
            wolfgangknauf Wolfgang Knauf
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: