Bonjour
Je suis un peu débutant en Spring, et encore plus en Quartz.
J'aimerais intégrer Quartz à Spring mais rien ne se passe...

Voici mon applicationContext.xml
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
 
<?xml version="1.0" encoding="UTF-8"?>
 
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
 
<beans>
 
 
    <bean id="trafficGenerationJob" class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">
        <property name="targetObject" ref="trafficGenerationObject"/>
        <property name="targetMethod" value="doIt"/>
    </bean>
 
    <bean id="trafficGenerationObject" class="com.thalys.opalys.schedule.TrafficGenerationJob"/>
 
    <!--<bean id="trafficGenerationTrigger" class="org.springframework.scheduling.quartz.SimpleTriggerBean">-->
    <!--<property name="jobDetail" ref="trafficGenerationJob"/>-->
    <!--<property name="startDelay" value="10000"/>-->
    <!--<property name="repeatCount" value="10"/>-->
    <!--</bean>-->
 
    <bean id="trafficGenerationTrigger" class="org.springframework.scheduling.quartz.SimpleTriggerBean">
        <property name="jobDetail" ref="trafficGenerationJob"/>
        <property name="startDelay" value="10000"/>
        <property name="repeatCount" value="10"/>
    </bean>
 
    <bean id="scheduler" class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
        <property name="autoStartup">
            <value>true</value>
        </property>
        <property name="triggers">
            <list>
                <ref bean="trafficGenerationTrigger"/>
            </list>
        </property>
    </bean>
 
</beans>
Voici ma classe TrafficGenerationJob
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
package com.thalys.opalys.schedule;
 
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
 
/**
     * This job handles the traffic generation from a given rmac file
 * already stored on the file system
 * WARNING: the scheduled time MUST BE after getting the rmac file, ie after`
 * the time set for the ImportRmacJob
 */
public class TrafficGenerationJob  {
 
    private final static Log LOG = LogFactory.getLog(DumbJob.class);
 
    public void executeInternal(JobExecutionContext jobExecutionContext) throws JobExecutionException {
 
    }
 
    public void doIt(){
        LOG.info("TrafficGenerationJob started");
 
        LOG.info("TrafficGenerationJob finished successfully");
    }
}
Et voici le log de mon serveur JBoss, au lancement, avec en rouge les parties concernant Quartz, enfin je crois
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
/Applications/jboss-4.0.5.GA/bin/run.sh
=========================================================================

  JBoss Bootstrap Environment

  JBOSS_HOME: /Applications/jboss-4.0.5.GA

  JAVA: /System/Library/Frameworks/JavaVM.framework/Home/bin/java

  JAVA_OPTS: -Dprogram.name=run.sh -Xms128m -Xmx512m -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000 -server -Xms128m -Xmx512m

  CLASSPATH: /Applications/jboss-4.0.5.GA/bin/run.jar:/System/Library/Frameworks/JavaVM.framework/Home/lib/tools.jar

=========================================================================

