-
-
2. Re: Quartz Scheduling questions
risenhoover Apr 24, 2008 5:34 PM (in response to risenhoover)This definitely helps solve the first problem! Now if only I could figure out the quartz part... Thanks!
-
3. Re: Quartz Scheduling questions
danielc.roth Apr 24, 2008 7:40 PM (in response to risenhoover)Paul: Could you provide the classes containing both
crawler
and scheduleCrawl methods? (and please use thecode block
feature).I have experienced the same thing you describe (immediate excecution, and the none at all) when being in the same class with caller and async method.
-
4. Re: Quartz Scheduling questions
risenhoover Apr 24, 2008 9:18 PM (in response to risenhoover)Here's the code from my components.xml file that's relevant to the timers...
<!-- I've tried both of these... <async:quartz-dispatcher /> --> <async:timer-service-dispatcher />
Here's the code that is supposed to kick off the scheduler. I'm happy to say that it wakes up and executes when the application starts.
@Observer("org.jboss.seam.postInitialization") public void scheduleCrawlers() { log.info("Scheduling crawlers"); // every thirty seconds... QuartzTriggerHandle handle = scheduleCrawl(30000l); }
It executes the following code immediately, and then never again...
@Asynchronous public QuartzTriggerHandle scheduleCrawl(@IntervalDuration, Long interval) { log.info("Scheduling crawler with " + interval + " interval schedule"); this.crawlFeeds(); return null; }
One thing that's curious is that Eclipse is pointing out an error in the components.xml file that appears to be related to the async: tag. Here's what it tells me...
cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'async:timer-service-dispatcher'.I get the same message no matter whether I've got the quartz scheduler or the EJB scheduler.
Thanks!
-
5. Re: Quartz Scheduling questions
risenhoover Apr 25, 2008 2:38 AM (in response to risenhoover)OK So I tried move the scheduling method into a separate Seam component but it still doesn't work. The symptoms remain the same. Upon initialization the crawler runs once, then never again.
I really think the problem is related to the error I'm getting in the components.xml file. No matter which timer I use (quartz, EJB3, or the JVM timer), Eclipse reports the error I outlined in my last posting...
Any help?? Anyone?
-
6. Re: Quartz Scheduling questions
danielc.roth Apr 25, 2008 9:11 AM (in response to risenhoover)Have you declared the async namespace? That is, do you have the following definition in the top of the components.xml.
(Look for async)<components xmlns="http://jboss.com/products/seam/components" xmlns:core="http://jboss.com/products/seam/core" xmlns:persistence="http://jboss.com/products/seam/persistence" xmlns:transaction="http://jboss.com/products/seam/transaction" xmlns:mail="http://jboss.com/products/seam/mail" xmlns:security="http://jboss.com/products/seam/security" xmlns:async="http://jboss.com/products/seam/async" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:web="http://jboss.com/products/seam/web" xsi:schemaLocation="http://jboss.com/products/seam/core http://jboss.com/products/seam/core-2.0.xsd http://jboss.com/products/seam/persistence http://jboss.com/products/seam/persistence-2.0.xsd http://jboss.com/products/seam/async http://jboss.com/products/seam/async-2.0.xsd http://jboss.com/products/seam/transaction http://jboss.com/products/seam/transaction-2.0.xsd http://jboss.com/products/seam/security http://jboss.com/products/seam/security-2.0.xsd http://jboss.com/products/seam/mail http://jboss.com/products/seam/mail-2.0.xsd http://jboss.com/products/seam/web http://jboss.com/products/seam/web-2.0.xsd http://jboss.com/products/seam/components http://jboss.com/products/seam/components-2.0.xsd">
-
7. Re: Quartz Scheduling questions
risenhoover Apr 25, 2008 5:47 PM (in response to risenhoover)Yes I had to manually add that.
-
8. Re: Quartz Scheduling questions
danielc.roth Apr 26, 2008 12:30 AM (in response to risenhoover)So now everything works, right?
-
9. Re: Quartz Scheduling questions
risenhoover Apr 26, 2008 12:44 AM (in response to risenhoover)Sigh No, sorry. I had manually added the async namespace a while ago, sorry that my response was a bit misleading. The behavior is the same. Executes once at startup, then never again.
-
10. Re: Quartz Scheduling questions
danielc.roth Apr 26, 2008 1:22 PM (in response to risenhoover)Could you paste your components.xml? The error message you get is the same I get in eclipse if I remove the namespace
xmlns:async="http://jboss.com/products/seam/async"
or the schemaLocation
http://jboss.com/products/seam/async http://jboss.com/products/seam/async-2.0.xsd
-
11. Re: Quartz Scheduling questions
risenhoover Apr 26, 2008 6:04 PM (in response to risenhoover)<?xml version="1.0" encoding="UTF-8"?> <components xmlns="http://jboss.com/products/seam/components" xmlns:core="http://jboss.com/products/seam/core" xmlns:persistence="http://jboss.com/products/seam/persistence" xmlns:drools="http://jboss.com/products/seam/drools" xmlns:bpm="http://jboss.com/products/seam/bpm" xmlns:security="http://jboss.com/products/seam/security" xmlns:async="http://jboss.com/products/seam/async" xmlns:mail="http://jboss.com/products/seam/mail" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jboss.com/products/seam/core http://jboss.com/products/seam/core-2.0.xsd http://jboss.com/products/seam/persistence http://jboss.com/products/seam/persistence-2.0.xsd http://jboss.com/products/seam/drools http://jboss.com/products/seam/drools-2.0.xsd http://jboss.com/products/seam/bpm http://jboss.com/products/seam/bpm-2.0.xsd http://jboss.com/products/seam/security http://jboss.com/products/seam/security-2.0.xsd http://jboss.com/products/seam/mail http://jboss.com/products/seam/mail-2.0.xsd http://jboss.com/products/seam/components http://jboss.com/products/seam/components-2.0.xsd"> <core:init debug="true" jndi-pattern="@jndiPattern@" /> <core:manager concurrent-request-timeout="500" conversation-timeout="120000" conversation-id-parameter="cid" parent-conversation-id-parameter="pid" /> <persistence:managed-persistence-context name="entityManager" auto-create="true" persistence-unit-jndi-name="java:/lykitEntityManagerFactory" /> <drools:rule-base name="securityRules"> <drools:rule-files> <value>/security.drl</value> </drools:rule-files> </drools:rule-base> <security:identity security-rules="#{securityRules}" authenticate-method="#{authenticator.authenticate}" remember-me="true" /> <event type="org.jboss.seam.security.notLoggedIn"> <action execute="#{redirect.captureCurrentView}" /> </event> <event type="org.jboss.seam.security.loginSuccessful"> <action execute="#{redirect.returnToCapturedView}" /> </event> <mail:mail-session host="localhost" port="2525" username="test" password="test" /> <!-- For use with jBPM pageflow or process management --> <!-- <bpm:jbpm> <bpm:process-definitions></bpm:process-definitions> <bpm:pageflow-definitions></bpm:pageflow-definitions> </bpm:jbpm> --> <!-- <async:quartz-dispatcher /> <async:thread-pool-dispatcher /> --> <async:timer-service-dispatcher /> </components>
-
12. Re: Quartz Scheduling questions
risenhoover Apr 27, 2008 2:56 AM (in response to risenhoover)OK Progress! I re-read your last message and realized that I didn't have the schemaLocation. I added that and the compile-time error has gone away. I still don't see the process repeating though.
So, if you could clarify one thing, the Long number that is annotated as the @IntervalDuration -- that's in milliseconds, right? And am I required to provide an @Expiration or a @FinalExpiration if I want the process to start immediately and continue forever?
-
13. Re: Quartz Scheduling questions
risenhoover Apr 27, 2008 3:19 AM (in response to risenhoover)Ok I'm beginning to answer my own questions now. From the docs it appears that the @Expiration tag is when the timer first kicks off the initial call, and it looks like it's required. I've added that with a value of now and it's still not repeating. I also added the @FinalExpiration with a date of two years from now and still nothing.
I'm going to try switching to a cron timer to see if that helps...
-
14. Re: Quartz Scheduling questions
zahidmaqbool May 1, 2008 5:33 PM (in response to risenhoover)Hi Paul,
I also had a similiar problem like yours..
But then when i moved my scheduler method to another class with @AutoCreate it all works perfect now.
I still cant understand how can that help me.
It works, but I just cant figure out why it works in a seperate class and not in the same one.