0 Replies Latest reply on Aug 6, 2012 7:09 AM by Philippe Gervaise

    Module :  java.lang.ClassNotFoundException (while using a class from a deployment)

    Philippe Gervaise Newbie

      Hi,

       

      I'm using Quartz 2.1.5 as a module in JBoss AS 7.1.1 :

       

      <?xml version="1.0" encoding="UTF-8"?>
      
      <module xmlns="urn:jboss:module:1.1" name="org.quartz" slot="main">
          <resources>
              <resource-root path="quartz-2.1.5.jar"/>
          </resources>
      
          <dependencies>
              <module name="org.slf4j"/>
              <module name="javax.transaction.api"/>
      
              <system export="false">
                  <paths>
                      <path name="org/xml/sax"/>
                      <path name="javax/xml/namespace" />
                      <path name="javax/xml/parsers" />
                      <path name="javax/xml/xpath" />
                      <path name="org/w3c/dom" />
                  </paths>
              </system>
          </dependencies>
      </module>
      

       

      It's ok for a JAR (in a EAR) for using Quartz module (with the help of an jboss-deployment-structure.xml file) i.e. I can use :

       

      schedulerFactory = new StdSchedulerFactory();
      

       

      BUT that piece of code read a XML file and register different jobs (each job as a class which is contained in the deployed EAR). The problem is when doing :

       

      schedulerFactory.getScheduler().start();
      

       

      I got that exception :

       

      12:38:12,763 ERROR [org.quartz.plugins.xml.XMLSchedulingDataProcessorPlugin] (MSC service thread 1-4) Error scheduling jobs: com.rsa.azur.server.jbossService.quartz.jobs.PayboxQueuedTrames from [Module "org.jboss.as.jmx:main" from local module loader @28305d (roots: D:\Appli\jboss-as-7.1.1.Final\modules)]: java.lang.ClassNotFoundException: com.rsa.azur.server.jbossService.quartz.jobs.PayboxQueuedTrames from [Module "org.jboss.as.jmx:main" from local module loader @28305d (roots: D:\Appli\jboss-as-7.1.1.Final\modules)]
          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)
          at org.quartz.simpl.InitThreadContextClassLoadHelper.loadClass(InitThreadContextClassLoadHelper.java:72)
          at org.quartz.simpl.CascadingClassLoadHelper.loadClass(CascadingClassLoadHelper.java:114)
          at org.quartz.simpl.CascadingClassLoadHelper.loadClass(CascadingClassLoadHelper.java:138)
          at org.quartz.xml.XMLSchedulingDataProcessor.process(XMLSchedulingDataProcessor.java:653)
          at org.quartz.xml.XMLSchedulingDataProcessor.processFile(XMLSchedulingDataProcessor.java:503)
          at org.quartz.xml.XMLSchedulingDataProcessor.processFileAndScheduleJobs(XMLSchedulingDataProcessor.java:886)
          at org.quartz.plugins.xml.XMLSchedulingDataProcessorPlugin.processFile(XMLSchedulingDataProcessorPlugin.java:330)
          at org.quartz.plugins.xml.XMLSchedulingDataProcessorPlugin.start(XMLSchedulingDataProcessorPlugin.java:257)
          at org.quartz.plugins.SchedulerPluginWithUserTransactionSupport.start(SchedulerPluginWithUserTransactionSupport.java:144)
          at org.quartz.core.QuartzScheduler.startPlugins(QuartzScheduler.java:2343)
          at org.quartz.core.QuartzScheduler.start(QuartzScheduler.java:527)
          at org.quartz.impl.StdScheduler.start(StdScheduler.java:143)
          at com.rsa.azur.server.jbossService.quartz.QuartzService.startService(QuartzService.java:221)
          at com.rsa.azur.server.jbossService.quartz.AzurQuartzService.startService(AzurQuartzService.java:55)
          at com.rsa.azur.server.jbossService.quartz.QuartzService.postRegister(QuartzService.java:73)
          at com.sun.jmx.mbeanserver.MBeanSupport.postRegister(MBeanSupport.java:192) [rt.jar:1.6.0_31]
          at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.postRegisterInvoke(DefaultMBeanServerInterceptor.java:1035) [rt.jar:1.6.0_31]
          at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerDynamicMBean(DefaultMBeanServerInterceptor.java:974) [rt.jar:1.6.0_31]
          at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerObject(DefaultMBeanServerInterceptor.java:917) [rt.jar:1.6.0_31]
          at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerMBean(DefaultMBeanServerInterceptor.java:312) [rt.jar:1.6.0_31]
          at com.sun.jmx.mbeanserver.JmxMBeanServer.registerMBean(JmxMBeanServer.java:482) [rt.jar:1.6.0_31]
          at org.jboss.as.jmx.PluggableMBeanServerImpl$TcclMBeanServer.registerMBean(PluggableMBeanServerImpl.java:522) [jboss-as-jmx-7.1.1.Final.jar:7.1.1.Final]
          at org.jboss.as.jmx.PluggableMBeanServerImpl.registerMBean(PluggableMBeanServerImpl.java:290) [jboss-as-jmx-7.1.1.Final.jar:7.1.1.Final]
          at org.jboss.as.jmx.MBeanRegistrationService.start(MBeanRegistrationService.java:90) [jboss-as-jmx-7.1.1.Final.jar:7.1.1.Final]
          at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
          at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
          at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [rt.jar:1.6.0_31]
          at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [rt.jar:1.6.0_31]
          at java.lang.Thread.run(Thread.java:662) [rt.jar:1.6.0_31]
      

       

       

      I know that the problem is class access in the Quartz module : Quartz can't access the deployed class (but deployed class can access Quartz classes). How to solve this problem ?!?

       

      The jboss-deployment-structure.xml file is the EAR is :

       

      <?xml version="1.0" encoding="UTF-8"?>
      
      <jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.1">
          <ear-subdeployments-isolated>false</ear-subdeployments-isolated>
      
          <deployment>
              <dependencies>
                  <module name="org.hibernate" />
                  <module name="org.jdom" />
                  <module name="org.quartz" export="true" />
              </dependencies>
          </deployment>
      </jboss-deployment-structure>
      

       

      Thanks.

       

       

      Edit :

       

      The errors seems to occurs only because start() is called in a "postRegister" in a JMX bean. When start() is called by a JMX operation (so, after deployment done) it's ok ...

       

      So when a MBean is using a module that module can't access deployed class in a preRegister and postRegister methods ?? (they are part of MBeanRegistration interface)