-
1. Re: unable to access application scoped component in @Timeou
pmuir Apr 29, 2007 4:17 PM (in response to liudan2005)You probably want to use Seam's support for asynchronous methods and timers - http://docs.jboss.com/seam/1.2.1.GA/reference/en/html/jms.html#d0e9473
-
2. Re: unable to access application scoped component in @Timeou
liudan2005 Apr 29, 2007 9:15 PM (in response to liudan2005)In the doc, Seam timer is triggered from paymentAction.scheduleRecurringPayment() which itself is a seam component and it has seam application context. In my case, seam component is triggered at startup time and it doesn't have any active application context. Is there anyway to force seam to create an application context from my seam component?
-
3. Re: unable to access application scoped component in @Timeou
pmuir Apr 30, 2007 4:03 AM (in response to liudan2005)Are you saying you want to schedule your timer at application start? Then just put the code to schedule the async. method inside an @Create method in an APPLICATION scoped component marked @Startup.
You can use Seam's Lifecycle class to manually start and end calls into Seam - but as Seam has built in support for timers, this seems unnecessary ;) -
4. Re: unable to access application scoped component in @Timeou
liudan2005 Apr 30, 2007 4:46 AM (in response to liudan2005)I get IllegalStateException when I try to call an @Asynchronous annotated method in my @Create annotated method when app is started.
ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost].[/]] Exception sending context initialized event to listener instance of class org.jboss.seam.servlet.SeamListener rg.jboss.seam.core.dispatcherjava.lang.IllegalStateException: org.jboss.seam.core.dispatcher is not installed in components.xml java.lang.IllegalStateException: org.jboss.seam.core.dispatcher is not installed in components.xml at org.jboss.seam.interceptors.AsynchronousInterceptor.aroundInvoke(AsynchronousInterceptor.java:29) at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:69) at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:103) at org.jboss.seam.intercept.ClientSideInterceptor.invoke(ClientSideInterceptor.java:50) at org.javassist.tmp.java.lang.Object_$$_javassist_55.scheduleTimer(Object_$$_javassist_55.java) at com.example.admin.auto.RunOnStartup.init(RunOnStartup.java:45) 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:20) at org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:31) at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:57) at org.jboss.seam.interceptors.RollbackInterceptor.aroundInvoke(RollbackInterceptor.java:34) at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:69) at org.jboss.seam.interceptors.BijectionInterceptor.aroundInvoke(BijectionInterceptor.java:47) at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:69) at org.jboss.seam.interceptors.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:27) at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:69) at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:103) at org.jboss.seam.intercept.JavaBeanInterceptor.interceptInvocation(JavaBeanInterceptor.java:151) at org.jboss.seam.intercept.JavaBeanInterceptor.invoke(JavaBeanInterceptor.java:87) at com.example.admin.auto.RunOnStartup_$$_javassist_54.init(RunOnStartup_$$_javassist_54.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:20) at org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:123) at org.jboss.seam.Component.callComponentMethod(Component.java:1834) at org.jboss.seam.Component.callCreateMethod(Component.java:1757) at org.jboss.seam.Component.newInstance(Component.java:1746) at org.jboss.seam.contexts.Lifecycle.startup(Lifecycle.java:175)
-
5. Re: unable to access application scoped component in @Timeou
pmuir Apr 30, 2007 4:50 AM (in response to liudan2005)And you have the dispatcher installed?
<core:dispatcher />
What version of Seam? -
6. Re: unable to access application scoped component in @Timeou
liudan2005 Apr 30, 2007 5:15 AM (in response to liudan2005)No, I just noticed I don't have "<core:dispatcher />" in my components.xml. Everything is working now. Thanks a lot.