access to other ejb in preDestroy of Singleton causes Component is stopped
inet_gbo Jan 10, 2012 2:49 AMHi,
I'm using jboss 7.0.2.
When I try to access a stateless ejb in preDestroy method of Singleton ejb the following exception is thrown:
08:37:23,840 ERROR [org.jboss.as.ejb3.tx.CMTTxInterceptor] (MSC service thread 1-1) javax.ejb.EJBTransactionRolledbackException: Component is stopped
08:37:24,496 WARN [org.jboss.as.ee.component.BasicComponentInstance] (MSC service thread 1-1) Failed to destroy component instance org.jboss.as.ejb3.component.singleton.SingletonComponentInstance@133f483: javax.ejb.EJBTransactionRolledbackException: Component is stopped
at org.jboss.as.ejb3.tx.CMTTxInterceptor.handleInCallerTx(CMTTxInterceptor.java:133)
at org.jboss.as.ejb3.tx.CMTTxInterceptor.invokeInCallerTx(CMTTxInterceptor.java:196)
at org.jboss.as.ejb3.tx.CMTTxInterceptor.required(CMTTxInterceptor.java:286)
at org.jboss.as.ejb3.tx.CMTTxInterceptor.processInvocation(CMTTxInterceptor.java:182)
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:287) [jboss-invocation-1.1.0.Final.jar:1.1.0.Final]
at org.jboss.as.ejb3.component.session.SessionInvocationContextInterceptor.processInvocation(SessionInvocationContextInterceptor.java:71)
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:287) [jboss-invocation-1.1.0.Final.jar:1.1.0.Final]
at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61) [jboss-invocation-1.1.0.Final.jar:1.1.0.Final]
at org.jboss.as.ee.component.ViewDescription$1.processInvocation(ViewDescription.java:146) [jboss-as-ee-7.0.2.Final.jar:7.0.2.Final]
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:287) [jboss-invocation-1.1.0.Final.jar:1.1.0.Final]
at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61) [jboss-invocation-1.1.0.Final.jar:1.1.0.Final]
at org.jboss.as.ee.component.ProxyInvocationHandler.invoke(ProxyInvocationHandler.java:76) [jboss-as-ee-7.0.2.Final.jar:7.0.2.Final]
at sandbox.singleton.MySessionBean$$$view16.doSomething(Unknown Source)
at sandbox.singleton.MySingleton.ejbRemove(MySingleton.java:25)
The Singleton:
{code}
package sandbox.singleton;
import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
import javax.ejb.EJB;
import javax.ejb.Singleton;
import javax.ejb.Startup;
@Singleton
@Startup
public class MySingleton {
@EJB
MySessionBean mySessionBean;
@PostConstruct
public void ejbCreate() {
System.out.println("MySingleton ejbCreate");
}
@PreDestroy
public void ejbRemove() {
System.out.println("MySingleton ejbRemove start");
mySessionBean.doSomething();
System.out.println("MySingleton ejbRemove end");
}
}
{code}
The other stateless ejb I want to call:
{code}
package sandbox.singleton;
import javax.ejb.Stateless;
@Stateless
public class MySessionBean {
public void doSomething() {
System.out.println("MySessionBean doSomething()");
}
}
{code}
Is this a bug or normal EJB 3.1 behaviour?
How can I call an other ejb in preDestroy?
Many thanks
Günther