File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes EJB and other Java EE Technologies and the fly likes on ejbRemove() method... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "on ejbRemove() method..." Watch "on ejbRemove() method..." New topic

on ejbRemove() method...

Gurumurthy Ramamurthy
Ranch Hand

Joined: Feb 13, 2003
Posts: 273

I have a simple EJB bean class.

import javax.ejb.*;
public class HelloBean implements javax.ejb.SessionBean
private SessionContext ctx;

public void ejbCreate()

public void ejbRemove()

public void ejbActivate()

public void ejbPassivate()

public void setSessionContext(javax.ejb.SessionContext ctx)

public String hello()
System.out.println("Hello World EJB");
return "Hello World EJB return this time with SUNIL";

When I invoke my client, it displays the string from ejbCreate() but the string inside the ejbRemove() method is not at all called. WHY?

Maybach Smith

Joined: Dec 22, 2004
Posts: 15
In Session Beans,the ejbRemove() can be called by the container at any time.The bean could be returned back to the pooled state or it can be removed.This implementation would be container specific.

This has been clearly specified in Ed Roman as follows -
Note that some containers will give slightly different outputs than others - it is all implementation specific and is part of EJB product documentation.
We need to keep this in mind while debugging.

Hope this helps.

I agree. Here's the link:
subject: on ejbRemove() method...
It's not a secret anymore!