Uploaded image for project: 'Arquillian'
  1. Arquillian
  2. ARQ-543

CDI injection into testcase does not work on GlassFish

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Blocker
    • Resolution: Done
    • Affects Version/s: glassfish_1.0.0.CR1
    • Fix Version/s: glassfish_1.0.0.CR2
    • Component/s: GlassFish Containers
    • Labels:
      None
    • Environment:
      arquillian-glassfish-remote-3.1 - 1.0.0.CR1, 1.0.0.Final-SNAPSHOT
      arquillian-core-impl-base - 1.0.0.CR1
      GlassFish 3.1.1
    • Affects:
      Release Notes

      Description

      Having the following testcase:

      @RunWith(Arquillian.class)
      public class FooTest {
       
          @Inject
          private Foo foo;
       
          @Deployment
          public static JavaArchive deploy() {
              return ShrinkWrap.create(JavaArchive.class, "foo.jar").addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml")
                      .addClasses(Foo.class, FooTest.class);
          }
       
          @Test
          public void test() {
              Assert.assertNotNull(foo);
          }
      }
       
      public class Foo {
      }
      

      the test always fails on Glassfish while it works fine on JBoss AS 7.

        Gliffy Diagrams

          Activity

          Hide
          aslak Aslak Knutsen added a comment -

          Which GlassFish container type, remote or embedded ? Which GlassFish version?

          Using GlassFish Container 1.0.0.CR1-SNAPSHOT ?
          Using Arq Core 1.0.0.CR1 ?

          Show
          aslak Aslak Knutsen added a comment - Which GlassFish container type, remote or embedded ? Which GlassFish version? Using GlassFish Container 1.0.0.CR1-SNAPSHOT ? Using Arq Core 1.0.0.CR1 ?
          Hide
          jharting Jozef Hartinger added a comment -

          More info added.

          Show
          jharting Jozef Hartinger added a comment - More info added.
          Hide
          aslak Aslak Knutsen added a comment -

          The GlassFish container is missing the dep on arquillian-testenricher-initialcontext module which provides the InitialContext for the CDI Enricher to lookup BeanManager.

          Show
          aslak Aslak Knutsen added a comment - The GlassFish container is missing the dep on arquillian-testenricher-initialcontext module which provides the InitialContext for the CDI Enricher to lookup BeanManager.
          Hide
          aslak Aslak Knutsen added a comment -

          pushed upstream

          Show
          aslak Aslak Knutsen added a comment - pushed upstream
          Hide
          jharting Jozef Hartinger added a comment -

          Verified on upstream.

          Show
          jharting Jozef Hartinger added a comment - Verified on upstream.

            People

            • Assignee:
              aslak Aslak Knutsen
              Reporter:
              jharting Jozef Hartinger
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development