EJBComponentUnavailableException: JBAS014559: Invocation cannot proceed as component is shutting down
sachin.dhingra Dec 30, 2013 12:49 AMI have a requirement where i have some persistent timer in my application which will get activated during startup and when I stop the application from admin console or CLI, I have to kill/stop those timers.
For that what I have done is:
1. Created a applistener which implements the ServletContextListener.
2. In the applistener class, I have overridden the contextDestroyed method in which i am calling Timer Beans to stop/Kill the active timers.
Below is the entry in web.xml file:
<listener> <listener-class>com.xxx.yyyserver.listener.ApplicationListener</listener-class> </listener>
This listener is in my web project (.war) and timer is in EJB project (.jar) and both bundled in single ear file.
This was working when app is on Websphere but same is not working in JBOSS EAP 6.1.0.
What is happening here is when application is stopped from admin-console then it deploys the Timer beans before it reaches the contextDestroyed method of appListener class and it thorws below exception:
org.jboss.as.ejb3.component.EJBComponentUnavailableException: JBAS014559: Invocation cannot proceed as component is shutting down at org.jboss.as.ejb3.component.interceptors.ShutDownInterceptorFactory$1.processInvocation(ShutDownInterceptorFactory.java:59) at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) at org.jboss.as.ejb3.component.interceptors.LoggingInterceptor.processInvocation(LoggingInterceptor.java:59) at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) at org.jboss.as.ee.component.NamespaceContextInterceptor.processInvocation(NamespaceContextInterceptor.java:50) at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) at org.jboss.as.ejb3.component.interceptors.AdditionalSetupInterceptor.processInvocation(AdditionalSetupInterceptor.java:55) at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) at org.jboss.as.ee.component.TCCLInterceptor.processInvocation(TCCLInterceptor.java:45) at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61) at org.jboss.as.ee.component.ViewService$View.invoke(ViewService.java:165) at org.jboss.as.ee.component.ViewDescription$1.processInvocation(ViewDescription.java:182) at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61) at org.jboss.as.ee.component.ProxyInvocationHandler.invoke(ProxyInvocationHandler.java:72) at com.xxx.yyyserver.commons.IDirListenerTimerServiceLocal$$$view11.killTimer(Unknown Source) at com.xxx.yyyserver.commons.xxxValidator.stopAllTimers(xxxValidator.java:292)
I am not sure what to do to stop/kill the active timers as these are persistent timers and will keep on running.