Quartz - ClassCastException

I am using Jboss5.1.x, EJB3.0 I am trying to configure Quartz. I get this exception when I try to search:

       InitialContext ctx = new InitialContext();
        StdScheduler scheduler = (StdScheduler) ctx.lookup("Quartz");

This is an exception:

java.lang.ClassCastException: org.quartz.impl.StdScheduler cannot be passed to org.quartz.Scheduler

Somebody knows?

Thank.

+3
source share
3 answers

You most likely have two copies of Quartz JAR in your class path - JBoss has its own copy, and your application probably also has it in its directory lib. They collide.

Remove the JAR from the application and try again.

+4
source

This is because you have a scheduler associated with JNDI, so you must do this:

 Scheduler scheduler = (Scheduler) ctx.lookup("Quartz");

, , .

+1

The solution is to install quartzservicein jboss-service.xmlin META-INF.

 <module>
     <service>quartzservice.sar</service>
 </module>

What is it. The service is tied and can be used from the entire EAR.

0
source

Source: https://habr.com/ru/post/1789457/


All Articles