3 Replies Latest reply on Nov 25, 2014 11:28 AM by Wolf-Dieter Fink

    Remote EJB Proxy seems to be thread releated (No EJB receiver available for handling)

    tibu Newbie



      We are currently migrating an application from AS6 to AS7.2. In our remote clients we used a tool class with static methods to lookup EJB proxies. The class keeps the InitialContext used for the lookups in a static field and thus always uses the same context, no matter who calls the lookup method. Each client has a UIThread, on which most of the operations run.


      Now with JBoss 7 this leads to problems, which indicate, that the EJB proxy only works in the same thread that created the InitialContext used for lookup. In other cases the InitialContext returns a proxy on lookup(), but if we try to call a method on that proxy, we get the dreaded java.lang.IllegalStateException: No EJB receiver available for handling.


      This behavior leads to some (manageable) complications in our client logic. We now have to keep an InitialContext object for every running UIThread, where we were able to do all lookups with our static methods before. The context is closed, once the client exits. In background jobs we now create a new InitialContext for every remote invocation and close it when the job finishes.


      Can somebody please confirm, that our observations are correct and that this is the desired behavior?