[
http://jira.jboss.com/jira/browse/JBSEAM-1707?page=comments#action_12369659 ]
Frits Jalvingh commented on JBSEAM-1707:
----------------------------------------
A possible fix which works in my case is below:
class org.jboss.seam.Component:
private void injectParameters(Object bean)
{
Parameters params = Parameters.instance();
if (params!=null) //check for unit tests
{
// jal 20070722 Bugfix for JBSEAM-1707 @Destroy Application-scoped bean throwing
IllegalState "no event context active"
// caused be the code below- accessing the request parameters at app shutdown time.
// Map<String, String[]> requestParameters = params.getRequestParameters();
// for (BijectedAttribute setter: parameterSetters)
// {
// Object convertedValue =
params.convertMultiValueRequestParameter(requestParameters, setter.getName(),
setter.getType());
// setter.set(bean, convertedValue);
// }
Map<String, String[]> requestParameters = null;
for (BijectedAttribute setter: parameterSetters)
{
if(requestParameters == null)
requestParameters = params.getRequestParameters();
Object convertedValue =
params.convertMultiValueRequestParameter(requestParameters, setter.getName(),
setter.getType());
setter.set(bean, convertedValue);
}
}
}
@Destroy method on APPLICATION scope bean throws IllegalState(no
context) at server stop time
---------------------------------------------------------------------------------------------
Key: JBSEAM-1707
URL:
http://jira.jboss.com/jira/browse/JBSEAM-1707
Project: JBoss Seam
Issue Type: Bug
Components: Core
Affects Versions: 2.0.0.BETA1
Environment: Tomcat 6.0.10, JavaBean mode, Hibernate 3.2.3, HBEM 3.3.1
Reporter: Frits Jalvingh
I have a bean defined as follows:
@Name("initBean")
@Startup()
@Scope(ScopeType.APPLICATION)
public class InitBean {
containing a method:
@Destroy
public void destroy() {
Builder.getInstance().terminate();
BuildBot.getInstance().stop();
}
It is meant to shutdown some daemons when the server stops.
When the server stops I get an exception:
01:15:39,703 WARN [Component] Exception calling component @Destroy method: initBean
java.lang.IllegalStateException: no event context active
at org.jboss.seam.web.ServletContexts.instance(ServletContexts.java:40)
at org.jboss.seam.web.Parameters.getRequestParameters(Parameters.java:39)
at org.jboss.seam.faces.Parameters.getRequestParameters(Parameters.java:64)
at org.jboss.seam.Component.injectParameters(Component.java:1334)
at org.jboss.seam.Component.inject(Component.java:1304)
at org.jboss.seam.core.BijectionInterceptor.aroundInvoke(BijectionInterceptor.java:45)
at
org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
at
org.jboss.seam.core.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:42)
at
org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:106)
at
org.jboss.seam.intercept.JavaBeanInterceptor.interceptInvocation(JavaBeanInterceptor.java:151)
at org.jboss.seam.intercept.JavaBeanInterceptor.invoke(JavaBeanInterceptor.java:87)
at to.etc.saram.beans.InitBean_$$_javassist_0.destroy(InitBean_$$_javassist_0.java)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.jboss.seam.util.Reflections.invoke(Reflections.java:21)
at org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:124)
at org.jboss.seam.Component.callComponentMethod(Component.java:1957)
at org.jboss.seam.Component.callDestroyMethod(Component.java:1888)
at org.jboss.seam.Component.destroy(Component.java:1217)
at org.jboss.seam.contexts.Contexts.destroy(Contexts.java:251)
at org.jboss.seam.contexts.Lifecycle.endApplication(Lifecycle.java:52)
at org.jboss.seam.contexts.ServletLifecycle.endApplication(ServletLifecycle.java:121)
at org.jboss.seam.servlet.SeamListener.contextDestroyed(SeamListener.java:39)
at org.apache.catalina.core.StandardContext.listenerStop(StandardContext.java:3866)
at org.apache.catalina.core.StandardContext.stop(StandardContext.java:4502)
at org.apache.catalina.core.ContainerBase.stop(ContainerBase.java:1068)
at org.apache.catalina.core.ContainerBase.stop(ContainerBase.java:1068)
at org.apache.catalina.core.StandardEngine.stop(StandardEngine.java:448)
at org.apache.catalina.core.StandardService.stop(StandardService.java:510)
at org.apache.catalina.core.StandardServer.stop(StandardServer.java:744)
at org.apache.catalina.startup.Catalina.stop(Catalina.java:602)
at org.apache.catalina.startup.Catalina.start(Catalina.java:577)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
which seems to be caused by the bean Injector trying to access the request context which
of course is no longer there. The bean contains only a single injected thingy which is the
entityManager.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira