Win a copy of Head First Agile this week in the Agile forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Changes made in JNDI by servlet not seen in EJB  RSS feed

 
Ondrej Babuljak
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I guess this will be an easy question for most of you so sorry for bothering you with such a simple problem

The problem is:

In a servlet I bind a name to an object. Then I lookup the object in EJB. When I call the servlet another time I rebind the same name to another object. But when I lookup the object in the EJB again I get the object that I bound for the first time. However lookup in the servlet gives the object bound for the second time (which is the behaviour I would expect from the lookup in the EJB as well) An example is below.

This is a sample part of code from servlet (using String for illustration):


And this is a part of code from the EJB:


Calling the servlet for the first time with parameter a="Run1" will output lines:
From servlet: Run1
From ejb: Run1

Calling the servlet again with parameter a="Run2" will output lines:
From servlet: Run2
From ejb: Run1

Can anyone explain, why is the change not promoted to ejb?

Thanx a lot,
O.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!