This week's book giveaway is in the Java in General forum.
We're giving away four copies of Event Streams in Action and have Alexander Dean & Valentin Crettaz on-line!
See this thread for details.
Win a copy of Event Streams in Action this week in the Java in General forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Knute Snortum
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Ron McLeod
  • Piet Souris
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Frits Walraven
  • Ganesh Patekar

problem when getting a remote stateless remote EJB in JBOSS

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

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

LibrarySessionBeanRemote.java


LibrarySessionBean.java



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:


I don't understand why there is an error

Thank you in advance for your answers
 
Sheriff
Posts: 10445
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!