1 Reply Latest reply on Feb 25, 2009 6:18 AM by jaikiran pai

    Problems running Quartz Scheduler Integration within an MDB

    Amit Kumar Newbie

      I am trying to execute an MDB for running a scheduled job using the Quartz integration.

      //@Interceptors(SpringBeanAutowiringInterceptor.class) //Commented
      @ResourceAdapter("quartz-ra.rar")
      public class ChangeEventsAggregatorTimerMDB implements Job
      {
       private static final long serialVersionUID = -7135493106969547584L;
       private static final Logger LOGGER = LogFactory.createLogger(ChangeEventsAggregatorTimerMDB.class);
      
       @Resource
       protected MessageDrivenContext ctx = null;
      
      
       public void execute(JobExecutionContext arg0) throws JobExecutionException
       {
       System.out.println("Hello Worlds !!!! ");
       LOGGER.debug("Hello Worlds !!!! ");
      
       }
      
      }


      The classloading is isolated at the ear level using
      <jboss-app>
       <loader-repository>
       com.xxxx.cdm.loader.productCatalogIntegration:archive=productCatalogIntegration.ear
       </loader-repository>
      </jboss-app>


      I am getting an exception stacktrace :


      [java] 10:56:50,024 INFO [STDOUT] Configuring Logging Subsystem
      [java] 10:56:50,039 INFO [STDOUT] Watching Log4J configuration: /log4j.xml
      [java] 10:56:50,070 ERROR [STDERR] log4j:ERROR A "org.apache.log4j.xml.DOMConfigurator" object is not assignable to a "org.apache.log4j.spi.Configurator" variable.
      [java] 10:56:50,070 ERROR [STDERR] log4j:ERROR The class "org.apache.log4j.spi.Configurator" was loaded by
      [java] 10:56:50,070 ERROR [STDERR] log4j:ERROR [org.jboss.mx.loading.UnifiedClassLoader3@eb49a6{ url=file:/C:/JBoss-EAP-4.3.0.GA_CP02/jboss-as/server/bgprocs/deploy/CatalogByProductSelector/Catal
      ogByProductSelector.ear/ ,addedOrder=44}] whereas object of type
      [java] 10:56:50,070 ERROR [STDERR] log4j:ERROR "org.apache.log4j.xml.DOMConfigurator" was loaded by [org.jboss.mx.loading.UnifiedClassLoader3@14ab51b{ url=null ,addedOrder=2}].
      [java] 10:56:50,070 ERROR [STDERR] log4j:ERROR Could not instantiate configurator [org.apache.log4j.xml.DOMConfigurator].
      [java] 10:56:50,086 ERROR [STDERR] log4j:ERROR Could not create an Appender. Reported error follows.
      [java] 10:56:50,086 ERROR [STDERR] java.lang.ClassCastException: org.apache.log4j.RollingFileAppender cannot be cast to org.apache.log4j.Appender
      [java] 10:56:50,086 ERROR [STDERR] at org.apache.log4j.xml.DOMConfigurator.parseAppender(DOMConfigurator.java:175)
      [java] 10:56:50,086 ERROR [STDERR] at org.apache.log4j.xml.DOMConfigurator.findAppenderByName(DOMConfigurator.java:150)
      [java] 10:56:50,086 ERROR [STDERR] at org.apache.log4j.xml.DOMConfigurator.findAppenderByReference(DOMConfigurator.java:163)
      [java] 10:56:50,086 ERROR [STDERR] at org.apache.log4j.xml.DOMConfigurator.parseChildrenOfLoggerElement(DOMConfigurator.java:425)
      [java] 10:56:50,086 ERROR [STDERR] at org.apache.log4j.xml.DOMConfigurator.parseCategory(DOMConfigurator.java:345)
      [java] 10:56:50,086 ERROR [STDERR] at org.apache.log4j.xml.DOMConfigurator.parse(DOMConfigurator.java:827)
      [java] 10:56:50,086 ERROR [STDERR] at org.apache.log4j.xml.DOMConfigurator.doConfigure(DOMConfigurator.java:712)
      [java] 10:56:50,086 ERROR [STDERR] at org.apache.log4j.xml.DOMConfigurator.doConfigure(DOMConfigurator.java:604)
      [java] 10:56:50,086 ERROR [STDERR] at org.apache.log4j.xml.XMLWatchdog.doOnChange(DOMConfigurator.java:861)
      [java] 10:56:50,086 ERROR [STDERR] at org.apache.log4j.helpers.FileWatchdog.checkAndConfigure(FileWatchdog.java:88)
      [java] 10:56:50,086 ERROR [STDERR] at org.apache.log4j.helpers.FileWatchdog.(FileWatchdog.java:57)
      [java] 10:56:50,086 ERROR [STDERR] at org.apache.log4j.xml.XMLWatchdog.(DOMConfigurator.java:853)
      [java] 10:56:50,086 ERROR [STDERR] at org.apache.log4j.xml.DOMConfigurator.configureAndWatch(DOMConfigurator.java:584)

      The scheduling works at the 10 sec interval and the bean writes to the System.out. However this exception is not shown when the MDB doesn't implement the Quartz interface and runs like a regular MDB. The Spring Interceptor also doesn't work with the Quartz interface.
      The ear doesn't have any Quartz libraries.
      I suspect it is an issue with classloaders. Is there an additional parameter that needs to be tweaked to make the classloading work?
      Log4j version is 1.2.13

      System Details:

      JBoss [EAP] 4.3.0.GA_CP02 (build: SVNTag=JBPAPP_4_3_0_GA_CP02 date=200808051050)
      Java version: 1.6.0_10,Sun Microsystems Inc
      Operating System : Windows XP