5 Replies Latest reply on Oct 28, 2010 11:44 PM by kapitanpetko

    Seam 2.0 and Quartz

    priyasrihari

      I'm using Seam 2.0 and Quartz in one of my J2EE projects packaged as war with JBoss AS.


      The code snippet that does the job scheduling:
           @Asynchronous
           public QuartzTriggerHandle processAuditJob(@Expiration Date when,
                  @IntervalCron String interval) {
                 
                auditCIMSDoc();
                return null;
           }


      This was working as intended until I changed the maven version of the project in pom.
      Now it fails deployment with the following error. One of the discussion threads mentioned that this could be due to JBoss implementation of Quartz taking over the opensymphony version am using. I replaced the opensymphony version in the JBoss lib and still i get the same error. Can anyone tell me how to fix this error.


      Caused by: java.lang.IllegalArgumentException: Can only use @IntervalCron with the QuartzDispatcher
              at org.jboss.seam.async.AbstractDispatcher.extractAndValidateParameters(AbstractDispatcher.java:171)
              at org.jboss.seam.async.AbstractDispatcher.createTimerSchedule(AbstractDispatcher.java:113)
              at org.jboss.seam.async.ThreadPoolDispatcher.scheduleInvocation(ThreadPoolDispatcher.java:56)
              at org.jboss.seam.async.ThreadPoolDispatcher.scheduleInvocation(ThreadPoolDispatcher.java:30)
              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:597)
              at org.jboss.seam.util.Reflections.invoke(Reflections.java:22)
              at org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:32)
              at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:56)
              at org.jboss.seam.transaction.RollbackInterceptor.aroundInvoke(RollbackInterceptor.java:28)
              at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
              at org.jboss.seam.core.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:44)
              at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
              at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:107)
              at org.jboss.seam.intercept.JavaBeanInterceptor.interceptInvocation(JavaBeanInterceptor.java:185)
              at org.jboss.seam.intercept.JavaBeanInterceptor.invoke(JavaBeanInterceptor.java:103)
              at org.jboss.seam.async.ThreadPoolDispatcher$$javassistseam2.scheduleInvocation(ThreadPoolDispatcher$$javassistseam2.java)
              at org.jboss.seam.async.AsynchronousInterceptor.aroundInvoke(AsynchronousInterceptor.java:40)
              at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
              at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:107)
              at org.jboss.seam.intercept.JavaBeanInterceptor.interceptInvocation(JavaBeanInterceptor.java:185)
              at org.jboss.seam.intercept.JavaBeanInterceptor.invoke(JavaBeanInterceptor.java:103)
              at com.mck.server.service.dms.audit.scheduler.AuditJobScheduler$$javassistseam1.processAuditJob(AuditJobScheduler$$javassistseam1.java)
              at com.mck.server.service.dms.audit.scheduler.AuditJobCreator.scheduleJob(AuditJobCreator.java:39)
              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:597)
              at org.jboss.seam.util.Reflections.invoke(Reflections.java:22)
              at org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:32)
              at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:56)
              at org.jboss.seam.transaction.RollbackInterceptor.aroundInvoke(RollbackInterceptor.java:28)
              at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
              at org.jboss.seam.core.BijectionInterceptor.aroundInvoke(BijectionInterceptor.java:77)
              at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
              at org.jboss.seam.core.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:44)
              at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
              at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:107)
              at org.jboss.seam.intercept.JavaBeanInterceptor.interceptInvocation(JavaBeanInterceptor.java:185)
              at org.jboss.seam.intercept.JavaBeanInterceptor.invoke(JavaBeanInterceptor.java:103)
              at com.mck.server.service.dms.audit.scheduler.AuditJobCreator$$javassistseam0.scheduleJob(AuditJobCreator$$javassistseam0.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:597)
              at org.jboss.seam.util.Reflections.invoke(Reflections.java:22)
              at org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:144)
              at org.jboss.seam.Component.callComponentMethod(Component.java:2249)
              at org.jboss.seam.Component.callCreateMethod(Component.java:2172)
              at org.jboss.seam.Component.newInstance(Component.java:2132)



      Thanks in advance
      Priya

        • 1. Re: Seam 2.0 and Quartz
          kapitanpetko

          For some reason your project is using the ThreadPoolDispatcher instead of Quartz. Check your configuration, show us components.xml. Replacing the JBoss lib is probably a bad idea: you risk breaking your JBoss. You should bundle the Quartz jar in your WAR instead and setup your app to use that.


          HTH

          • 2. Re: Seam 2.0 and Quartz
            nigiyan
            • 3. Re: Seam 2.0 and Quartz
              nigiyan

              I set also non cron interval by using that article and it worked.

              • 4. Re: Seam 2.0 and Quartz
                priyasrihari

                Thanks for your suggestions. It finally seemed to work. The issue was that I had accidentally removed the declaration:
                async:quartz-dispatcher  from components.xml
                I put this back and the deployment of the war progresses smoothly now.


                Nikolay , as for the project using ThreadPoolDispatcher , am using a ThreadPoolExecutor to execute tasks once the job is kicked off by Quartz. Not sure if that is the reason for the stacktrace.


                Aram : I agree. its the exact same link I had used for referencing Seam-Quartz integration - very descriptive tutorial.

                • 5. Re: Seam 2.0 and Quartz
                  kapitanpetko

                  Priya Srihari wrote on Oct 28, 2010 23:40:


                  Nikolay , as for the project using ThreadPoolDispatcher , am using a ThreadPoolExecutor to execute tasks once the job is kicked off by Quartz. Not sure if that is the reason for the stacktrace.


                  No, that's a different story. You shouldn't need ThreadPoolExecutor if you are using Quartz, each job runs in its own thread.