Uploaded image for project: 'Application Server 3  4  5 and 6'
  1. Application Server 3 4 5 and 6
  2. JBAS-6935

Quartz cannot find persistence.xml

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Obsolete
    • Icon: Major Major
    • No Release
    • JBossAS-5.0.1.GA
    • Scheduling/Timers
    • None

      I try to schedule a recurring connection to a database using JBoss's Quartz. The project is a Seam exploded WAR. The persistence.xml file is located in deploy/<project>/WEB-INF/classes/META-INF (when in <project>/META-INF the behaviour is the same). Normal connection to the DB works fine. However, when the Quarts job is executed, I get:

      14:12:15,919 INFO [Ejb3Configuration] Could not find any META-INF/persistence.xml file in the classpath
      14:12:15,921 ERROR [JobRunShell] Job DEFAULT.myJob threw an unhandled Exception:
      javax.persistence.PersistenceException: No Persistence provider for EntityManager named myProject
      at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:56)
      at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:34)
      at pl.ds.session.PacketManager.updatePackets(PacketManager.java:47)
      at pl.ds.session.UpdatePacketsJob.execute(UpdatePacketsJob.java:10)
      at org.quartz.core.JobRunShell.run(JobRunShell.java:203)
      at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:520)

      The line that causes the error is:
      EntityManagerFactory emf = Persistence.createEntityManagerFactory("myProject");

      Clearly the persistence.xml file seen in the project's classpath is not seen in quartz's. The workaround is to update Quartz in JBoss:
      In deploy directory:

      • remove quartz-ra.rar
      • add quartz-services.xml

      <?xml version="1.0" encoding="UTF-8"?> <server>
      <mbean code="org.quartz.ee.jmx.jboss.QuartzService"
      name="user:service=QuartzService,name=QuartzService">
      <attribute name="JndiName">java:/Quartz</attribute>
      <attribute name="Properties">
      org.quartz.scheduler.instanceName = DefaultQuartzScheduler
      org.quartz.scheduler.rmi.export = false
      org.quartz.scheduler.rmi.proxy = false
      org.quartz.scheduler.xaTransacted = false
      org.quartz.threadPool.class = org.quartz.simpl.SimpleThreadPool
      org.quartz.threadPool.threadCount = 5
      org.quartz.threadPool.threadPriority = 4
      org.quartz.jobStore.class = org.quartz.simpl.RAMJobStore
      </attribute>
      </mbean>
      </server>

      In lib directory:

      • add quartz-all-1.6.5.jar (download from quartz's site)

      This issue is related to JBAS-6133.

            dandread1@redhat.com Dimitrios Andreadis
            adammichalik Adam Michalik (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: