2017-10-30 29 views
1

私は、mysqlデータベースでクォーツスケジューラを設定しようとしています。誰かが私にこれを手伝ってもらえますか?クォーツスケジューラデータソースからDB接続を取得できません

c3p0-0.9.1.1.jar
JTA-1.1.jar
のmysql-コネクタ-javaの-5.1.27.jar
石英-2.2.1:

私は以下のjarファイルが含まれています。 jarファイル
石英ジョブ-2.2.1.jar
SLF4J-API-1.7.10.jar
SLF4J-単純1.7.25.jar

[LMWJobScheduler_QuartzSchedulerThread] ERROR org.quartz.core.ErrorLogger - An error occurred while scanning for the next triggers to fire. 
org.quartz.JobPersistenceException: Failed to obtain DB connection from data source 'myDS': java.sql.SQLException: com.mchange.v2.c3p0.ComboPooledDataSource [ java.beans.IntrospectionException: java.lang.reflect.InvocationTargetException [lastAcquisitionFailureDefaultUser] ] has been closed() -- you can no longer use it. [See nested exception: java.sql.SQLException: com.mchange.v2.c3p0.ComboPooledDataSource [ java.beans.IntrospectionException: java.lang.reflect.InvocationTargetException [lastAcquisitionFailureDefaultUser] ] has been closed() -- you can no longer use it.] 
at org.quartz.impl.jdbcjobstore.JobStoreSupport.getConnection(JobStoreSupport.java:778) 
at org.quartz.impl.jdbcjobstore.JobStoreTX.getNonManagedTXConnection(JobStoreTX.java:71) 
at org.quartz.impl.jdbcjobstore.JobStoreSupport.executeInNonManagedTXLock(JobStoreSupport.java:3784) 
at org.quartz.impl.jdbcjobstore.JobStoreSupport.acquireNextTriggers(JobStoreSupport.java:2756) 
at org.quartz.core.QuartzSchedulerThread.run(QuartzSchedulerThread.java:272) 
Caused by: java.sql.SQLException: com.mchange.v2.c3p0.ComboPooledDataSource [ java.beans.IntrospectionException: java.lang.reflect.InvocationTargetException [lastAcquisitionFailureDefaultUser] ] has been closed() -- you can no longer use it. 
at com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource.assertCpds(AbstractPoolBackedDataSource.java:447) 
at com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource.getPoolManager(AbstractPoolBackedDataSource.java:459) 
at com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource.getConnection(AbstractPoolBackedDataSource.java:128) 
at org.quartz.utils.PoolingConnectionProvider.getConnection(PoolingConnectionProvider.java:247) 
at org.quartz.utils.DBConnectionManager.getConnection(DBConnectionManager.java:108) 
at org.quartz.impl.jdbcjobstore.JobStoreSupport.getConnection(JobStoreSupport.java:775) 
... 4 more 

T彼はquartz.properties

org.quartz.scheduler.instanceName: JobScheduler 
org.quartz.scheduler.instanceId: AUTO 
org.quartz.scheduler.skipUpdateCheck: true 

org.quartz.plugin.jobInitializer.class =org.quartz.plugins.xml.XMLSchedulingDataProcessorPlugin 
org.quartz.plugin.jobInitializer.fileNames = quartz-config.xml 
org.quartz.plugin.jobInitializer.failOnFileNotFound = true 
org.quartz.plugin.jobInitializer.wrapInUserTransaction = false 

org.quartz.threadPool.class: org.quartz.simpl.SimpleThreadPool 
org.quartz.threadPool.threadCount: 20 
org.quartz.threadPool.threadPriority: 5 

org.quartz.jobStore.class=org.quartz.impl.jdbcjobstore.JobStoreTX 
org.quartz.jobStore.driverDelegateClass=org.quartz.impl.jdbcjobstore.StdJDBCDelegate 
org.quartz.jobStore.useProperties=false 
org.quartz.jobStore.dataSource=myDS 
org.quartz.jobStore.tablePrefix=QRTZ_ 
org.quartz.jobStore.isClustered=true 

org.quartz.dataSource.myDS.driver: com.mysql.jdbc.Driver 
org.quartz.dataSource.myDS.URL: jdbc:mysql://localhost:3306/quartz 
org.quartz.dataSource.myDS.user: root 
org.quartz.dataSource.myDS.password: password 
org.quartz.dataSource.myDS.maxConnections: 5 

石英-config.xmlの

http://www.quartz-scheduler.org/xml/job_scheduling_data_2_0.xsdある」 バージョン= "2.0">

<schedule> 
    <job> 
     <name>Hello</name> 
     <group>HelloGroup</group> 

     <description>The job description</description> 
     <job-class>HelloJob</job-class> 
    </job>  
    <trigger> 
     <cron> 
      <name>hello-trigger</name> 
      <group>Hello_Group</group> 
      <job-name>Hello</job-name> 

      <job-group>HelloGroup</job-group> 
      <cron-expression>0/30 0/1 * 1/1 * ?</cron-expression> 

     </cron> 
    </trigger>   
</schedule> 

メインクラス

import org.quartz.Scheduler; 
import org.quartz.SchedulerException; 
import org.quartz.impl.StdSchedulerFactory; 

    public class QuartzTest { 
    public static void main(String[] args) { 

    try { 
     // Grab the Scheduler instance from the Factory 
     Scheduler scheduler = StdSchedulerFactory.getDefaultScheduler(); 

     // and start it off 
     scheduler.start(); 

     scheduler.shutdown(); 

    } catch (SchedulerException se) { 
     se.printStackTrace(); 
     } 
    } 
} 

ジョブクラス

import org.quartz.Job; 
import org.quartz.JobExecutionContext; 

public class HelloJob implements Job { 
    public void execute(JobExecutionContext context){ 
     System.out.println("Hello World !!!"); 
    } 
} 

答えて

1

私は、問題の原因を発見しました。

scheduler.shutdown(); 

この文は、ジョブトリガーと接続が使用できなくなる前に、クォーツサーバーをシャットダウンします。

関連する問題