0 Replies Latest reply on Aug 22, 2014 6:50 AM by Nicky Mølholm

    Remote Wildfly EJB client ( magic vs meaningful error messages )

    Nicky Mølholm Newbie



      Firstly, I am a huge fan of Wildfly.


      But I reckon places where logging (or feedback in terms of Exceptions) can be improved slightly.


      Take for example the process of connecting a remote EJB client to an EJB running in Wildfly 8.1.0.Final. I recently decided to try that. But it wasn't super easy, actually. I got this exception:


      11:17:28,558 INFO  [HelloClient] Application started
      11:17:28,567 INFO  [HelloClient] Creating JNDI context. For url=http-remoting://localhost:8080 [user=hello]
      11:17:28,792 INFO  [HelloClient] Finding EJB. JNDI name=hello-ejb-1.0-SNAPSHOT/HelloBean!hello.HelloRemote
      11:17:29,233 INFO  [HelloClient] Invoking sayHello() on EJB
      Exception in thread "main" java.lang.IllegalStateException: EJBCLIENT000025: No EJB receiver available for handling [appName:, moduleName:hello-ejb-1.0-SNAPSHOT, distinctName:] combination for invocation context org.jboss.ejb.client.EJBClientInvocationContext@4bf6ba9
          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:186)
          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.$Proxy0.sayHello(Unknown Source)
          at hello.HelloClient.invokeEjbMethod(HelloClient.java:72)
          at hello.HelloClient.main(HelloClient.java:23)

      On the server - there wasn't any ERROR reporting at all (nor WARNINGS). Perhaps a TRACE line could have helped me a bit. But play a long with me...


      It turned out that I forgot to add this magic property to my InitialContext bootstrapping: jboss.naming.client.ejb.context=true


      And suddenly it worked.


      So there could a few focus areas here to improve the situation, for example:

      - Given the 'sayHello' invocation through a dynamic proxy - perhaps the client runtime could infer that the above configuration (client.ejb.context) would be implied ? Perhaps it could just state that, in the context of the EJB invocation, the property was missing?

      - Let the server side callstack do some logging. That would be really appropriate. Surely it must send back a reply to the client-stack telling it that there wasn't "any EJB receiver" - so perhaps it could dump an error. I reckon that the error was that of the clients (as she didn't send the correct request) - but still, everything apart: it would be nice to know why the server sends this answer to the client runtime.


      So the above is just a subject of "discussion". Have you ever had similar problems connecting remote EJB clients to @Remote EJBs in wildfly?