Hello,
I have a simple web service -> stateless session bean class where I expect the "ejbCreate()" and "ejbRemove()" javax.ejb.SessionBean methods to be invoked as well as the business method. The code is:
[code]
package foo.bar;
import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebService;
import javax.ejb.Stateless;
import java.util.logging.Logger;
/**
*
*/
@WebService()
@Stateless()
public class Bounce {
private static final Logger LOG =
Logger.getLogger("foo.bar.Bounce");
/**
* Web service operation
*/
@WebMethod(operationName = "reply")
public String reply(@WebParam(name = "message") String message) {
LOG.info("XXX: reply(" + message + ")");
return ("Reply: " + message);
}
public void ejbCreate() {
LOG.info("XXX: ejbCreate()");
}
public void ejbRemove() {
LOG.info("XXX: ejbRemove()");
}
}
[/code]
In the server log, I only see the following when testing the web service client through the admin UI:
[code]
[#|2008-03-10T16:51:09.219-0600|INFO|sun-appserver9.1|foo.bar.Bounce|_ThreadID=16;_ThreadName=httpSSLWorkerThread-8080-1;|XXX: ejbCreate()|#]
[#|2008-03-10T16:51:09.227-0600|INFO|sun-appserver9.1|foo.bar.Bounce|_ThreadID=16;_ThreadName=httpSSLWorkerThread-8080-1;|XXX: reply(Message in a bottle.)|#]
[/code]
I never see the "ebjRemove()" method invoked when disabling the EJB module, undeploying the EJB Module, or shutting the AS instance down.
I'm basically just trying to manage an instance variable (ehcache) that should live only as long as the SessionBean.
Thanks,
John
PS: @PostConstruct and @PreDestroy don't exhibit exactly the same behavior I would expect from "ejbCreate()" and "ejbRemove()".
[Message sent by forum member 'da3m0npr0c3ss' (da3m0npr0c3ss)]
http://forums.java.net/jive/thread.jspa?messageID=263257