1 Reply Latest reply on Jun 4, 2014 4:29 AM by jaikiran

    Remote call of EJB in an EAR-File does not work in Wildfly

    allvi

      I cannot call my EJBs which are part of an EAR-File in WildFly. In JBoss AS7 the same deployment structure worked. If I only deploy the EJB-Jar in WildFly as standalone Jar the remote calls works too.

      It also works if I call the EJBs locally from the WAR-Package which is also part of the EAR.

       

      The EJBs seems also deployed successfull:

       

      12:12:11,711 INFO  [org.jboss.as.ejb3.deployment.processors.EjbJndiBindingsDeploymentUnitProcessor] (MSC service thread 1-8) JNDI bindings for session bean

       

      named TestCalculatorBean in deployment unit subdeployment "MyConsultTestEJB.jar" of deployment "MyConsult.ear" are as follows:

       

          java:global/MyConsult/MyConsultTestEJB/TestCalculatorBean!consult.ejb.biz.RemoteTestCalculator

          java:app/MyConsultTestEJB/TestCalculatorBean!consult.ejb.biz.RemoteTestCalculator

          java:module/TestCalculatorBean!consult.ejb.biz.RemoteTestCalculator

          java:jboss/exported/MyConsult/MyConsultTestEJB/TestCalculatorBean!consult.ejb.biz.RemoteTestCalculator

          java:global/MyConsult/MyConsultTestEJB/TestCalculatorBean

          java:app/MyConsultTestEJB/TestCalculatorBean

          java:module/TestCalculatorBean

       

      My remote call looks as follow:

      return (RemoteTestCalculator) context.lookup("ejb:/MyConsult/MyConsultTestEJB/TestCalculatorBean!" + RemoteTestCalculator.class.getName());

       

      This call results in the following error message:

       

      - JBoss EJB Client version 2.0.0.Final

      Obtained a remote stateless calculator for invocation

      Adding 204 and 340 via the remote stateless calculator deployed on the server

      - XNIO version 3.2.0.Final

      - XNIO NIO Implementation Version 3.2.0.Final

      - JBoss Remoting version 4.0.0.Final

      - EJBCLIENT000017: Received server version 2 and marshalling strategies [river]

      - EJBCLIENT000013: Successful version handshake completed for receiver context EJBReceiverContext{clientContext=org.jboss.ejb.client.EJBClientContext@e07e154,

       

      receiver=Remoting connection EJB receiver [connection=org.jboss.ejb.client.remoting.ConnectionPool

       

      $PooledConnection@275a58fe,channel=jboss.ejb,nodename=alzhws26vmwin7]} on channel Channel ID fdc9b3d2 (outbound) of Remoting connection 3af5087d to

       

      localhost/127.0.0.1:8080

      java.lang.IllegalStateException: EJBCLIENT000025: No EJB receiver available for handling [appName:, moduleName:MyConsult,

       

      distinctName:MyConsultTestEJB] combination for invocation context org.jboss.ejb.client.EJBClientInvocationContext@65685e97

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

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

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

          at org.jboss.ejb.client.EJBInvocationHandler.sendRequestWithPossibleRetries(EJBInvocationHandler.java:253)

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

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

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

          at com.sun.proxy.$Proxy4.add(Unknown Source)

          at common.util.EJBClientTest.invokeStatelessBean(EJBClientTest.java:62)

          at common.util.EJBClientTest.test1(EJBClientTest.java:25)

          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

          at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

          at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

          at java.lang.reflect.Method.invoke(Unknown Source)

          at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)

          at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)

          at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)

          at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)

          at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)

          at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)

          at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)

          at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)

          at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)

          at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)

          at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)

          at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)

          at org.junit.runners.ParentRunner.run(ParentRunner.java:309)

          at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)

          at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)

          at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)

          at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)

          at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)

          at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)

      - EJBCLIENT000016: Channel Channel ID fdc9b3d2 (outbound) of Remoting connection 3af5087d to localhost/127.0.0.1:8080 can no longer process messages

       

      Unfortunately I cannot find such an example in https://github.com/wildfly/quickstart.

       

      Thank you in advance for your answer.

        • 1. Re: Remote call of EJB in an EAR-File does not work in Wildfly
          jaikiran

          Your JNDI lookup string is incorrect:

           

          My remote call looks as follow:

          return (RemoteTestCalculator) context.lookup("ejb:/MyConsult/MyConsultTestEJB/TestCalculatorBean!" + RemoteTestCalculator.class.getName());

           

          The syntax is ejb:<appname>/<modulename>/<distinctname>/<beanname>!<beaninterfacefullyqualifiedname>

           

          So it should be:

           

          "ejb:MyConsult/MyConsultTestEJB//TestCalculatorBean!" + RemoteTestCalculator.class.getName();