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

JNDI lookup fails for @EJB mappedName when the bean has more instances

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Critical Critical
    • None
    • None
    • None
    • None

      EJBs are not injected correctly to a test case if they come from different applications.
      For instance following code:

      @EJB(mappedName = "java:global/test-app1/HelloBean")
      private Hello hello1;
      
      @EJB(mappedName = "java:global/test-app2/HelloBean")
      private Hello hello2;
      
      @Deployment(name = "DEP1")
      public static JavaArchive deploymentApp1() throws IllegalArgumentException, IOException {
          return createJar("test-app1.jar");
      }
      
      @Deployment(name = "DEP2")
      public static JavaArchive deploymentApp2() throws IllegalArgumentException, IOException {
          return createJar("test-app2.jar");
      }
      
      @Test
      @OperateOnDeployment("DEP1")
      public void test1() throws Exception {
          assertNotNull(hello1);
      }
      
      @Test
      @OperateOnDeployment("DEP2")
      public void test2() throws Exception {
          assertNotNull(hello2);
      }
      

      Then one of the tests fails and one passes (sometime test1, sometime test2).

              Unassigned Unassigned
              josef.cacek@gmail.com Josef Cacek (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated: