2012-06-12 47 views
0

使用石英1.8.3和JBoss 7.1.1,并使用以下属性文件:石英1.8.3和JBoss 7.1.1

#============================================================================ 
# Configure Main Scheduler Properties 
#============================================================================ 
org.quartz.scheduler.instanceName = MyScheduler 
org.quartz.scheduler.instanceId = AUTO 
#============================================================================ 
# Configure ThreadPool 
#============================================================================ 
org.quartz.threadPool.class = org.quartz.simpl.SimpleThreadPool 
org.quartz.threadPool.threadCount = 25 
org.quartz.threadPool.threadPriority = 5 
#============================================================================ 
# Configure JobStore 
#============================================================================ 
org.quartz.jobStore.class = org.quartz.impl.jdbcjobstore.JobStoreCMT 
org.quartz.jobStore.driverDelegateClass = org.quartz.impl.jdbcjobstore.StdJDBCDelegate 
org.quartz.jobStore.useProperties = false 
org.quartz.jobStore.dataSource = quartzDS 
org.quartz.jobStore.nonManagedTXDataSource = quartzDSNoTx 
org.quartz.jobStore.tablePrefix = QRTZ_ 

org.quartz.jobStore.clusterCheckinInterval = 20000 
org.quartz.jobStore.isClustered = false 

org.quartz.jobStore.acquireTriggersWithinLock=true 

#============================================================================ 
# Configure Datasources 
#============================================================================ 

org.quartz.dataSource.quartzDS.jndiURL= java:jboss/datasources/myDS 
org.quartz.dataSource.quartzDSNoTx.jndiURL= java:jboss/datasources/myDS 

#============================================================================ 
# Quartz Plugin 
#============================================================================ 
org.quartz.plugin.jobstop.class = com.viagents.quartz.JobStopPlugin 
org.quartz.plugin.jobstop.tablePrefix = QRTZ_ 

我初始化石英的方法是使用@Singleton,@Startup和@PostConstruct上的一个方法的注释,如下所示:

 @EjbInterface(type = EjbInterface.Type.LOCAL) 
    @TransactionAttribute(TransactionAttributeType.REQUIRED) 
    public void startJobs() { 

     try { 

      Scheduler scheduler = StdSchedulerFactory.getDefaultScheduler(); 
      this.registerJMX(scheduler); 
      scheduler.start(); 


........................................... 

} 

如果org.quartz.jobStore.isClustered属性是假的,我不能获得调度,我得到这个异常:

13:20:23,636 INFO [org.quartz.core.QuartzScheduler] (MSC service thread 1-15) Quartz Scheduler v.1.8.3 created. 
13:20:23,646 INFO [org.quartz.impl.jdbcjobstore.JobStoreCMT] (MSC service thread 1-15) Using db table-based data access locking (synchronization). 
13:20:23,682 INFO [org.quartz.impl.jdbcjobstore.JobStoreCMT] (MSC service thread 1-15) Removed 0 Volatile Trigger(s). 
13:20:23,684 INFO [org.quartz.impl.jdbcjobstore.JobStoreCMT] (MSC service thread 1-15) Removed 0 Volatile Job(s). 
13:20:23,687 INFO [org.quartz.core.QuartzScheduler] (MSC service thread 1-15) Scheduler MyScheduler_$_NON_CLUSTERED shutting down. 
13:20:23,689 INFO [org.quartz.core.QuartzScheduler] (MSC service thread 1-15) Scheduler MyScheduler_$_NON_CLUSTERED paused. 
13:20:23,691 INFO [org.quartz.core.QuartzScheduler] (MSC service thread 1-15) Scheduler MyScheduler_$_NON_CLUSTERED shutdown complete. 
13:20:23,707 INFO [stdout] (MSC service thread 1-15) java.lang.reflect.UndeclaredThrowableException 
13:20:23,709 INFO [stdout] (MSC service thread 1-15) at $Proxy33.rollback(Unknown Source) 
13:20:23,710 INFO [stdout] (MSC service thread 1-15) at org.quartz.impl.jdbcjobstore.JobStoreSupport.rollbackConnection(JobStoreSupport.java:3604) 
13:20:23,713 INFO [stdout] (MSC service thread 1-15) at org.quartz.impl.jdbcjobstore.JobStoreSupport.executeInNonManagedTXLock(JobStoreSupport.java:3776) 
13:20:23,715 INFO [stdout] (MSC service thread 1-15) at org.quartz.impl.jdbcjobstore.JobStoreSupport.executeInNonManagedTXLock(JobStoreSupport.java:3725) 
13:20:23,717 INFO [stdout] (MSC service thread 1-15) at org.quartz.impl.jdbcjobstore.JobStoreSupport.cleanVolatileTriggerAndJobs(JobStoreSupport.java:747) 
13:20:23,719 INFO [stdout] (MSC service thread 1-15) at org.quartz.impl.jdbcjobstore.JobStoreSupport.initialize(JobStoreSupport.java:605) 
13:20:23,721 INFO [stdout] (MSC service thread 1-15) at org.quartz.impl.jdbcjobstore.JobStoreCMT.initialize(JobStoreCMT.java:142) 
13:20:23,723 INFO [stdout] (MSC service thread 1-15) at org.quartz.impl.StdSchedulerFactory.instantiate(StdSchedulerFactory.java:1269) 
13:20:23,724 INFO [stdout] (MSC service thread 1-15) at org.quartz.impl.StdSchedulerFactory.getScheduler(StdSchedulerFactory.java:1460) 

13:20:23,862 INFO [stdout] (MSC service thread 1-15) Caused by: java.lang.reflect.InvocationTargetException 
13:20:23,865 INFO [stdout] (MSC service thread 1-15) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
13:20:23,866 INFO [stdout] (MSC service thread 1-15) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) 
13:20:23,868 INFO [stdout] (MSC service thread 1-15) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) 
13:20:23,869 INFO [stdout] (MSC service thread 1-15) at java.lang.reflect.Method.invoke(Method.java:597) 
13:20:23,870 INFO [stdout] (MSC service thread 1-15) at org.quartz.impl.jdbcjobstore.AttributeRestoringConnectionInvocationHandler.invoke(AttributeRestoringConnectionInvocationHandler.java:71) 
13:20:23,872 INFO [stdout] (MSC service thread 1-15) ... 85 more 
13:20:23,873 INFO [stdout] (MSC service thread 1-15) Caused by: java.sql.SQLException: You cannot rollback during a managed transaction! 
13:20:23,875 INFO [stdout] (MSC service thread 1-15) at org.jboss.jca.adapters.jdbc.BaseWrapperManagedConnection.jdbcRollback(BaseWrapperManagedConnection.java:1022) 
13:20:23,876 INFO [stdout] (MSC service thread 1-15) at org.jboss.jca.adapters.jdbc.WrappedConnection.rollback(WrappedConnection.java:778) 
13:20:23,878 INFO [stdout] (MSC service thread 1-15) ... 90 more 
13:20:23,880 INFO [org.jboss.as] (MSC service thread 1-11) JBAS015951: Admin console listening on http://127.0.0.1:9990 

