0 Replies Latest reply on Sep 11, 2012 7:32 AM by Jean-Pierre van Zyl

    Jboss 7.1.1 Problem calling remote EJB's - java.lang.IllegalStateException: No EJB receiver available for handling

    Jean-Pierre van Zyl Newbie

      I am trying to call an EJB remotely, but I always end up with the No EJB receiver available for handling

      I have two sets of code.

      The first is the front end, and the second server side.

      This is what the servers sides code looks like

       

      package cemsfacade.ejb.session.test;

      import ...

      @Stateless

      @Remote(TestBeanRemote.class)

      @EJB(beanInterface=TestBeanRemote.class, name="TestBean")

      public class TestBean implements TestBeanRemote {

        @Override

                public int doSomething() {

          return 10;

                }

      }

       

      On the server side, I have done the /jboss/bin/add-user.sh

       

      On the client side, I have the following code

       

      private void doRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

                try {

                          TestBeanRemote tbr = doGet();

                          int value = tbr.doSomething();

                } catch (NamingException e) {

                          e.printStackTrace();

                }

      }

       

      public TestBeanRemote doGet() throws NamingException{

                //setting all the properties

                Properties env = new Properties();

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

                env.put(Context.PROVIDER_URL, "remote://192.168.8.3:4747");

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

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

                env.put("jboss.naming.client.ejb.context", true);

                env.put("remote.connections", "default");

                Context context = null;

                TestBeanRemote tbr = null;

                context = new InitialContext(env);

                String appName = "CEMSear-application-0.0.1-SNAPSHOT";

                String moduleName = "CEMSfacade-0.0.1-SNAPSHOT";

                String distinctName = "TestBean";

                String fullyQualifiedClassName = "cemsfacade.ejb.session.test.TestBeanRemote";

                String testBean = "ejb:" + appName + "/" + moduleName + "//" + distinctName + "!" + fullyQualifiedClassName;

                Object obj = context.lookup(testBean);

                tbr = (TestBeanRemote)obj;

                int something = tbr.doSomething();

                return tbr;

      }

       

      I have jboss-ejb-client.xml in the web-inf folder.

       

      <jboss-ejb-client xmlns="urn:jboss:ejb-client:1.0">

          <client-context>

              <ejb-receivers>

                  <remoting-ejb-receiver outbound-connection-ref="remote-ejb-connection"/>

              </ejb-receivers>

          </client-context>

      </jboss-ejb-client>

       

      I have a file called jboss-ejb-client.properties

       

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

      remote.connections=default

      remote.connection.default.host=192.168.8.3

      remote.connection.default.port=4747

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

      remote.connection.default.username=ejb

      remote.connection.default.password=test

       

      I have also exported the classpath

      export CLASSPATH=$CLASSPATH:/opt/cems/jboss7/standalone/jboss-ejb-client.properties

       

      The EJB

       

      package cemsfacade.ejb.session.test;

        public interface TestBeanRemote {

                int doSomething();

      }

       

      Everytime that I run the code, I get the following error message

       

      11:17:47,437 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/cems].[CEMSController]] (http--0.0.0.0-8380-1) Servlet.service() for servlet CEMSController threw exception: java.lang.IllegalStateException: No EJB receiver available for handling [appName:CEMSear-application-0.0.1-SNAPSHOT,modulename:CEMSfacade-0.0.1-SNAPSHOT,distinctname:] combination for invocation context org.jboss.ejb.client.EJBClientInvocationContext@6412ffaa

              at org.jboss.ejb.client.EJBClientContext.requireEJBReceiver(EJBClientContext.java:584) [jboss-ejb-client-1.0.5.Final.jar:1.0.5.Final]

              at org.jboss.ejb.client.ReceiverInterceptor.handleInvocation(ReceiverInterceptor.java:119) [jboss-ejb-client-1.0.5.Final.jar:1.0.5.Final]

              at org.jboss.ejb.client.EJBClientInvocationContext.sendRequest(EJBClientInvocationContext.java:181) [jboss-ejb-client-1.0.5.Final.jar:1.0.5.Final]

              at org.jboss.ejb.client.EJBInvocationHandler.doInvoke(EJBInvocationHandler.java:136) [jboss-ejb-client-1.0.5.Final.jar:1.0.5.Final]

              at org.jboss.ejb.client.EJBInvocationHandler.doInvoke(EJBInvocationHandler.java:121) [jboss-ejb-client-1.0.5.Final.jar:1.0.5.Final]

              at org.jboss.ejb.client.EJBInvocationHandler.invoke(EJBInvocationHandler.java:104) [jboss-ejb-client-1.0.5.Final.jar:1.0.5.Final]

              at $Proxy55.doSomething(Unknown Source) at cemssite.server.services.CEMSController.doGet(CEMSController.java:125) [classes:]

              at cemssite.server.services.CEMSController.doRequest(CEMSController.java:71) [classes:]

      ...

      Does anybody know why this is happening?