• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

problem when getting a remote stateless remote EJB in JBOSS

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
reply
    Bookmark Topic Watch Topic
  • New Topic