17:07:53,469 INFO  [Server] Starting JBoss (MX MicroKernel)...
17:07:53,470 INFO  [Server] Release ID: JBoss [Zion] 4.0.5.GA (build: CVSTag=Branch_4_0 date=200610162339)
17:07:53,472 INFO  [Server] Home Dir: /Applications/jboss-4.0.5.GA
17:07:53,472 INFO  [Server] Home URL: file:/Applications/jboss-4.0.5.GA/
17:07:53,473 INFO  [Server] Patch URL: null
17:07:53,473 INFO  [Server] Server Name: default
17:07:53,473 INFO  [Server] Server Home Dir: /Applications/jboss-4.0.5.GA/server/default
17:07:53,473 INFO  [Server] Server Home URL: file:/Applications/jboss-4.0.5.GA/server/default/
17:07:53,473 INFO  [Server] Server Log Dir: /Applications/jboss-4.0.5.GA/server/default/log
17:07:53,474 INFO  [Server] Server Temp Dir: /Applications/jboss-4.0.5.GA/server/default/tmp
17:07:53,474 INFO  [Server] Root Deployment Filename: jboss-service.xml
17:07:53,733 INFO  [ServerInfo] Java version: 1.5.0_07,Apple Computer, Inc.
17:07:53,734 INFO  [ServerInfo] Java VM: Java HotSpot(TM) Server VM 1.5.0_07-87,"Apple Computer, Inc."
17:07:53,734 INFO  [ServerInfo] OS-System: Mac OS X 10.4.10,i386
17:07:54,207 INFO  [Server] Core system initialized
17:07:56,527 INFO  [WebService] Using RMI server codebase: http://nico-mac.local:8083/
17:07:56,546 INFO  [Log4jService$URLWatchTimerTask] Configuring from URL: resource:log4j.xml
17:08:01,422 INFO  [ServiceEndpointManager] WebServices: jbossws-1.0.3.SP1 (date=200609291417)
17:08:02,707 INFO  [Embedded] Catalina naming disabled
17:08:02,747 INFO  [ClusterRuleSetFactory] Unable to find a cluster rule set in the classpath. Will load the default rule set.
17:08:02,748 INFO  [ClusterRuleSetFactory] Unable to find a cluster rule set in the classpath. Will load the default rule set.
17:08:03,028 INFO  [Http11BaseProtocol] Initializing Coyote HTTP/1.1 on http-0.0.0.0-8080
17:08:03,029 INFO  [Catalina] Initialization processed in 281 ms
17:08:03,029 INFO  [StandardService] Starting service jboss.web
17:08:03,055 INFO  [StandardEngine] Starting Servlet Engine: Apache Tomcat/5.5.20
17:08:03,082 INFO  [StandardHost] XML validation disabled
17:08:03,155 INFO  [Catalina] Server startup in 126 ms
17:08:03,442 INFO  [TomcatDeployer] deploy, ctxPath=/invoker, warUrl=.../deploy/http-invoker.sar/invoker.war/
17:08:04,414 INFO  [TomcatDeployer] deploy, ctxPath=/, warUrl=.../deploy/jbossweb-tomcat55.sar/ROOT.war/
17:08:04,581 INFO  [TomcatDeployer] deploy, ctxPath=/jbossws, warUrl=.../tmp/deploy/tmp10847jbossws-context-exp.war/
17:08:04,812 INFO  [TomcatDeployer] deploy, ctxPath=/jbossmq-httpil, warUrl=.../deploy/jms/jbossmq-httpil.sar/jbossmq-httpil.war/
17:08:06,199 INFO  [TomcatDeployer] deploy, ctxPath=/web-console, warUrl=.../deploy/management/console-mgr.sar/web-console.war/

...

