I work with eclipse LUNA et created a project Entreprise Application Project. I added a server JBOSS eap 6.2
Here is the structure of my project (by the way how you attach a local image from a MAC computer ? file//... ?)
I created a remote EJB stateless in a module EJBTutorialEJB
In the module EJBTutorialClient, I created a Main class that look up that EJB remote stateless
When I do a "run as Java Application" on my Main class, I have several unexpected behavior
Here is what is in console
1) First I enter two books: "La source et le delta" and "Struts"
When I choose Exit afterwards there is an expected behavior at the beginning
Untill now everything is correct
But afterwards I have
And now it doen't go the right way because this list is obtained by a new lookup (LibrarySessionBeanRemote libraryBean1 = (LibrarySessionBeanRemote) ctx.lookup("EJBTutorial/EJBTutorialEJB//LibrarySessionBean!"+ viewClassName);)
As I have a stateless remote Bean, the list of the two books that I entered before should not be stored and found by this new lookup. By the way (I would say yes) : when you make a lookup, does it create a new session ?
2) secondly: when I try to close my context (in blue at the end of the Main class), I get the following error:
In case of stateless EJBs, there is no guarantee of the state being stored within the stateless bean instance between multiple business calls. However, if the server ends up choosing the same (pooled) EJB instance for each of these business calls, then you can see this behaviour. You can't and shouldn't rely on the state of the stateless EJBs.
P.S: In WildFly 8 (JBoss AS community edition is renamed to WildFly) pooling of stateless EJBs is disabled by default, so you wouldn't see this behaviour there.