Search code examples
javajbossejbquartz-schedulerjboss5.x

Quartz - ClassCastException


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

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

this is the exception:

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

anyone has any idea?

Thanks.


Solution

  • You most likely have two copies of the Quartz JAR in your classpath - JBoss has its own copy, and your application probably has one too, in its lib directory. The two are clashing.

    Remove the JAR from your application and try again.