Hi Romain

after playing a little, it was a silly bug.

I've created another scheduler (in the same tables, but with a different
name) and added the properties using

        StdSchedulerFactory factory = new StdSchedulerFactory();
        Properties props = new Properties();
        props.put("org.apache.openejb.quartz.scheduler.instanceName","S2");
        (...)
        factory.initialize(props );
        scheduler = factory.getScheduler();

Properties came from cupy and paste so each key had an extra space in the
end.

I THINK that Quartz probably assumed the default scheduler since no key
could be recognized. Let's say TomEE's scheduler is called S1. So when the
scheduler S2 tried to save the job, instead of complaining about not
finding the definitions for it, it simply complained about a class it could
not find. (which is weird anyway, but looks like a quartz problem, not
TomEE's)

So in the end, it's working using tomee's shade classes. There was no need
for any special configuration related to classloaders. Since both 4
schedulers (2 S1, one for each tomee instance and 2 S2 one for each tomee
instance) are pointing to the same DB, they're working just as expected, in
the failover mode. When one instance goes down, the other one takes over
and vice versa. Each instance S2 scheduler starts in a @Singleton
@Lock(LockType.READ) on @PostConstruct and the scheduler is shut down on
@PreDestroy. It's a little tricky, but I think it will work for me.

ps: I've tried using quartz classes too. It seems to work this way too, but
of course, it's something I'd like to avoid, because I had to be very
careful with packages import clauses.

Again, thanks for all the support, guys.


[]

Leo

On Tue, Oct 21, 2014 at 4:34 PM, Romain Manni-Bucau <
rmannibu...@tomitribe.com> wrote:

> Can you share a simple sample we can run quickly showing it please?
>
> PS (Basic check we didn't ask): did you implement the job with our
> shade API or with quartz one?
> Romain Manni-Bucau
> Twitter: @rmannibucau
> Blog: http://rmannibucau.wordpress.com/
> LinkedIn: http://fr.linkedin.com/in/rmannibucau
> Github: https://github.com/rmannibucau
>
>
>
> 2014-10-21 19:00 GMT+02:00 Leonardo K. Shikida <shik...@gmail.com>:
> > Hi Romain
> >
> > tried both
> >
> >
> org.apache.openejb.quartz.scheduler.classLoadHelper.class=org.apache.openejb.quartz.simpl.CascadingClassLoadHelper
> >
> org.apache.openejb.quartz.scheduler.threadsInheritContextClassLoaderOfInitializer=true
> >
> > but I could not make it work. The exception persists.
> >
> > :-(
> >
> > []
> >
> > Leo
> >
> > On Tue, Oct 21, 2014 at 2:25 PM, Romain Manni-Bucau <
> > rmannibu...@tomitribe.com> wrote:
> >
> >> this is a tomee config ignored when you use quartz by itself - same
> >> applies to application.properties. Maybe
> >>
> >>
> org.apache.openejb.quartz.scheduler.threadsInheritContextClassLoaderOfInitializer
> >> as system property or in quartz properties of your shceduler?
> >> Romain Manni-Bucau
> >> Twitter: @rmannibucau
> >> Blog: http://rmannibucau.wordpress.com/
> >> LinkedIn: http://fr.linkedin.com/in/rmannibucau
> >> Github: https://github.com/rmannibucau
> >>
> >>
> >>
> >> 2014-10-21 17:49 GMT+02:00 Leonardo K. Shikida <shik...@gmail.com>:
> >> > did not know this option...
> >> >
> >> > well, I've added org.apache.openejb.openejb.quartz.use-TCCL=true to
> >> > application.properties but made no change.
> >> >
> >> > what does it mean?
> >> >
> >> > []
> >> >
> >> > Leo
> >> >
> >> > On Tue, Oct 21, 2014 at 1:31 PM, Romain Manni-Bucau <
> >> > rmannibu...@tomitribe.com> wrote:
> >> >
> >> >> Hi, did you configure quartz to use TCCL?
> >> >> Romain Manni-Bucau
> >> >> Twitter: @rmannibucau
> >> >> Blog: http://rmannibucau.wordpress.com/
> >> >> LinkedIn: http://fr.linkedin.com/in/rmannibucau
> >> >> Github: https://github.com/rmannibucau
> >> >>
> >> >>
> >> >>
> >> >> 2014-10-21 17:27 GMT+02:00 Leonardo K. Shikida <shik...@gmail.com>:
> >> >> > Hi Andy
> >> >> >
> >> >> > I did :-(
> >> >> >
> >> >> > Grave: MisfireHandler: Error handling misfires: Couldn't store
> trigger
> >> >> > 'group1.1413900600168' for 'group1.1413900600168' job:test.HelloJob
> >> >> > org.apache.openejb.quartz.JobPersistenceException: Couldn't store
> >> trigger
> >> >> > 'group1.1413900600168' for 'group1.1413900600168' job:test.HelloJob
> >> [See
> >> >> > nested exception: java.lang.ClassNotFoundException: test.HelloJob]
> >> >> >     at
> >> >> >
> >> >>
> >>
> org.apache.openejb.quartz.impl.jdbcjobstore.JobStoreSupport.storeTrigger(JobStoreSupport.java:1223)
> >> >> >     at
> >> >> >
> >> >>
> >>
> org.apache.openejb.quartz.impl.jdbcjobstore.JobStoreSupport.doUpdateOfMisfiredTrigger(JobStoreSupport.java:1037)
> >> >> >     at
> >> >> >
> >> >>
> >>
> org.apache.openejb.quartz.impl.jdbcjobstore.JobStoreSupport.recoverMisfiredJobs(JobStoreSupport.java:986)
> >> >> >     at
> >> >> >
> >> >>
> >>
> org.apache.openejb.quartz.impl.jdbcjobstore.JobStoreSupport.doRecoverMisfires(JobStoreSupport.java:3187)
> >> >> >     at
> >> >> >
> >> >>
> >>
> org.apache.openejb.quartz.impl.jdbcjobstore.JobStoreSupport$MisfireHandler.manage(JobStoreSupport.java:3935)
> >> >> >     at
> >> >> >
> >> >>
> >>
> org.apache.openejb.quartz.impl.jdbcjobstore.JobStoreSupport$MisfireHandler.run(JobStoreSupport.java:3956)
> >> >> > Caused by: java.lang.ClassNotFoundException: test.HelloJob
> >> >> >     at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
> >> >> >     at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
> >> >> >     at java.security.AccessController.doPrivileged(Native Method)
> >> >> >     at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
> >> >> >     at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
> >> >> >     at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
> >> >> >     at
> >> >> >
> >> >>
> >>
> org.apache.openejb.quartz.simpl.InitThreadContextClassLoadHelper.loadClass(InitThreadContextClassLoadHelper.java:72)
> >> >> >     at
> >> >> >
> >> >>
> >>
> org.apache.openejb.quartz.simpl.CascadingClassLoadHelper.loadClass(CascadingClassLoadHelper.java:114)
> >> >> >     at
> >> >> >
> >> >>
> >>
> org.apache.openejb.quartz.simpl.CascadingClassLoadHelper.loadClass(CascadingClassLoadHelper.java:138)
> >> >> >     at
> >> >> >
> >> >>
> >>
> org.apache.openejb.quartz.impl.jdbcjobstore.StdJDBCDelegate.selectJobDetail(StdJDBCDelegate.java:852)
> >> >> >     at
> >> >> >
> >> >>
> >>
> org.apache.openejb.quartz.impl.jdbcjobstore.JobStoreSupport.storeTrigger(JobStoreSupport.java:1205)
> >> >> >     ... 5 more
> >> >> >
> >> >> >
> >> >> >
> >> >> > []
> >> >> >
> >> >> > Leo
> >> >> >
> >> >> > On Tue, Oct 21, 2014 at 1:19 PM, Andy Gumbrecht <
> >> >> agumbre...@tomitribe.com>
> >> >> > wrote:
> >> >> >
> >> >> >> You're concerned that TomEE will not be able to see the
> >> HelloJob.class
> >> >> >> defined in your app/jar.
> >> >> >> This is the job of quartz to ensure that it has your classloader
> >> correct
> >> >> >> when you add the job. It 'should' be fine, but just write a small
> >> test
> >> >> to
> >> >> >> convince yourself ;)
> >> >> >>
> >> >> >> Andy.
> >> >> >>
> >> >> >>
> >> >> >> On 21/10/2014 16:13, Leonardo K. Shikida wrote:
> >> >> >>
> >> >> >>> yes, but quartz will be loaded by a different classloader, right?
> >> >> >>>
> >> >> >>> because when I try
> >> >> >>>
> >> >> >>>          JobDetail jobDetail = newJob(HelloJob.class)
> >> >> >>>                  .withIdentity(name+"", "group1")
> >> >> >>>                  .build();
> >> >> >>>
> >> >> >>>
> >> >> >>> HelloJob will be in the webapp, but quartz will be probably under
> >> >> tomee,
> >> >> >>> so
> >> >> >>> will quartz find the HelloJob class?
> >> >> >>>
> >> >> >>>
> >> >> >>> []
> >> >> >>>
> >> >> >>> Leo
> >> >> >>>
> >> >> >>> On Tue, Oct 21, 2014 at 9:15 AM, Romain Manni-Bucau <
> >> >> >>> rmannibu...@tomitribe.com> wrote:
> >> >> >>>
> >> >> >>>  this is the same quartz as standard one, just packages are
> >> different.
> >> >> >>>> So all you can do with quartz can be done out of the box
> >> >> >>>> Romain Manni-Bucau
> >> >> >>>> Twitter: @rmannibucau
> >> >> >>>> Blog: http://rmannibucau.wordpress.com/
> >> >> >>>> LinkedIn: http://fr.linkedin.com/in/rmannibucau
> >> >> >>>> Github: https://github.com/rmannibucau
> >> >> >>>>
> >> >> >>>>
> >> >> >>>>
> >> >> >>>> 2014-10-21 13:07 GMT+02:00 Leonardo K. Shikida <
> shik...@gmail.com
> >> >:
> >> >> >>>>
> >> >> >>>>> is there a way to create a quartz job using the shaded classes?
> >> >> >>>>>
> >> >> >>>>> it seems to me that only the functions needed by tomee are
> >> available
> >> >> >>>>>
> >> >> >>>> there
> >> >> >>>>
> >> >> >>>>> []
> >> >> >>>>>
> >> >> >>>>> Leo
> >> >> >>>>>
> >> >> >>>>> On Tue, Oct 21, 2014 at 7:36 AM, Romain Manni-Bucau <
> >> >> >>>>> rmannibu...@tomitribe.com> wrote:
> >> >> >>>>>
> >> >> >>>>>  it is compatible is you configure it manually in application
> >> >> >>>>>> properties or openejb-jar.xml but that's all.
> >> >> >>>>>> Romain Manni-Bucau
> >> >> >>>>>> Twitter: @rmannibucau
> >> >> >>>>>> Blog: http://rmannibucau.wordpress.com/
> >> >> >>>>>> LinkedIn: http://fr.linkedin.com/in/rmannibucau
> >> >> >>>>>> Github: https://github.com/rmannibucau
> >> >> >>>>>>
> >> >> >>>>>>
> >> >> >>>>>>
> >> >> >>>>>> 2014-10-21 11:34 GMT+02:00 Leonardo K. Shikida <
> >> shik...@gmail.com>:
> >> >> >>>>>>
> >> >> >>>>>>> I've also read somewhere that tomee would be backward
> compatible
> >> >> again
> >> >> >>>>>>>
> >> >> >>>>>> with
> >> >> >>>>>>
> >> >> >>>>>>> the old quartz properties.
> >> >> >>>>>>>
> >> >> >>>>>>> If so, won't be a conflict?
> >> >> >>>>>>>
> >> >> >>>>>>> []
> >> >> >>>>>>>
> >> >> >>>>>>> Leo
> >> >> >>>>>>>
> >> >> >>>>>>> On Tue, Oct 21, 2014 at 7:17 AM, Andy <andy...@gmx.de>
> wrote:
> >> >> >>>>>>>
> >> >> >>>>>>>  Leo,
> >> >> >>>>>>>>
> >> >> >>>>>>>> Just read something that indicates that maybe our
> >> >> quartz.properties
> >> >> >>>>>>>>
> >> >> >>>>>>> is
> >> >> >>>>
> >> >> >>>>> sometimes found first. So it is probably best to set the
> >> >> >>>>>>>> 'org.quartz.properties' in the cong/system.properties file
> to
> >> >> point
> >> >> >>>>>>>>
> >> >> >>>>>>> to
> >> >> >>>>
> >> >> >>>>> the
> >> >> >>>>>>
> >> >> >>>>>>> quartz.properties you want to use.
> >> >> >>>>>>>>
> >> >> >>>>>>>> Andy.
> >> >> >>>>>>>>
> >> >> >>>>>>>>
> >> >> >>>>>>>> On 21/10/2014 00:57, Andy wrote:
> >> >> >>>>>>>>
> >> >> >>>>>>>>  Sure, if you want your app to be portable then add a quartz
> >> jar -
> >> >> >>>>>>>>>
> >> >> >>>>>>>> That's
> >> >> >>>>>>
> >> >> >>>>>>> why ours is shaded, to avoid conflicts.
> >> >> >>>>>>>>>
> >> >> >>>>>>>>> Of course, if you never leave TomEE then you can use the
> >> shaded
> >> >> one
> >> >> >>>>>>>>>
> >> >> >>>>>>>> ;-)
> >> >> >>>>
> >> >> >>>>> Andy.
> >> >> >>>>>>>>>
> >> >> >>>>>>>>> On 21/10/2014 00:30, Leonardo K. Shikida wrote:
> >> >> >>>>>>>>>
> >> >> >>>>>>>>>  Hi
> >> >> >>>>>>>>>>
> >> >> >>>>>>>>>> I'd like to create quartz timers not using TimerServiceAPI
> >> >> >>>>>>>>>>
> >> >> >>>>>>>>>> Is it possible to be done using the new shaded quartz
> >> classes or
> >> >> >>>>>>>>>>
> >> >> >>>>>>>>> should I
> >> >> >>>>>>
> >> >> >>>>>>> add another quartz jar to the project?
> >> >> >>>>>>>>>>
> >> >> >>>>>>>>>> If I have to add the quartz jar, is it safe?
> >> >> >>>>>>>>>>
> >> >> >>>>>>>>>> TIA
> >> >> >>>>>>>>>>
> >> >> >>>>>>>>>> Leo
> >> >> >>>>>>>>>>
> >> >> >>>>>>>>>>
> >> >> >>>>>>>>>>
> >> >> >>>>>>>>>
> >> >> >>>>>>>>>
> >> >> >> --
> >> >> >>   Andy Gumbrecht
> >> >> >>   https://twitter.com/AndyGeeDe
> >> >> >>   http://www.tomitribe.com
> >> >> >>
> >> >> >>
> >> >>
> >>
>

Reply via email to