[jboss-jira] [JBoss JIRA] Created: (JBAS-6935) Quartz cannot find persistence.xml

Adam Michalik (JIRA) jira-events at lists.jboss.org
Mon May 18 08:33:06 EDT 2009


Quartz cannot find persistence.xml
----------------------------------

                 Key: JBAS-6935
                 URL: https://jira.jboss.org/jira/browse/JBAS-6935
             Project: JBoss Application Server
          Issue Type: Bug
      Security Level: Public (Everyone can see)
          Components: Scheduling/Timers
    Affects Versions: JBossAS-5.0.1.GA
            Reporter: Adam Michalik
            Assignee: Dimitris Andreadis


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.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the jboss-jira mailing list