Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Calling remove() if bean is already deleted

2 views
Skip to first unread message

Jamie Tsao

unread,
Jan 3, 2002, 4:51:02 PM1/3/02
to
Our logout() code essentially removes a stateful bean by calling the
remove() method like so:

public void logout(Handle handle)
{
ClientSession clientSession = (ClientSession) handle.getEJBObject();
(1)
clientSession.remove(); (2)
}

What if someone calls logout again (don't ask why) ? Currently, the code
bombs at the line (2) with the follwing exception:

<Jan 3, 2002 1:42:23 PM PST> <Info> <EJB> <EJB Exception in method: remove:
java
.rmi.NoSuchObjectException: Bean has been deleted.
java.rmi.NoSuchObjectException: Bean has been deleted.
at weblogic.ejb20.swap.DiskSwap.read(DiskSwap.java:156)
at
weblogic.ejb20.manager.StatefulSessionManager.getBean(StatefulSession
Manager.java:242)
at
weblogic.ejb20.manager.StatefulSessionManager.preInvoke(StatefulSessi
onManager.java:313)
at
weblogic.ejb20.manager.StatefulSessionManager.remove(StatefulSessionM
anager.java:754)
at
weblogic.ejb20.internal.StatefulEJBObject.remove(StatefulEJBObject.ja
va:86)
at
com.atinera.clientsession.ejb.ClientSessionEJB_i1eggl_EOImpl.remove(C
lientSessionEJB_i1eggl_EOImpl.java:468)
at com.atinera.business.login.ejb.LoginEJB.logout(LoginEJB.java:121)


My questions:

1) Why doesn't the code bomb at line (1); shouldn't that call give me the
exception ?
2) How do I work around this ? I tried catching the exception, but it
doesn't work, because it appears that the exception occurs "inside" the
remove() call.

Thanks

Jamie Tsao

unread,
Jan 3, 2002, 4:54:18 PM1/3/02
to
By the way, I'm using weblogic 6.1 on Win2K

"Jamie Tsao" <jt...@atinera.com> wrote in message
news:3c34d239$1...@newsgroups.bea.com...

Rob Woollen

unread,
Jan 3, 2002, 6:18:53 PM1/3/02
to
Jamie Tsao wrote:

Handle.getEJBObject() doesn't verify that the underlying bean instance actually
exists. This would require a database read for entity beans and (possibly) a
disk read for stateful session beans so it's avoided.

We won't attempt to find the instance until you actually call a method on it.

>
> 2) How do I work around this ? I tried catching the exception, but it
> doesn't work, because it appears that the exception occurs "inside" the
> remove() call.

You can catch java.rmi.NoSuchObjectException

-- Rob

>
>
> Thanks

0 new messages