List Info

Thread: Created: (JBSEAM-2306) Can't create Quartz Cron job at startup




Created: (JBSEAM-2306) Can't create Quartz Cron job at startup
country flaguser name
United States
2007-11-27 18:21:46
Can't create Quartz Cron job at startup
---------------------------------------

                 Key: JBSEAM-2306
                 URL: http://
jira.jboss.com/jira/browse/JBSEAM-2306
             Project: JBoss Seam
          Issue Type: Bug
          Components: Async
    Affects Versions: 2.0.0.GA
         Environment: Windows, JBoss 4.2.1 GA
            Reporter: NSA




I've set up an ObserveInitilization class as suggested by
Pete Muir here: http://in.relation.to/Bloggers/DoingSomethingAtSta
rtupWithSeam

It looks like this:

Name("observeInitialization")
public class ObserveInitialization {
   
   In(create=true) 
   Updater updater;

   Observer("org.jboss.seam.postInitialization"
;)
   public void start() {
	   initialize(30 * 1000l);
   }
   
   Asynchronous
   public void initialize(Duration long
durationInMilliseconds) {
	      updater.update(new Date(), "0 0/3 * * *
?");
   }
}


The Updater class looks like this:

Name("updater")
public class Updater {

	In
	private EntityManager entityManager;

	Logger
	private Log log;

	Asynchronous
	public void update(Expiration Date start, IntervalCron String cron) {
     //...
     }
}	

The issue is this code calls
ThreadPoolDispatcher.scheduleWithExecutorService, which
casts the return value of createSchedule to a
TimerSchedule.

Because I'm using an IntervalCron the return value of
createSchedule is a CronSchedule which extends Schedule, but
not TimerSchedule, so I get a ClassCastException:


09:14:59,387 ERROR [[/admin]] Exception sending context
initialized event to listener instance of cl
ass org.jboss.seam.servlet.SeamListener
java.lang.ClassCastException:
org.jboss.seam.async.CronSchedule
	at
org.jboss.seam.async.ThreadPoolDispatcher.scheduleInvocation
(ThreadPoolDispatcher.java:47)
	at
org.jboss.seam.async.ThreadPoolDispatcher.scheduleInvocation
(ThreadPoolDispatcher.java:29)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
Method)
	at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcce
ssorImpl.java:39)
	at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe
thodAccessorImpl.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.intercept.RootInvocationContext.proceed(RootI
nvocationContext.java:31)
	at
org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamI
nvocationContext.java:56)
	at
org.jboss.seam.transaction.RollbackInterceptor.aroundInvoke(
RollbackInterceptor.java:31)
	at
org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamI
nvocationContext.java:68)
	at
org.jboss.seam.core.MethodContextInterceptor.aroundInvoke(Me
thodContextInterceptor.java:42)
	at
org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamI
nvocationContext.java:68)
	at
org.jboss.seam.intercept.RootInterceptor.invoke(RootIntercep
tor.java:106)
	at
org.jboss.seam.intercept.JavaBeanInterceptor.interceptInvoca
tion(JavaBeanInterceptor.java:155)
	at
org.jboss.seam.intercept.JavaBeanInterceptor.invoke(JavaBean
Interceptor.java:91)
	at
org.jboss.seam.async.ThreadPoolDispatcher_$$_javassist_6.sch
eduleInvocation(ThreadPoolDispatcher
_$$_javassist_6.java)
	at
org.jboss.seam.async.AsynchronousInterceptor.aroundInvoke(As
ynchronousInterceptor.java:38)
	at
org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamI
nvocationContext.java:68)
	at
org.jboss.seam.intercept.RootInterceptor.invoke(RootIntercep
tor.java:106)
	at
org.jboss.seam.intercept.JavaBeanInterceptor.interceptInvoca
tion(JavaBeanInterceptor.java:155)
	at
org.jboss.seam.intercept.JavaBeanInterceptor.invoke(JavaBean
Interceptor.java:91)
	at
com.company.Updater_$$_javassist_5.update(Updater_$$_javassi
st_5.java)
	at
com.company.ObserveInitialization.initialize(ObserveInitiali
zation.java:29)
	

I compared this to the Quartz example packaged with Seam.

