glassfish
  1. glassfish
  2. GLASSFISH-11653

WAR packaging, CDI lookup of JPA unit fails when in separate jars

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Blocker Blocker
    • Resolution: Fixed
    • Affects Version/s: V3
    • Fix Version/s: 3.1
    • Component/s: cdi
    • Labels:
      None
    • Environment:

      Operating System: All
      Platform: All

    • Issuezilla Id:
      11,653

      Description

      I have 3 modules:
      1. JPA module
      2. EJB module with META-INF/beans.xml, with 2 EJBs: one uses @Inject to inject
      EntityManager to an EJB, another using @PersistentContext; there is a class with
      a producer field annotated @Produces @PersistentContext to adapt 'old-style'
      resource injection to CDI
      3. webapp that bundles the modules in WEB-INF/lib as siblings, and contains a
      servlet that uses EJBs from module #2, injected by @EJB

      Invoking the bean that uses @Inject to inject EntityManager results in this at
      runtime:

      org.jboss.weld.NullInstanceException: WELD-000044 Unable to obtain instance from
      org.jboss.weld.bean-/home/rafal/Apps/glassfishv3/glassfish/domains/domain1/applications/TestWEB/-ProducerField-com.test.ejb.EntityManagerProducer.entityManager

      Sibling EJB in module #2 that uses @PersistenceContext for injection works fine,
      so the JPA unit is deployed correctly and can be found.

      When all classes / resources are packaged inside WEB-INF/classes, all works
      fine. However, this puts big restrictions on application packaging and doesn't
      support what the specs mandates (CDI and JPA modules within WEB-INF/lib of a WAR).

      Setting this to P1 as this prevents us from packaging and deploying the
      application using the new WAR deployment.

      A post about the issue can be found here:
      http://forums.java.net/jive/thread.jspa?threadID=75932&tstart=75

      1. web-descriptor-combine-patch.diff
        5 kB
        Sivakumar Thyagarajan

        Activity

        Hide
        szczyp added a comment -

        Hi. Thank you for looking into this.
        I downloaded, however, glassgish 3.0.1.snapshot from here:
        http://dlc.sun.com.edgesuite.net/glassfish/v3.0.1/nightly/glassfish-3.0.1-b19-05_21_2010.zip
        dating to May 21., but this build was created after the comment about fixing the
        issue (right after I read the comment I wanted to test it and the last build was
        May 2., so it wasn't there yet.
        Is it supposed to work in the snapshot already?

        Show
        szczyp added a comment - Hi. Thank you for looking into this. I downloaded, however, glassgish 3.0.1.snapshot from here: http://dlc.sun.com.edgesuite.net/glassfish/v3.0.1/nightly/glassfish-3.0.1-b19-05_21_2010.zip dating to May 21., but this build was created after the comment about fixing the issue (right after I read the comment I wanted to test it and the last build was May 2., so it wasn't there yet. Is it supposed to work in the snapshot already?
        Hide
        szczyp added a comment -

        I meant to say that right after the comment the latest build was May 20., so May
        21. was created after the comment. Sorry for the typo.

        Show
        szczyp added a comment - I meant to say that right after the comment the latest build was May 20., so May 21. was created after the comment. Sorry for the typo.
        Hide
        Sivakumar Thyagarajan added a comment -

        szczyp: Please use Sunday's nightly for verifying the fix. I had checked in the
        fix into the trunk and the 3.0.1 branch only today [commit revisions 37186 and
        37185]. If you want a fix earlier than that, you can apply the patch or check
        out latest workspace and build. Hope this helps.

        Closing this issue as fixed as we checked in the patch as part of commit
        revisions 37186 and 37185.

        Show
        Sivakumar Thyagarajan added a comment - szczyp: Please use Sunday's nightly for verifying the fix. I had checked in the fix into the trunk and the 3.0.1 branch only today [commit revisions 37186 and 37185]. If you want a fix earlier than that, you can apply the patch or check out latest workspace and build. Hope this helps. Closing this issue as fixed as we checked in the patch as part of commit revisions 37186 and 37185.
        Hide
        szczyp added a comment -

        I tested it today and it works fine with the build from 25.05.
        Thanks for the effort to fix it.

        Show
        szczyp added a comment - I tested it today and it works fine with the build from 25.05. Thanks for the effort to fix it.
        Hide
        Sivakumar Thyagarajan added a comment -
            • Issue 11640 has been marked as a duplicate of this issue. ***
        Show
        Sivakumar Thyagarajan added a comment - Issue 11640 has been marked as a duplicate of this issue. ***

          People

          • Assignee:
            Sivakumar Thyagarajan
            Reporter:
            szczyp
          • Votes:
            2 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: