1 Reply Latest reply on Jun 22, 2009 2:35 AM by jaikiran pai

    Quartz usage with inheritance

    Noa Drach Novice

      I have an MDB that is activated by the @ResourceAdapter("quartz-ra.rar").

      my MDB doesn't implement the Job interface, but extends another class that implements this interface.

      In JBOSS 4.2.3.GA it works great.

      when I tried to deploy my MDB on JBOSS 5.0.1.GA i received the following error

      org.jboss.deployers.spi.DeploymentException: Error deploying QuartzUsageAS5.jar: Error creating ejb container WithInheritance: Unable to choose messagingType interface for MDB WithInheritance from []
      at org.jboss.ejb3.deployers.Ejb3Deployer.deploy(Ejb3Deployer.java:201)
      at org.jboss.ejb3.deployers.Ejb3Deployer.deploy(Ejb3Deployer.java:103)
      at org.jboss.deployers.vfs.spi.deployer.AbstractVFSRealDeployer.internalDeploy(AbstractVFSRealDeployer.java:45)
      at org.jboss.deployers.spi.deployer.helpers.AbstractRealDeployer.deploy(AbstractRealDeployer.java:50)
      at org.jboss.deployers.plugins.deployers.DeployerWrapper.deploy(DeployerWrapper.java:171)
      at org.jboss.deployers.plugins.deployers.DeployersImpl.doDeploy(DeployersImpl.java:1439)
      at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1157)
      at org.jboss.deployers.plugins.deployers.DeployersImpl.install(DeployersImpl.java:1098)
      at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:348)
      at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1598)
      at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:934)
      at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1062)
      at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:984)
      at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:822)
      at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:553)
      at org.jboss.deployers.plugins.deployers.DeployersImpl.process(DeployersImpl.java:781)
      at org.jboss.deployers.plugins.main.MainDeployerImpl.process(MainDeployerImpl.java:698)
      at org.jboss.system.server.profileservice.ProfileServiceBootstrap.loadProfile(ProfileServiceBootstrap.java:304)
      at org.jboss.system.server.profileservice.ProfileServiceBootstrap.start(ProfileServiceBootstrap.java:205)
      at org.jboss.bootstrap.AbstractServerImpl.start(AbstractServerImpl.java:405)
      at org.jboss.Main.boot(Main.java:209)
      at org.jboss.Main$1.run(Main.java:547)
      at java.lang.Thread.run(Unknown Source)
      Caused by: org.jboss.deployers.spi.DeploymentException: Error creating ejb container WithInheritance: Unable to choose messagingType interface for MDB WithInheritance from []
      at org.jboss.ejb3.Ejb3Deployment.deployElement(Ejb3Deployment.java:682)
      at org.jboss.ejb3.Ejb3Deployment.deployElement(Ejb3Deployment.java:628)
      at org.jboss.ejb3.Ejb3Deployment.deployUrl(Ejb3Deployment.java:610)
      at org.jboss.ejb3.Ejb3Deployment.deploy(Ejb3Deployment.java:573)
      at org.jboss.ejb3.Ejb3Deployment.create(Ejb3Deployment.java:488)
      at org.jboss.ejb3.deployers.Ejb3Deployer.deploy(Ejb3Deployer.java:187)
      ... 22 more
      Caused by: java.lang.RuntimeException: Unable to choose messagingType interface for MDB WithInheritance from []
      at org.jboss.ejb3.mdb.MDB.getMessagingType(MDB.java:76)
      at org.jboss.ejb3.mdb.MDB.resolveBusinessInterfaces(MDB.java:132)
      at org.jboss.ejb3.EJBContainer.instantiated(EJBContainer.java:1564)
      at org.jboss.ejb3.Ejb3Deployment.deployElement(Ejb3Deployment.java:676)
      ... 27 more
      16:45:13,905 ERROR [ProfileServiceBootstrap] Failed to load profile: Summary of incomplete deployments (SEE PREVIOUS ERRORS FOR DETAILS):


      This is a sample code that works for both server versions. Note that the ResourceAdapter moved between the version so you need to uncomment the imports

      This is the MDB without inheritance
      package test.quartz.jboss;
      
      import javax.ejb.ActivationConfigProperty;
      import javax.ejb.MessageDriven;
      
      // For Jboss 4.x
      //import org.jboss.annotation.ejb.ResourceAdapter;
      
      // For Jboss 5.x
      //import org.jboss.ejb3.annotation.ResourceAdapter;
      
      import org.quartz.Job;
      import org.quartz.JobExecutionContext;
      import org.quartz.JobExecutionException;
      
      @MessageDriven(activationConfig = { @ActivationConfigProperty(propertyName = "cronTrigger", propertyValue = "0/2 * * * * ?") })
      @ResourceAdapter("quartz-ra.rar")
      public class WithoutInheritance implements Job {
      
       @Override
       public void execute(JobExecutionContext context) throws JobExecutionException {
       System.out.println("without inheritance");
       }
      }


      This is the base class for the inheritance
      package test.quartz.jboss;
      
      import org.quartz.Job;
      import org.quartz.JobExecutionContext;
      import org.quartz.JobExecutionException;
      
      public class QuartzBase implements Job {
      
       @Override
       public void execute(JobExecutionContext arg0) throws JobExecutionException {
       System.out.println("with inheritance");
       }
      }


      This is the inheriting MDB
      package test.quartz.jboss;
      
      import javax.ejb.ActivationConfigProperty;
      import javax.ejb.MessageDriven;
      
      // For Jboss 4.x
      //import org.jboss.annotation.ejb.ResourceAdapter;
      
      // For Jboss 5.x
      //import org.jboss.ejb3.annotation.ResourceAdapter;
      
      @MessageDriven(activationConfig = { @ActivationConfigProperty(propertyName = "cronTrigger", propertyValue = "0/1 * * * * ?") })
      @ResourceAdapter("quartz-ra.rar")
      public class WithInheritance extends QuartzBase {
      }


      Looks like a bug to me but I wanted to make sure first.