That example also calls createSchedule but as a parameter to
QuartzDispatcher.scheduleWithQuartzService which accepts a
Schedule, thus no ClassCastException.


-- 
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.atl
assian.com/software/jira

        
_______________________________________________
jbossseam-issues mailing list
jbossseam-issueslists.jboss.org
https://lists.jboss.org/mailman/listinfo/jbossseam-issu
es

Updated: (JBSEAM-2306) Can't create Quartz Cron job at startup
country flaguser name
United States
2007-11-28 04:39:46
     [ http://jira.jboss.com/jira/browse/JBSEAM-2306?page=all
]

Pete Muir updated JBSEAM-2306:
------------------------------

    Fix Version/s: 2.0.2.GA
      Description: 

I've set up an ObserveInitilization class as suggested by
Pete Muir here: http://in.relation.to/Bloggers/DoingSomethingAtSta
rtupWithSeam

It looks like this:

Name("observeInitialization")
public class ObserveInitialization {
   
   In(create=true) 
   Updater updater;

   Observer("org.jboss.seam.postInitialization"
;)
   public void start() {
	   initialize(30 * 1000l);
   }
   
   Asynchronous
   public void initialize(Duration long
durationInMilliseconds) {
	      updater.update(new Date(), "0 0/3 * * *
?");
   }
}


The Updater class looks like this:

Name("updater")
public class Updater {

	In
	private EntityManager entityManager;

	Logger
	private Log log;

	Asynchronous
	public void update(Expiration Date start, IntervalCron String cron) {
     //...
     }
}	

The issue is this code calls
ThreadPoolDispatcher.scheduleWithExecutorService, which
casts the return value of createSchedule to a
TimerSchedule.

Because I'm using an IntervalCron the return value of
createSchedule is a CronSchedule which extends Schedule, but
not TimerSchedule, so I get a ClassCastException:


09:14:59,387 ERROR [[/admin]] Exception sending context
initialized event to listener instance of cl
ass org.jboss.seam.servlet.SeamListener
java.lang.ClassCastException:
org.jboss.seam.async.CronSchedule
	at
org.jboss.seam.async.ThreadPoolDispatcher.scheduleInvocation
(ThreadPoolDispatcher.java:47)
	at
org.jboss.seam.async.ThreadPoolDispatcher.scheduleInvocation
(ThreadPoolDispatcher.java:29)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
Method)
	at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcce
ssorImpl.java:39)
	at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe
thodAccessorImpl.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.intercept.RootInvocationContext.proceed(RootI
nvocationContext.java:31)
	at
org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamI
nvocationContext.java:56)
	at
org.jboss.seam.transaction.RollbackInterceptor.aroundInvoke(
RollbackInterceptor.java:31)
	at
org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamI
nvocationContext.java:68)
	at
org.jboss.seam.core.MethodContextInterceptor.aroundInvoke(Me
thodContextInterceptor.java:42)
	at
org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamI
nvocationContext.java:68)
	at
org.jboss.seam.intercept.RootInterceptor.invoke(RootIntercep
tor.java:106)
	at
org.jboss.seam.intercept.JavaBeanInterceptor.interceptInvoca
tion(JavaBeanInterceptor.java:155)
	at
org.jboss.seam.intercept.JavaBeanInterceptor.invoke(JavaBean
Interceptor.java:91)
	at
org.jboss.seam.async.ThreadPoolDispatcher_$$_javassist_6.sch
eduleInvocation(ThreadPoolDispatcher
_$$_javassist_6.java)
	at
org.jboss.seam.async.AsynchronousInterceptor.aroundInvoke(As
ynchronousInterceptor.java:38)
	at
org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamI
nvocationContext.java:68)
	at
org.jboss.seam.intercept.RootInterceptor.invoke(RootIntercep
tor.java:106)
	at
org.jboss.seam.intercept.JavaBeanInterceptor.interceptInvoca
tion(JavaBeanInterceptor.java:155)
	at
org.jboss.seam.intercept.JavaBeanInterceptor.invoke(JavaBean
Interceptor.java:91)
	at
com.company.Updater_$$_javassist_5.update(Updater_$$_javassi
st_5.java)
	at
com.company.ObserveInitialization.initialize(ObserveInitiali
zation.java:29)
	

I compared this to the Quartz example packaged with Seam.

