This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
The moose likes EJB and other Java EE Technologies and the fly likes New EJB Instance Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "New EJB Instance" Watch "New EJB Instance" New topic
Author

New EJB Instance

Jeff Storey
Ranch Hand

Joined: Oct 09, 2006
Posts: 118
Hi everyone. I have a problem where I'm trying to get a new instance of a stateful bean. The situation is that I have Bean A doing some processing that I want to cancel. Rather than trying to stop it in its tracks, I simply give the client program a new copy of that bean, call it Bean B. The client now listens to messages sent from Bean B, and is unaware that Bean A is still finishing its server side processing (at which point it will no longer be used).

I try to lookup the bean with
Object ref = jndiContext.look("MyBeanClassImpl/remote");
MyBeanClass b = (MyBeanClass) PortableRemoteObject.narrow(ref,MyBeanClass.class)

When I do an == comparison on Bean A and Bean B, it returns true and then I get errors about concurrent calls on the bean. Essentially, the users reference to the MyBeanClass object should now be pointing to B, which should be different than A. Can someone explain to me why it is not different and how I can make it be different?

Thank you,
Jeff
Jeff Storey
Ranch Hand

Joined: Oct 09, 2006
Posts: 118
I realized this was NOT what was happening and the problem was elsewhere - problem solved.
 
wood burning stoves
 
subject: New EJB Instance