2 Replies Latest reply on Jul 18, 2012 9:08 PM by gaohoward

    "No EJB receiver available for handling" error in EJB test against AS 7.1.1 with Arquillian

    gaohoward

      Hi guys,

       

      I have a simple Arquillian test that deploys a simple EJB to AS 7.1.1.Final and then invokes that EJB's only method. The following is the method that does the deployment:

       

         @Deployment

         public static Archive getDeployment()

         {

       

            final JavaArchive ejbJar = ShrinkWrap.create(JavaArchive.class, "ejb.jar");

            ejbJar.addClass(SendMessageBean.class);

            ejbJar.addClass(SendMessageService.class);

            System.out.println(ejbJar.toString(true));

            return ejbJar;

         }

       

      The SendMessageBean is a simple EJB that implements SendMessageService's only method sendAndUpdate:

       

      @Stateless

      @Remote(SendMessageService.class)

      public class SendMessageBean implements SendMessageService

      {

       

         public void sendAndUpdate(final String text) throws Exception

         {

         }

      }

       

      When the ejb has been deployed, the test look up the ejb and invoke the method, like:

       

               final Properties env = new Properties();

               env.put(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.naming.remote.client.InitialContextFactory");

               env.put(Context.PROVIDER_URL, "remote://localhost:4447");

               env.put(Context.SECURITY_PRINCIPAL, "guest");

               env.put(Context.SECURITY_CREDENTIALS, "password");

       

               initialContext = new InitialContext(env);

               SendMessageService service = (SendMessageService)initialContext.lookup("java:ejb/SendMessageBean!org.hornetq.javaee.example.server.SendMessageService");

       

               service.sendAndUpdate("This is a text message");

       

      The JNDI lookup is successful. However when it calls sendAndUpdate("This is a text message") it gets an error like:

       

      runExample(org.hornetq.javaee.examples.MDBEJBTXRequiredRunnerTest): No EJB receiver available for handling [appName:,modulename:ejb,distinctname:] combination

       

      I have no idea why there is no ejb receiver. I'm asking for some advice on this.

       

      I give my test here for you to verify. To run the test you need first set JBOSS_HOME to AS7 installation and then run 'mvn test'.

       

      Thanks

      Howard