That example also calls createSchedule but as a parameter to
QuartzDispatcher.scheduleWithQuartzService which accepts a
Schedule, thus no ClassCastException.


  was:


I've set up an ObserveInitilization class as suggested by
Pete Muir here: http://in.relation.to/Bloggers/DoingSomethingAtSta
rtupWithSeam

It looks like this:

Name("observeInitialization")
public class ObserveInitialization {
   
   In(create=true) 
   Updater updater;

   Observer("org.jboss.seam.postInitialization"
;)
   public void start() {
	   initialize(30 * 1000l);
   }
   
   Asynchronous
   public void initialize(Duration long
durationInMilliseconds) {
	      updater.update(new Date(), "0 0/3 * * *
?");
   }
}


The Updater class looks like this:

Name("updater")
public class Updater {

	In
	private EntityManager entityManager;

	Logger
	private Log log;

	Asynchronous
	public void update(Expiration Date start, IntervalCron String cron) {
     //...
     }
}	

The issue is this code calls
ThreadPoolDispatcher.scheduleWithExecutorService, which
casts the return value of createSchedule to a
TimerSchedule.

Because I'm using an IntervalCron the return value of
createSchedule is a CronSchedule which extends Schedule, but
not TimerSchedule, so I get a ClassCastException:


09:14:59,387 ERROR [[/admin]] Exception sending context
initialized event to listener instance of cl
ass org.jboss.seam.servlet.SeamListener
java.lang.ClassCastException:
org.jboss.seam.async.CronSchedule
	at
org.jboss.seam.async.ThreadPoolDispatcher.scheduleInvocation
(ThreadPoolDispatcher.java:47)
	at
org.jboss.seam.async.ThreadPoolDispatcher.scheduleInvocation
(ThreadPoolDispatcher.java:29)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
Method)
	at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcce
ssorImpl.java:39)
	at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe
thodAccessorImpl.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.intercept.RootInvocationContext.proceed(RootI
nvocationContext.java:31)
	at
org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamI
nvocationContext.java:56)
	at
org.jboss.seam.transaction.RollbackInterceptor.aroundInvoke(
RollbackInterceptor.java:31)
	at
org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamI
nvocationContext.java:68)
	at
org.jboss.seam.core.MethodContextInterceptor.aroundInvoke(Me
thodContextInterceptor.java:42)
	at
org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamI
nvocationContext.java:68)
	at
org.jboss.seam.intercept.RootInterceptor.invoke(RootIntercep
tor.java:106)
	at
org.jboss.seam.intercept.JavaBeanInterceptor.interceptInvoca
tion(JavaBeanInterceptor.java:155)
	at
org.jboss.seam.intercept.JavaBeanInterceptor.invoke(JavaBean
Interceptor.java:91)
	at
org.jboss.seam.async.ThreadPoolDispatcher_$$_javassist_6.sch
eduleInvocation(ThreadPoolDispatcher
_$$_javassist_6.java)
	at
org.jboss.seam.async.AsynchronousInterceptor.aroundInvoke(As
ynchronousInterceptor.java:38)
	at
org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamI
nvocationContext.java:68)
	at
org.jboss.seam.intercept.RootInterceptor.invoke(RootIntercep
tor.java:106)
	at
org.jboss.seam.intercept.JavaBeanInterceptor.interceptInvoca
tion(JavaBeanInterceptor.java:155)
	at
org.jboss.seam.intercept.JavaBeanInterceptor.invoke(JavaBean
Interceptor.java:91)
	at
com.company.Updater_$$_javassist_5.update(Updater_$$_javassi
st_5.java)
	at
com.company.ObserveInitialization.initialize(ObserveInitiali
zation.java:29)
	

I compared this to the Quartz example packaged with Seam.

That example also calls createSchedule but as a parameter to
QuartzDispatcher.scheduleWithQuartzService which accepts a
Schedule, thus no ClassCastException.



