[jboss-dev-forums] [JBoss AS 7 Development] - Quartz Scheduler in Jboss AS 7

Ifta Khirul do-not-reply at jboss.com
Fri Nov 9 03:17:34 EST 2012


Ifta Khirul [https://community.jboss.org/people/ifti24] created the discussion

"Quartz Scheduler in Jboss AS 7"

To view the discussion, visit: https://community.jboss.org/message/775697#775697

--------------------------------------------------------------
Hi,

I'm trying to implement quartz scheduler in on of my EJB application with Jboss AS 7.
I have included quartz-jboss-2.1.6.jar and quartz-all-2.1.6 jar in my EJB application.

I have implemented my SchedulerBean in the following way -

{code}
@Startup
@Singleton
public class SchedulerBean {


  @PostConstruct
  void init() {

    try {
      Scheduler sched = new StdSchedulerFactory().getScheduler();

      // schedule jobs here

      JobDetail testjob = JobBuilder.newJob(TestJob.class).withIdentity("testjob", "testgroup").build();  

                        SimpleTrigger trigger = TriggerBuilder.newTrigger()  
                          .withIdentity("testtrigger", "testgroup")  
                          .withSchedule(SimpleScheduleBuilder.simpleSchedule()  
                             .withIntervalInSeconds(10)  
                             .repeatForever())  
                          .build();  

                        sched.scheduleJob(testjob, trigger);



      sched.start();
    }
    catch (Throwable t) {
      // log exception
    }
  }
}

{code}

And below is the  TestJob Class


{code}
public class TestJob implements Job {
            @Override
            public void execute(JobExecutionContext context) throws JobExecutionException {
              System.out.println("Quartz test job executed!");
            }
          }
{code}

Everything is ok in the compile time. But when I start my application (Then Enterprise application) I got the following Error -

----------------

Caused by: java.lang.NoClassDefFoundError: org/quartz/ScheduleBuilder
          at java.lang.Class.getDeclaredFields0(Native Method) [rt.jar:1.7.0_09]
          at java.lang.Class.privateGetDeclaredFields(Class.java:2308) [rt.jar:1.7.0_09]
          at java.lang.Class.getDeclaredFields(Class.java:1760) [rt.jar:1.7.0_09]
          at org.jboss.as.server.deployment.reflect.ClassReflectionIndex.<init>(ClassReflectionIndex.java:57) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
          at org.jboss.as.server.deployment.reflect.DeploymentReflectionIndex.getClassIndex(DeploymentReflectionIndex.java:66) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
          ... 10 more
Caused by: java.lang.ClassNotFoundException: org.quartz.ScheduleBuilder from [Module "deployment.TestEnterpriseProject.ear.TestEjbProject.jar:main" from Service Module Loader]
          at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:190)
          at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:468)
          at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:456)
          at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398)
          at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:120)
          ... 15 more
-----------------

Can anybody help me to findout a way to solve this issue please ?
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/775697#775697]

Start a new discussion in JBoss AS 7 Development at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2225]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-dev-forums/attachments/20121109/ecf2def9/attachment.html 


More information about the jboss-dev-forums mailing list