1 Reply Latest reply on Oct 22, 2012 5:57 AM by Sven Plath

    "No EJB receiver available for handling" when invoking from a different thread

    Sven Plath Newbie

      Hi,

       

      I have the following environment:

       

      • JBoss AS 7.1.1.Final
      • Maven client project that uses jboss-as-ejb-client-bom version 7.1.1.Final as dependency
      • Maven server project that uses jboss-ejb-api_3.1_spec version 1.0.1.Final as dependency

       

      On the server, I have a EJB that i want to access from the client. I obtain the InitialContext on the client with the following properties:

      final Properties env = new Properties();
      env.put(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.naming.remote.client.InitialContextFactory");
      env.put(Context.PROVIDER_URL, "remote://localhost:4447");
      env.put(Context.SECURITY_PRINCIPAL, System.getProperty("username", "user"));
      env.put(Context.SECURITY_CREDENTIALS, System.getProperty("password", "pwd"));
      env.put(Context.URL_PKG_PREFIXES, "org.jboss.ejb.client.naming");
      env.put("jboss.naming.client.ejb.context", true);
      context = new InitialContext(env);
      

       

      The same thread that obtains the InitialContext can lookup the EJB interface and invoke the methods flawlessly. However, when I use the interfaces i looked up from a different thread, I get:

       

      Exception in thread "Thread-2" java.lang.IllegalStateException: No EJB receiver available for handling [appName:,modulename:***,distinctname:] combination for invocation context org.jboss.ejb.client.EJBClientInvocationContext@1884a40

          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 $Proxy3.heartbeat(Unknown Source)

          at ***(***.java:23)

          at java.lang.Thread.run(Thread.java:662)

       

      Details on the classes:

      • Singletong JndiConnection class obtains the InitialContext and does a lookup on all Interfaces. They are obtained without Exceptions.
      • Heartbeat class gets the singleton JndiConnection to obtain the heartbeat interface. Invocation of the method fails with the exception above.
      • I can invoke the heartbeat method from the JndiConnection class without problems.

       

      What can cause this behavior?

       

      Thanks,

      Sven