-
1. Re: Quartz - persisting timers on the database problem.
raffaele.camanzo Oct 16, 2007 9:49 AM (in response to raffaele.camanzo)I tried to go deeper in the problem and found these lines in the server.log:
2007-10-16 15:26:44,810 INFO [org.jboss.seam.contexts.Contexts] starting up: org.jboss.seam.async.dispatcher 2007-10-16 15:26:44,977 INFO [org.jboss.seam.async.QuartzDispatcher] No seam.quartz.properties file. Use in-memory job store. 2007-10-16 15:26:45,061 INFO [org.quartz.simpl.SimpleThreadPool] Job execution threads will use class loader of thread: main 2007-10-16 15:26:45,090 INFO [org.quartz.core.QuartzScheduler] Quartz Scheduler v.1.6.0 created. 2007-10-16 15:26:45,093 INFO [org.quartz.simpl.RAMJobStore] RAMJobStore initialized. 2007-10-16 15:26:45,094 INFO [org.quartz.impl.StdSchedulerFactory] Quartz scheduler 'DefaultQuartzScheduler' initialized from default resource file in Quartz package: 'quartz.properties' 2007-10-16 15:26:45,094 INFO [org.quartz.impl.StdSchedulerFactory] Quartz scheduler version: 1.6.0 2007-10-16 15:26:45,097 INFO [org.quartz.core.QuartzScheduler] Scheduler DefaultQuartzScheduler_$_NON_CLUSTERED started. 2007-10-16 15:26:45,097 INFO [org.jboss.seam.async.QuartzDispatcher] The QuartzDispatcher has started
But the file exists and seems to be in the right place (the root of the jar); I tried also in the root of the ear and of the war but the Dispatcher says always the same thing.
I tried to download the latest version from the CVS and added some prints around the root of the problem (getResourceAsStream("/seam.quartz.properties")) but with the current CVS version Seam prints nothing at all.
Any suggestion?
Regards,
Raffaele Camanzo -
2. Re: Quartz - persisting timers on the database problem.
raffaele.camanzo Oct 16, 2007 11:12 AM (in response to raffaele.camanzo)Deeper, deeper, deeper... Found and solved.
the problem:
from the QuartzDispatcher.java:InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream("/seam.quartz.properties");
Seam does not recognize my seam.quartz.properties.
I've changed it in:InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream("seam.quartz.properties");
and everything works great (if you use a Oracle DB remember to download the latest Quartz distribution and include the quartz-oracle.jar in your app).
It seems to be a bug (no need to add the initial slash), indeed, searching for the seam.properties file in the Seam source code (seam.properties and seam.quartz.properties are in the same position and loaded in the same way) I found this:
from Initialization.java... private void scanForComponents() { ComponentScanner[] scanners = { new ComponentScanner("seam.properties"), new ComponentScanner("META-INF/seam.properties"), new ComponentScanner("META-INF/components.xml") }; ...
from ComponentScanner.java... public ComponentScanner(String resourceName) { super(resourceName); } ...
from Scanner.java... public Scanner(String resourceName) { this( resourceName, Thread.currentThread().getContextClassLoader() ); } ... protected void scan() { Set<String> paths = new HashSet<String>(); if (resourceName==null) { for ( URL url: getURLsFromClassLoader() ) { String urlPath = url.getFile(); if ( urlPath.endsWith("/") ) { urlPath = urlPath.substring( 0, urlPath.length()-1 ); } paths.add( urlPath ); } } else { try { Enumeration<URL> urlEnum = classLoader.getResources(resourceName); ...
I don't know if this needs a Jira issue or if I'm wrong, then, it would be great if one of the Seam developers can have a glance at this.
Regards,
Raffaele Camanzo -
3. Re: Quartz - persisting timers on the database problem.
juntao Oct 16, 2007 11:28 AM (in response to raffaele.camanzo)Thanks Raffaele! I will make change you suggested.
But just curious, why would this wipe out your quartz tables? I thought that your app would not have worked with the oracle db if the seam.quartz.properties is not found ...
Or was the tables never generated to begin with and you have been using in-memory job store all along?
Thanks
Michael -
4. Re: Quartz - persisting timers on the database problem.
raffaele.camanzo Oct 16, 2007 11:44 AM (in response to raffaele.camanzo)Hi Michael,
thank you for your super-fast reply!
About your question: obviously using RAM job store there was no access to the Oracle DB and then my tables were empty, never written, never wiped out (Quartz works properly with RAM job store, but restarting jBoss AS causes the loss of all the timers);
probably the misunderstanding was caused by my not-as-good-as-should-be-english ;)
Regards,
Raffaele Camanzo -
5. Re: Quartz - persisting timers on the database problem.
juntao Oct 16, 2007 12:51 PM (in response to raffaele.camanzo)Hi Raffaele,
Thanks for the update. I made the change in CVS. Please let us know if you have other issues / suggestions with Quartz in Seam!
cheers
Michael