17:08:14,013 INFO  [CollectionFactory] JDK 1.4+ collections available
17:08:14,026 INFO  [CollectionFactory] Commons Collections 3.x available
17:08:14,054 INFO  [XmlBeanDefinitionReader] Loading XML bean definitions from ServletContext resource [/WEB-INF/applicationContext.xml]
17:08:14,555 INFO  [XmlBeanDefinitionReader] Loading XML bean definitions from ServletContext resource [/WEB-INF/applicationContext-dataSource.xml]
17:08:14,596 INFO  [XmlBeanDefinitionReader] Loading XML bean definitions from ServletContext resource [/WEB-INF/applicationContext-quartz.xml]
17:08:14,612 INFO  [XmlBeanDefinitionReader] Loading XML bean definitions from ServletContext resource [/WEB-INF/applicationContext-server-authentication.xml]
17:08:14,699 INFO  [XmlWebApplicationContext] Bean factory for application context [Root WebApplicationContext]: org.springframework.beans.factory.support.DefaultListableBeanFactory defining beans [messageSource,sessionFactory,hibernateInterceptor,pointDao,particularPointDao,axisDao,referenceDao,passagePointDao,varianteDao,userDao,roleDao,regularityFormDao,endOfMissionMessageDao,effectiveTrancheDao,trainSetDao,effectivePassageDao,incidentFormDao,eventTargetDao,eventDao,actionDao,eventTargetTypeDao,eventTypeDao,actionTypeDao,emailActionTypeDao,emailUserActionTypeDao,emailMailingListActionTypeDao,mailingListDao,stateDao,breakageFormDao,incidentDao,incidentTypeDao,effectDao,effectivePassageIssueDao,varianteSpecialCaseDao,trancheDao,breakageDao,incidentLocationDao,incidentFormNoticeSenderDao,administrationService,dataImportService,echoService,securityService,trafficGeneratorService,schedulerService,valentysService,incidentService,breakageService,regularityService,serviceSecurityInterceptor,serviceAccessDecisionManager,serviceDecisionVoter,dataSource,transactionManager,scheduler,basicProcessingFilter,authenticationEntryPoint,opalysAuthenticationManager,daoAuthenticationProvider,userCacheManager,userCacheBackend,userAuthenticationCache,passwordEncoder,opalysUserDetailsService]; root of BeanFactory hierarchy
17:08:14,719 INFO  [XmlWebApplicationContext] 63 beans defined in application context [Root WebApplicationContext]
17:08:14,815 INFO  [DefaultListableBeanFactory] Pre-instantiating singletons in factory [org.springframework.beans.factory.support.DefaultListableBeanFactory defining beans [messageSource,sessionFactory,hibernateInterceptor,pointDao,particularPointDao,axisDao,referenceDao,passagePointDao,varianteDao,userDao,roleDao,regularityFormDao,endOfMissionMessageDao,effectiveTrancheDao,trainSetDao,effectivePassageDao,incidentFormDao,eventTargetDao,eventDao,actionDao,eventTargetTypeDao,eventTypeDao,actionTypeDao,emailActionTypeDao,emailUserActionTypeDao,emailMailingListActionTypeDao,mailingListDao,stateDao,breakageFormDao,incidentDao,incidentTypeDao,effectDao,effectivePassageIssueDao,varianteSpecialCaseDao,trancheDao,breakageDao,incidentLocationDao,incidentFormNoticeSenderDao,administrationService,dataImportService,echoService,securityService,trafficGeneratorService,schedulerService,valentysService,incidentService,breakageService,regularityService,serviceSecurityInterceptor,serviceAccessDecisionManager,serviceDecisionVoter,dataSource,transactionManager,scheduler,basicProcessingFilter,authenticationEntryPoint,opalysAuthenticationManager,daoAuthenticationProvider,userCacheManager,userCacheBackend,userAuthenticationCache,passwordEncoder,opalysUserDetailsService]; root of BeanFactory hierarchy]
17:08:14,941 INFO  [Environment] Hibernate 3.1.3
17:08:14,953 INFO  [Environment] hibernate.properties not found
17:08:14,955 INFO  [Environment] using CGLIB reflection optimizer
17:08:14,955 INFO  [Environment] using JDK 1.4 java.sql.Timestamp handling
...

