3 Replies Latest reply on Mar 12, 2014 12:42 AM by sfcoy

    integrationissue with quartz 2.1.3 and jboss 7 AS

    rajeev.solanki

      i am using quartz for execute my data collection jobs. my project jar gets bundled in a my applicaiton ear.

      i have also added quartz-all jar under my ear lib directory.

       

      How i am initializing quartz:

      1. using a @Startup bean i initiate the Quartz Standard scheduler. - this is working fine.

      2. My stateless bean creates a POJO object which contains the configuration or the data to be collected .

      in this bean  create the Quartz jobs as below:

       

      JobDetail job = JobBuilder.newJob(MyJOBClass.class).withIdentity(jk).build();

      job.getJobDataMap().put(KEY,MyConfigMOObject);

      Trigger trigger = TriggerBuilder.newTrigger().withSchedule(SimpleScheduleBuilder.simpleSchedule().withIntervalInMinutes(10).repeatForever()).build();

      trigger.getTriggerBuilder().usingJobData(job.getJobDataMap());

      Scheduler scheduler = new StdSchedulerFactory().getScheduler("MySchedulerName");

      scheduler.scheduleJob(job,trigger);


      All the above is working fine the problem happens when the execute() method of my job class is invoked. At this point Quartz trigger misfires complaining about the POJO object which i added in the JobDataMap.

      It throws Class not found: java.lang.ClassNotFoundException.


      When i modified the above by replacing the pojo object with a String object quartz is able to fire the trigger and execute the job.


      it looks like a class path dependency issue where quartz is not able to find my class, but i am not getting how to make quartz aware of my class. As i said using ant iam already placing the quartz all jar in my ear/lib folder.


      Can someone please help me in this


        • 1. Re: integrationissue with quartz 2.1.3 and jboss 7 AS
          sfcoy

          If the POJO class is defined in the EJB jar then Quartz will not be able to to "see" it as they exist in different class loaders. You need to move the POJO class into a jar in the EAR/lib directory so that it shares the same class loader as quartz and yet is still visible to the EJB jar.

          1 of 1 people found this helpful
          • 2. Re: integrationissue with quartz 2.1.3 and jboss 7 AS
            rajeev.solanki

            Hi Stephen,

             

            Thanks for your looks it will work. I need one more clarification, at present my pojo classes are bundled in shared project jar which is add a project dependency to my jar and thats how it is visible to my jar.

            What want to understand here is that to make my POJO visible to quartz i have to put this pojo bundle in lib ? please correct me if im gettingn it wrong?

            • 3. Re: integrationissue with quartz 2.1.3 and jboss 7 AS
              sfcoy

              That is exactly right.

               

              All jars in the EAR/lib directory share a class loader that  makes classes available to all other modules (such as EJB jars and WARs) in the EAR.

               

              However, the EAR/lib class loader cannot see the classes in those other modules.