如果我设置群集属性为true,我得到这个:

13:29:31,562 INFO [org.quartz.core.QuartzScheduler] (MSC service thread 1-4) Scheduler meta-data: Quartz Scheduler (v1.8.3) 'ViSixdScheduler' with instanceId 'Se-PC1339507771533' 
    Scheduler class: 'org.quartz.core.QuartzScheduler' - running locally. 
    NOT STARTED. 
    Currently in standby mode. 
    Number of jobs executed: 0 
    Using thread pool 'org.quartz.simpl.SimpleThreadPool' - with 25 threads. 
    Using job-store 'org.quartz.impl.jdbcjobstore.JobStoreCMT' - which supports persistence. and is clustered. 
13:29:31,579 INFO [org.quartz.impl.StdSchedulerFactory] (MSC service thread 1-4) Quartz scheduler 'MyScheduler' initialized from default resource file in Quartz package: 'quartz.properties' 
13:29:31,581 INFO [org.quartz.impl.StdSchedulerFactory] (MSC service thread 1-4) Quartz scheduler version: 1.8.3 
13:29:33,577 INFO [org.quartz.utils.UpdateChecker] (Timer-1) New Quartz update(s) found: 1.8.5 [http://www.terracotta.org/kit/reflector?kitID=default&pageID=QuartzChangeLog] 
13:29:43,970 INFO [org.quartz.impl.jdbcjobstore.JobStoreCMT] (MSC service thread 1-4) ClusterManager: detected 1 failed or restarted instances. 
13:29:43,972 INFO [org.quartz.impl.jdbcjobstore.JobStoreCMT] (MSC service thread 1-4) ClusterManager: Scanning for instance "Se-PC1339504980109"'s failed in-progress jobs. 
13:29:43,979 ERROR [org.quartz.impl.jdbcjobstore.JobStoreCMT] (MSC service thread 1-4) ClusterManager: Error managing cluster: null: java.lang.reflect.UndeclaredThrowableException 
     at $Proxy33.commit(Unknown Source)  at org.quartz.impl.jdbcjobstore.JobStoreSupport.commitConnection(JobStoreSupport.java:3624) [quartz-1.8.3.jar:] 
     at org.quartz.impl.jdbcjobstore.JobStoreSupport.doCheckin(JobStoreSupport.java:3213) [quartz-1.8.3.jar:] 
     at org.quartz.impl.jdbcjobstore.JobStoreSupport$ClusterManager.manage(JobStoreSupport.java:3820) [quartz-1.8.3.jar:] 

如果我不叫开始调度程序,我只能消防工作@once ....但它很没用,而无需启动:(

任何帮助,非常感谢。

谢谢

+0

不好意思,你是怎么设法让你的quartz.properties文件阅读由应用程序服务器?按照文档中的建议,我尝试将其放入WEB-INF/classes文件夹中,但Web应用程序仍然指向默认配置文件。 谢谢 琳达 –

+0

我的quartz.properties的路径是这样的: earFile.ear/sarFile.sar/quartz.properties – Sergiu

回答

1

如何你quartzDS数据源在standalone.xml界定?使用Quartz 1.8.5和Jboss 7.1.1,我看到的是和你一样的堆栈跟踪。将quartz datasource jta属性设置为false后,Quartz开始无错误。用JTA设置为false它更像是一个普通的JDBC连接到单个数据库

<datasource jta="false" jndi-name="java:/quartzDS" pool-name="quartzDS" enabled="true" use-java-context="true" use-ccm="true"> 

. 
+0

修复它,这是我最终修复它的方法。感谢您的支持。 – Sergiu