17:08:16,494 INFO  [ConnectionProviderFactory] Initializing connection provider: org.springframework.orm.hibernate3.LocalDataSourceConnectionProvider
17:08:16,965 INFO  [SettingsFactory] RDBMS: MySQL, version: 5.0.41
17:08:16,965 INFO  [SettingsFactory] JDBC driver: MySQL-AB JDBC Driver, version: mysql-connector-java-5.0.5 ( $Date: 2007-03-01 00:01:06 +0100 (Thu, 01 Mar 2007) $, $Revision: 6329 $ )
17:08:16,991 INFO  [Dialect] Using dialect: org.hibernate.dialect.MySQLInnoDBDialect
...
17:08:20,767 INFO  [[/opalys-server-remoting]] Loading WebApplicationContext for Spring FrameworkServlet 'opalys-remoting'
17:08:20,767 INFO  [XmlBeanDefinitionReader] Loading XML bean definitions from ServletContext resource [/WEB-INF/applicationContext-export-remoteServices.xml]
17:08:20,834 INFO  [XmlWebApplicationContext] Bean factory for application context [WebApplicationContext for namespace 'opalys-remoting-servlet']: org.springframework.beans.factory.support.DefaultListableBeanFactory defining beans [/AdministrationService,/DataImportService,/EchoService,/SecurityService,/TrafficGeneratorService,/SchedulerService,/ValentysService,/IncidentService,/BreakageService,/RegularityService,/Scheduler,/RemoteAuthenticationManagerService]; parent: org.springframework.beans.factory.support.DefaultListableBeanFactory defining beans [messageSource,sessionFactory,hibernateInterceptor,pointDao,particularPointDao,axisDao,referenceDao,passagePointDao,varianteDao,userDao,roleDao,regularityFormDao,endOfMissionMessageDao,effectiveTrancheDao,trainSetDao,effectivePassageDao,incidentFormDao,eventTargetDao,eventDao,actionDao,eventTargetTypeDao,eventTypeDao,actionTypeDao,emailActionTypeDao,emailUserActionTypeDao,emailMailingListActionTypeDao,mailingListDao,stateDao,breakageFormDao,incidentDao,incidentTypeDao,effectDao,effectivePassageIssueDao,varianteSpecialCaseDao,trancheDao,breakageDao,incidentLocationDao,incidentFormNoticeSenderDao,administrationService,dataImportService,echoService,securityService,trafficGeneratorService,schedulerService,valentysService,incidentService,breakageService,regularityService,serviceSecurityInterceptor,serviceAccessDecisionManager,serviceDecisionVoter,dataSource,transactionManager,scheduler,basicProcessingFilter,authenticationEntryPoint,opalysAuthenticationManager,daoAuthenticationProvider,userCacheManager,userCacheBackend,userAuthenticationCache,passwordEncoder,opalysUserDetailsService]; root of BeanFactory hierarchy
17:08:20,835 INFO  [XmlWebApplicationContext] 12 beans defined in application context [WebApplicationContext for namespace 'opalys-remoting-servlet']
17:08:20,837 INFO  [DefaultListableBeanFactory] Pre-instantiating singletons in factory [org.springframework.beans.factory.support.DefaultListableBeanFactory defining beans [/AdministrationService,/DataImportService,/EchoService,/SecurityService,/TrafficGeneratorService,/SchedulerService,/ValentysService,/IncidentService,/BreakageService,/RegularityService,/Scheduler,/RemoteAuthenticationManagerService]; parent: org.springframework.beans.factory.support.DefaultListableBeanFactory defining beans [messageSource,sessionFactory,hibernateInterceptor,pointDao,particularPointDao,axisDao,referenceDao,passagePointDao,varianteDao,userDao,roleDao,regularityFormDao,endOfMissionMessageDao,effectiveTrancheDao,trainSetDao,effectivePassageDao,incidentFormDao,eventTargetDao,eventDao,actionDao,eventTargetTypeDao,eventTypeDao,actionTypeDao,emailActionTypeDao,emailUserActionTypeDao,emailMailingListActionTypeDao,mailingListDao,stateDao,breakageFormDao,incidentDao,incidentTypeDao,effectDao,effectivePassageIssueDao,varianteSpecialCaseDao,trancheDao,breakageDao,incidentLocationDao,incidentFormNoticeSenderDao,administrationService,dataImportService,echoService,securityService,trafficGeneratorService,schedulerService,valentysService,incidentService,breakageService,regularityService,serviceSecurityInterceptor,serviceAccessDecisionManager,serviceDecisionVoter,dataSource,transactionManager,scheduler,basicProcessingFilter,authenticationEntryPoint,opalysAuthenticationManager,daoAuthenticationProvider,userCacheManager,userCacheBackend,userAuthenticationCache,passwordEncoder,opalysUserDetailsService]; root of BeanFactory hierarchy]
17:08:20,914 INFO  [DispatcherServlet] Using context class [org.springframework.web.context.support.XmlWebApplicationContext] for servlet 'opalys-remoting'
17:08:20,919 INFO  [DispatcherServlet] Unable to locate MultipartResolver with name 'multipartResolver': no multipart request handling provided
17:08:20,921 INFO  [DispatcherServlet] Unable to locate LocaleResolver with name 'localeResolver': using default [org.springframework.web.servlet.i18n.AcceptHeaderLocaleResolver@ea320f]
17:08:20,940 INFO  [DispatcherServlet] Unable to locate ThemeResolver with name 'themeResolver': using default [org.springframework.web.servlet.theme.FixedThemeResolver@5601ad]
17:08:20,961 INFO  [DispatcherServlet] No HandlerMappings found in servlet 'opalys-remoting': using default
17:08:20,966 INFO  [DispatcherServlet] No HandlerAdapters found in servlet 'opalys-remoting': using default
17:08:20,982 INFO  [DispatcherServlet] No ViewResolvers found in servlet 'opalys-remoting': using default
17:08:20,982 INFO  [DispatcherServlet] FrameworkServlet 'opalys-remoting': initialization completed in 216 ms
17:08:20,982 INFO  [DispatcherServlet] Servlet 'opalys-remoting' configured successfully
17:08:21,063 INFO  [TomcatDeployer] deploy, ctxPath=/opalys, warUrl=.../tmp/deploy/tmp10881opalys-server-4.0.10-SNAPSHOT.ear-contents/opalys-server-web-4.0.10-SNAPSHOT-exp.war/
17:08:21,613 INFO  [ContextLoader] Root WebApplicationContext: initialization started
17:08:21,613 INFO  [[/opalys]] Loading Spring root WebApplicationContext
17:08:21,614 INFO  [XmlBeanDefinitionReader] Loading XML bean definitions from ServletContext resource [/WEB-INF/applicationContext-acegi-security.xml]
17:08:21,673 INFO  [XmlWebApplicationContext] Bean factory for application context [Root WebApplicationContext]: org.springframework.beans.factory.support.DefaultListableBeanFactory defining beans [filterChainProxy,httpSessionContextIntegrationFilter,logoutFilter,authenticationProcessingFilter,securityContextHolderAwareRequestFilter,rememberMeProcessingFilter,anonymousProcessingFilter,exceptionTranslationFilter,filterInvocationInterceptor,rememberMeServices,authenticationManager,daoAuthenticationProvider,userDetailsService,loggerListener]; root of BeanFactory hierarchy
17:08:21,673 INFO  [XmlWebApplicationContext] 14 beans defined in application context [Root WebApplicationContext]
17:08:21,677 INFO  [DefaultListableBeanFactory] Pre-instantiating singletons in factory [org.springframework.beans.factory.support.DefaultListableBeanFactory defining beans [filterChainProxy,httpSessionContextIntegrationFilter,logoutFilter,authenticationProcessingFilter,securityContextHolderAwareRequestFilter,rememberMeProcessingFilter,anonymousProcessingFilter,exceptionTranslationFilter,filterInvocationInterceptor,rememberMeServices,authenticationManager,daoAuthenticationProvider,userDetailsService,loggerListener]; root of BeanFactory hierarchy]
17:08:21,722 INFO  [EhCacheManagerFactoryBean] Initializing EHCache CacheManager
17:08:21,723 INFO  [EhCacheFactoryBean] Creating new EHCache cache region 'userCache'
17:08:21,774 INFO  [AbstractSecurityInterceptor] Validated configuration attributes
17:08:21,774 INFO  [ContextLoader] Using context class [org.springframework.web.context.support.XmlWebApplicationContext] for root WebApplicationContext
17:08:21,774 INFO  [ContextLoader] Root WebApplicationContext: initialization completed in 161 ms
17:08:21,780 INFO  [ResponseOverrideFilter] Filter initialized. Response buffering is enabled
17:08:22,240 INFO  [TilesPlugin] Tiles definition factory loaded for module ''.
17:08:22,283 INFO  [TomcatDeployer] deploy, ctxPath=/opalys-server-ws, warUrl=.../tmp/deploy/tmp10881opalys-server-4.0.10-SNAPSHOT.ear-contents/opalys-server-webservice-4.0.10-SNAPSHOT-exp.war/
17:08:23,228 INFO  [EARDeployer] Started J2EE application: file:/Applications/jboss-4.0.5.GA/server/default/deploy/opalys-server-4.0.10-SNAPSHOT.ear
17:08:23,342 INFO  [Http11BaseProtocol] Starting Coyote HTTP/1.1 on http-0.0.0.0-8080
17:08:23,498 INFO  [ChannelSocket] JK: ajp13 listening on /0.0.0.0:8009
17:08:23,508 INFO  [JkMain] Jk running ID=0 time=0/24  config=null
17:08:23,521 INFO  [Server] JBoss (MX MicroKernel) [4.0.5.GA (build: CVSTag=Branch_4_0 date=200610162339)] Started in 30s:45ms
Donc avec tout çà, je m'attends à avoir des outputs lorsque mon seerveur se démarre, cf TrafficGenerationJob avec des LOG.info()...
Mais rien ne se passe :o(
Please help...