1 Reply Latest reply on Jun 3, 2016 9:08 AM by mariushoble

    cannot locate ejb when the ejb client app and wildfly10 server run on the same machine (it works from a remote machine)

    mariushoble

      I have the following scenario:

       

      1. a basic wildfly10 server installed on a windows machine under an administrator account with no firewall.

      2. I'm using standalone-full.xml as the configuration file and the public interface is bound to <any-address/>.

       

      3. an EAR archive that contains a stateless EJB2 is deployed on Wildfly10. The EJB has only 1 method that returns a string.

                When deployed,  the EJB is bound to:

                    java:jboss/exported/SimpleGreeterEARx/SimpleGreeterEJB2xx/TheGreeter!simple.greeter.ejb.Greeter

       

      4. as a client I'm using a standalone java application in which the jboss-ejb-client.properties (which is in the classpath and it is found by the client app)

      contains the following:

       

      remote.connections=default

      remote.connection.default.host=${server.ip}   <-- this could be 10.10.10.153 when the client runs from another machine, or localhost when the client is on the same machine (this comment is not part of the properties file )

      remote.connection.default.port=8080

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

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

       

      Comment: when the ejb client app runs from another machine, an existing wildfly user is used to connect.

       

      5. the ejb client app is very simple. A main method containing the following:

       

              String serviceName = "ejb:SimpleGreeterEARx/SimpleGreeterEJB2xx/TheGreeter!" + Greeter.class.getName();

              Properties prop = new Properties();

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

            

       

              try {

                  Context context = new InitialContext(prop);

                  Greeter service = (Greeter) context.lookup(serviceName);

                  String greeting = service.getGreeting();

       

                  System.out.println(greeting);

                  context.close();

              } catch (NamingException e) {

                ...

              } catch (RemoteException e) {

                ...

              }

       

       

      6. The serviceName string is correct due it it the same as the one listed in server.log when the ejb is deployed.

       

      7. The behavior is the following:

       

          7.1 when running the client from a different machine, the client can call the ejb and get the response form    service.getGreeting();  method.  (which returns a simple string)

       

          7.2 running the same ejb client app from the same machine where wildfly10 is installed , will throw this error  :

       

                     INFO: XNIO version 3.3.4.Final

                     Jun 02, 2016 11:53:25 AM org.xnio.nio.NioXnio <clinit>

                     INFO: XNIO NIO Implementation Version 3.3.4.Final

                     Jun 02, 2016 11:53:25 AM org.jboss.remoting3.EndpointImpl <clinit>

                     INFO: JBoss Remoting version 4.0.18.Final

                     Jun 02, 2016 11:53:31 AM org.jboss.ejb.client.remoting.ConfigBasedEJBClientContextSelector setupEJBReceivers

                     WARN: Could not register a EJB receiver for connection to 10.10.10.153:8080

                     java.lang.RuntimeException: Operation failed with status WAITING

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

                             at org.jboss.ejb.client.remoting.ConnectionPool.getConnection(ConnectionPool.java:80)

                             at org.jboss.ejb.client.remoting.RemotingConnectionManager.getConnection(RemotingConnectionManager.java:51)

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

                             at org.jboss.ejb.client.remoting.ConfigBasedEJBClientContextSelector.getCurrent(ConfigBasedEJBClientContextSelector.java:118)

                             at org.jboss.ejb.client.remoting.ConfigBasedEJBClientContextSelector.getCurrent(ConfigBasedEJBClientContextSelector.java:47)

                             at org.jboss.ejb.client.EJBClientContext.getCurrent(EJBClientContext.java:281)

                             at org.jboss.ejb.client.EJBClientContext.requireCurrent(EJBClientContext.java:291)

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

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

                            at com.sun.proxy.$Proxy0.getGreeting(Unknown Source)

                            at com.emh.client.remote.TestRemoteEJB.main(TestRemoteEJB.java:36)

       

                     Exception in thread "main" java.lang.IllegalStateException: EJBCLIENT000025: No EJB receiver available for handling [appName:SimpleGreeterEARx, moduleName:SimpleGreeterEJB2xx, distinctName:] combination ....

                     ClientInvocationContext@ff5b51f

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

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

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

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

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

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

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

                             at com.sun.proxy.$Proxy0.getGreeting(Unknown Source)

                             at com.emh.client.remote.TestRemoteEJB.main(TestRemoteEJB.java:36)

       

       

       

           6.3 The server.log contains only the following lines when the error is thrown :

       

                          2016-06-02 11:53:31,009 TRACE [io.undertow.request] (default I/O-2) Opened connection with /10.10.10.153:49393

                          2016-06-02 11:53:31,009 TRACE [io.undertow.server.HttpServerExchange] (default I/O-2) Starting to write response for HttpServerExchange{ GET / request {Connection=[upgrade], Sec-JbossRemoting-Key=[TJIa1uN8n5Qbm/dWRQyA1g==], Upgrade=[jboss-remoting],                          Host=[10.10.10.153:8080]} response {Connection=[Upgrade], Upgrade=[jboss-remoting], Sec-JbossRemoting-Accept=[YA8ZXHQHnIbYKOsoa2iaZg6eozQ=], Date=[Thu, 02 Jun 2016 15:53:31 GMT]}}

                          2016-06-02 11:53:31,009 TRACE [org.jboss.remoting.remote] (default I/O-2) Accepted connection from /10.10.10.153:49393 to ca-dev-dt37/10.10.10.153:8080

                          2016-06-02 11:53:31,009 TRACE [org.jboss.remoting.remote] (default I/O-2) Setting read listener to org.jboss.remoting3.remote.ServerConnectionOpenListener$Initial@36e27f90

                          2016-06-02 11:53:31,009 TRACE [org.jboss.remoting.remote.connection] (default I/O-2) Can't directly send message java.nio.DirectByteBuffer[pos=0 lim=14 cap=8192], enqueued

                          2016-06-02 11:53:31,009 TRACE [org.jboss.remoting.remote.connection] (default I/O-2) Sent message java.nio.DirectByteBuffer[pos=14 lim=14 cap=8192] (via queue)

                          2016-06-02 11:53:31,009 TRACE [org.jboss.remoting.remote.connection] (default I/O-2) Flushed channel

                          2016-06-02 11:53:36,048 TRACE [org.jboss.remoting.remote] (default I/O-6) Received connection end-of-stream

                          2016-06-02 11:53:36,048 TRACE [org.jboss.remoting.remote] (default I/O-2) Received connection end-of-stream