> Can't create Quartz Cron job at startup
> ---------------------------------------
>
>                 Key: JBSEAM-2306
>                 URL: http://
jira.jboss.com/jira/browse/JBSEAM-2306
>             Project: JBoss Seam
>          Issue Type: Bug
>          Components: Async
>    Affects Versions: 2.0.0.GA
>         Environment: Windows, JBoss 4.2.1 GA
>            Reporter: NSA
>             Fix For: 2.0.2.GA
>
>
> I've set up an ObserveInitilization class as suggested
by Pete Muir here: http://in.relation.to/Bloggers/DoingSomethingAtSta
rtupWithSeam
> It looks like this:
> Name("observeInitialization")
> public class ObserveInitialization {
>    
>    In(create=true) 
>    Updater updater;
>    Observer("org.jboss.seam.postInitialization"
;)
>    public void start() {
> 	   initialize(30 * 1000l);
>    }
>    
>    Asynchronous
>    public void initialize(Duration long
durationInMilliseconds) {
> 	      updater.update(new Date(), "0 0/3 * * *
?");
>    }
> }
> The Updater class looks like this:
> Name("updater")
> public class Updater {
> 	In
> 	private EntityManager entityManager;
> 	Logger
> 	private Log log;
> 	Asynchronous
> 	public void update(Expiration Date start, IntervalCron String cron) {
>      //...
>      }
> }	
> The issue is this code calls
ThreadPoolDispatcher.scheduleWithExecutorService, which
casts the return value of createSchedule to a
TimerSchedule.
> Because I'm using an IntervalCron the return
value of createSchedule is a CronSchedule which extends
Schedule, but not TimerSchedule, so I get a
ClassCastException:
> 09:14:59,387 ERROR [[/admin]] Exception sending context
initialized event to listener instance of cl
> ass org.jboss.seam.servlet.SeamListener
> java.lang.ClassCastException:
org.jboss.seam.async.CronSchedule
> 	at
org.jboss.seam.async.ThreadPoolDispatcher.scheduleInvocation
(ThreadPoolDispatcher.java:47)
> 	at
org.jboss.seam.async.ThreadPoolDispatcher.scheduleInvocation
(ThreadPoolDispatcher.java:29)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
Method)
> 	at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcce
ssorImpl.java:39)
> 	at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe
thodAccessorImpl.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.intercept.RootInvocationContext.proceed(RootI
nvocationContext.java:31)
> 	at
org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamI
nvocationContext.java:56)
> 	at
org.jboss.seam.transaction.RollbackInterceptor.aroundInvoke(
RollbackInterceptor.java:31)
> 	at
org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamI
nvocationContext.java:68)
> 	at
org.jboss.seam.core.MethodContextInterceptor.aroundInvoke(Me
thodContextInterceptor.java:42)
> 	at
org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamI
nvocationContext.java:68)
> 	at
org.jboss.seam.intercept.RootInterceptor.invoke(RootIntercep
tor.java:106)
> 	at
org.jboss.seam.intercept.JavaBeanInterceptor.interceptInvoca
tion(JavaBeanInterceptor.java:155)
> 	at
org.jboss.seam.intercept.JavaBeanInterceptor.invoke(JavaBean
Interceptor.java:91)
> 	at
org.jboss.seam.async.ThreadPoolDispatcher_$$_javassist_6.sch
eduleInvocation(ThreadPoolDispatcher
> _$$_javassist_6.java)
> 	at
org.jboss.seam.async.AsynchronousInterceptor.aroundInvoke(As
ynchronousInterceptor.java:38)
> 	at
org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamI
nvocationContext.java:68)
> 	at
org.jboss.seam.intercept.RootInterceptor.invoke(RootIntercep
tor.java:106)
> 	at
org.jboss.seam.intercept.JavaBeanInterceptor.interceptInvoca
tion(JavaBeanInterceptor.java:155)
> 	at
org.jboss.seam.intercept.JavaBeanInterceptor.invoke(JavaBean
Interceptor.java:91)
> 	at
com.company.Updater_$$_javassist_5.update(Updater_$$_javassi
st_5.java)
> 	at
com.company.ObserveInitialization.initialize(ObserveInitiali
zation.java:29)
> 	
> I compared this to the Quartz example packaged with
Seam.
> That example also calls createSchedule but as a
parameter to QuartzDispatcher.scheduleWithQuartzService
which accepts a Schedule, thus no ClassCastException.

-- 
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.atl
assian.com/software/jira

        
_______________________________________________
jbossseam-issues mailing list
jbossseam-issueslists.jboss.org
https://lists.jboss.org/mailman/listinfo/jbossseam-issu
es

[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )