I have a similar problem with JBoss 5.0.1 GA. I have one SFSB (which holds some data) with only local business interface . And several SLSBs with remote interfaces. All SLSBs inject the SFSB using @EJB. I have a standalone Swing client accessing the SLBS. I have observed that:
- Each SLSB inject new SFSB although the session is the same.
- When the session is removed (by a business method marked as @Remove), the next call to a SLBS throws "javax.ejb.NoSuchEJBException: Could not find stateful bean: all5z-81lkw2-ftl86qub-1-ftl9srgf-a0". I suspect (like the previous post), that @EJB is not refreshed each time the SLBS is called, but only when it is created.
Is this a normal behaviour or a bug?
Hmm, I have changed my all SLSBs info SFSBs, but it didn't help my problem. If fact, I need something like http session, but for session beans called from Swing client. I.e. the client calls a several session bean, they gets some object which are related to this client (a quick operation) and then make some lengthy operation, like accessing DB or the local filesystem.
Yes, if I will have just one SFSB, then it would work for me. However, I'd like to have more remote interfaces just to have the code logically separated, since I have a quite few business methods to call.
Thanks for any help
Just a possibility to get rid of this problem could be to transfer the session informations between the client and server (like cookies). If this would be to big, you can also maintain all session information on the server side (database) and just transfer the session id.
We are using the second approach where the client sends with every request his session id to the server. This can be done by facading the already written ejb's with another ejb but needs change in every server request at client side.
Hope this helps in a way.
Well, then I do not see, why SFSBs exists. I have hoped they can do this for me.
I fact, when I use just one SFSB, then it works fine, just I have many methods there and sometimes ugly names like getCountForAAA(), getCountForBBB(). I still cannot believe there is not any nice easy way how to break my code into more objects :-)