5 Replies Latest reply on Aug 30, 2012 6:21 AM by xin.zhang.song

    Remote EJB lookup issue with JBoss AS 7.1.1

    mylos78

      Hi all !

      I have a CDI based application which uses a SLSB to persist data. 

       

      @Stateless

      @Remote(RequestRegistrationRemote.class)

      public class RequestRegistration implements RequestRegistrationRemote  {

       

          @Inject

          private EntityManager em;

       

          public void save() { ... }

      }

       

       

      The EJB is packed in a Web application named Telco.war

      Unfortunately EJB lookup fails:

       

      final Hashtable props = new Hashtable();

      props.put(Context.URL_PKG_PREFIXES, "org.jboss.ejb.client.naming");

      Context context = new InitialContext(props);

       

      RequestRegistrationRemote remote=(RequestRegistrationRemote)context.lookup("ejb:Telco/RequestRegistration!com.telco.service.RequestRegistrationRemote");

       

      Exception in thread "main" java.lang.ClassCastException: org.jboss.ejb.client.naming.ejb.EjbNamingContext cannot be cast to com.telco.service.RequestRegistrationRemote

          at com.telco.client.TestClient.main(TestClient.java:43)

       

      On the other hand, changing the lookup String to the following (double slashes after ejb name)

       

      RequestRegistrationRemote remote=(RequestRegistrationRemote)context.lookup("ejb:Telco//RequestRegistration!com.telco.service.RequestRegistrationRemote");

       

      produces the following error:

       

      WARN: Could not register a EJB receiver for connection to remote://localhost:4447

      java.lang.RuntimeException: Operation failed with status WAITING

          at org.jboss.ejb.client.remoting.IoFutureHelper.get(IoFutureHelper.java:93)

          at org.jboss.ejb.client.remoting.ConfigBasedEJBClientContextSelector.setupEJBReceivers(ConfigBasedEJBClientContextSelector.java:121)

          at org.jboss.ejb.client.remoting.ConfigBasedEJBClientContextSelector.<init>(ConfigBasedEJBClientContextSelector.java:78)

          at org.jboss.ejb.client.EJBClientContext.<clinit>(EJBClientContext.java:77)

          at org.jboss.ejb.client.EJBInvocationHandler.doInvoke(EJBInvocationHandler.java:120)

          at org.jboss.ejb.client.EJBInvocationHandler.invoke(EJBInvocationHandler.java:104)

          at $Proxy0.register(Unknown Source)

          at com.telco.client.TestClient.main(TestClient.java:46)

      Exception in thread "main" java.lang.IllegalStateException: No EJB receiver available for handling [appName:Telco,modulename:,distinctname:] combination for invocation context org.jboss.ejb.client.EJBClientInvocationContext@152513a

          at org.jboss.ejb.client.EJBClientContext.requireEJBReceiver(EJBClientContext.java:584)

          at org.jboss.ejb.client.ReceiverInterceptor.handleInvocation(ReceiverInterceptor.java:119)

          at org.jboss.ejb.client.EJBClientInvocationContext.sendRequest(EJBClientInvocationContext.java:181)

          at org.jboss.ejb.client.EJBInvocationHandler.doInvoke(EJBInvocationHandler.java:136)

          at org.jboss.ejb.client.EJBInvocationHandler.doInvoke(EJBInvocationHandler.java:121)

          at org.jboss.ejb.client.EJBInvocationHandler.invoke(EJBInvocationHandler.java:104)

          at $Proxy0.register(Unknown Source)

          at com.telco.client.TestClient.main(TestClient.java:46)

       

      I got a bit stuck on this :-( everything else seems in the right place, including the jboss-ejb-client.properties file.

       

      remote.connectionprovider.create.options.org.xnio.Options.SSL_ENABLED=false

      remote.connections=default

      remote.connection.default.host=localhost

      remote.connection.default.port=4447

      remote.connection.default.connect.options.org.xnio.Options.SASL_POLICY_NOANONYMOUS=false

       

      Any idea how to solve this issue ?

      thanks a lot

      Mylos