2 Replies Latest reply on Jun 17, 2011 6:11 PM by Piotr Nowicki

    LocalBean in JBoss 6 Remote cannot be resolved (@EJB)

    Piotr Nowicki Newbie

      Howdy!

       

      I've got some problem with injecting a LocalBean EJB using @EJB annotation. In other words, this is my EJB:

       

      {code:java}@LocalBean

      public class AnotherBean {

       

          public void testIt() {

          }

      }{code}

       

      and this is my TestCase:

       

      {code:java}@RunWith(Arquillian.class)

      public class PrintServiceTest {

       

          @EJB

          AnotherBean m;

       

          @Deployment

          public static JavaArchive deploy() {

              JavaArchive ar = ShrinkWrap.create(JavaArchive.class, "whatever.jar")

                      .addPackage(AnotherBean.class.getPackage());

       

              return ar;

          }

       

          @Test

          public void myTest() throws NamingException {

          }

      }{code}

       

      Both exist in the same package.

       

      The deployment fails because of the unsatisfied injection dependencies:

       

      DEPLOYMENTS IN ERROR:

      Deployment "vfs:///home/pedro/jboss-6.0.0.Final/server/default/deploy/test.war" is in error due to the following reason(s): java.lang.RuntimeException: Could not resolve @EJB reference: [EJB Reference: beanInterface 'pedro.test.service.AnotherBean', beanName 'null', mappedName 'null', lookupName 'null', owning unit 'AbstractVFSDeploymentContext@5866124{vfs:///home/pedro/jboss-6.0.0.Final/server/default/deploy/test.war}'] for environment entry: env/pedro.test.service.PrintServiceTest/m in unit AbstractVFSDeploymentContext@5866124{vfs:///home/pedro/jboss-6.0.0.Final/server/default/deploy/test.war}

       

      I use:

      arquillian-junit = 1.0.0.Alpha5

      arquillian-jbossas-remote-6 = 1.0.0.Alpha5

      jboss-as-client = 6.0.0.Final

       

      I read here that the LocalBean injection is supported in JBoss 6.0 Remote.

       

      Did I do something wrong or missed something?

       

      Thanks in advance!

       

      Pedro