2011-08-28 15 views
6

पर तैनात किए जाने पर दो बार चलता है I अब एक अतिरिक्त क्वार्ट्ज नौकरी के साथ एक स्प्रिंग फ्रेमवर्क/स्मार्टजीडब्ल्यूटी आधारित वेब-ऐप चलाता है। नौकरी हर दिन 2 बजे चलती है, और डीबी टेबल से विजेताओं को चुनती है। मेरी लॉग से मैं इसे दो बार चलाता है देखते हैं, समवर्ती ऐसा लगता है, क्योंकि जैसा कि आप देख सकते हैं, लॉग ओवरलैप:क्वार्ट्ज नौकरी टॉमकैट 6/उबंटू 10.04 एलटीएस

Generating winners of yesterday... 
Generating winners of yesterday... 
winning id's: 15 
done, mail queue is filled. 

winning id's: 18 
done, mail queue is filled. 

मेरे applicationContext.xml इस तरह दिखता है:

<!-- initiates and calls the job --> 
<beans:bean id="GenerateWinnersAndFillMailingQueueJobDetail" class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean"> 
    <beans:property name="targetObject" ref="GenerateWinnersAndFillMailingQueueJobExecutor"/> 
    <beans:property name="targetMethod" value="execute"/> 
</beans:bean> 
<!-- here's where we use the Cron like scheduling expression  to define when the bean is run. --> 
<beans:bean id="GenerateWinnersAndFillMailingQueueJob" class="org.springframework.scheduling.quartz.CronTriggerBean"> 
    <beans:property name="jobDetail" ref="GenerateWinnersAndFillMailingQueueJobDetail"/> 
    <!-- run every morning at 2AM --> 
    <beans:property name="cronExpression" value="0 0 2 * * ?"/> 
</beans:bean> 
... another quartz jobs is defined here, omitted for clarity ... 
<beans:bean class="org.springframework.scheduling.quartz.SchedulerFactoryBean"> 
    <beans:property name="triggers"> 
    <beans:list> 
     <beans:ref bean="GenerateWinnersAndFillMailingQueueJob"/> 
     <beans:ref bean="SendEmailsFromMailQueueJob"/> 
    </beans:list> 
    </beans:property> 
</beans:bean> 

मैं वास्तव में नहीं है देखें कि यहां क्या गलत है, यह एक बहुत ही सरल उपयोग केस है। जब मैं स्थानीय रूप से परीक्षण करता हूं, तो सर्वर पर जो जीडब्ल्यूटी विकास मोड के साथ आता है, यह काम करता है। केवल उबंटू 10.04 एलटीएस पर टॉमकैट 6 पर तैनाती करते समय, मुझे यह समस्या मिलती है।

कोई भी विचार?

** संपादित करें: टिप्पणियों के संकेत के बाद, लॉग स्तर में वृद्धि, ऐसा लगता है कि वसंत दो बार चल रहा है। टॉमकैट सर्वर को पुनरारंभ करने से पता चलता है कि दो स्प्रिंग्स तत्काल हैं, लगभग 4 सेकंड अलग हैं।

2011-08-29 08:49:26,484 {ABSOLUTE} INFO ContextLoader,main:187 - Root WebApplicationContext: initialization started 
... 
2011-08-29 08:49:31,221 {ABSOLUTE} INFO ContextLoader,main:187 - Root WebApplicationContext: initialization started 

इस कारण हो सकता है क्या, और क्या किया जाना:

2011-08-29 08:49:22,567 {ABSOLUTE} INFO XmlWebApplicationContext,Thread-9:1002 - Closing Root WebApplicationContext: startup date [Sun Aug 28 20:53:39 CEST 2011]; root of context hierarchy 
2011-08-29 08:49:22,569 {ABSOLUTE} INFO DefaultLifecycleProcessor,Thread-9:345 - Stopping beans in phase 2147483647 
2011-08-29 08:49:22,589 {ABSOLUTE} INFO QuartzScheduler,Thread-9:537 - Scheduler org.springframework.scheduling.quartz.SchedulerFactoryBean#0_$_NON_CLUSTERED paused. 
2011-08-29 08:49:22,592 {ABSOLUTE} INFO DefaultListableBeanFactory,Thread-9:422 - Destroying singletons in org.s[email protected]12e14ebc: defining beans [org.springframework.context.annotation.internalConfigurationAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,org.springframework.context.annotation.internalCommonAnnotationProcessor,MerchantSimpleJsonWebservice,merchantDao,AdvertisementSimpleJsonWebservice,advertisementDao,ContactFormSubmitsSimpleJsonWebservice,contactFormSubmitsDao,PlayerCustomJsonWebservice,PlayerCustomJsonWebserviceImpl,submitSolutionDao,GenerateWinnersAndFillMailingQueueJobExecutor,GenerateWinnersAndFillMailingQueueJobDetail,GenerateWinnersAndFillMailingQueueJob,SendEmailsFromMailQueueJobExecutor,SendEmailsFromMailQueueJobDetail,SendEmailsFromMailQueueJob,org.springframework.scheduling.quartz.SchedulerFactoryBean#0,org.springframework.security.web.PortMapperImpl#0,org.springframework.security.web.context.HttpSessionSecurityContextRepository#0,org.springframework.security.authentication.ProviderManager#0,org.springframework.security.access.vote.AffirmativeBased#0,org.springframework.security.web.access.intercept.FilterSecurityInterceptor#0,org.springframework.security.web.access.DefaultWebInvocationPrivilegeEvaluator#0,org.springframework.security.authentication.AnonymousAuthenticationProvider#0,org.springframework.security.web.savedrequest.HttpSessionRequestCache#0,org.springframework.security.config.http.UserDetailsServiceInjectionBeanPostProcessor#0,org.springframework.security.filterChainProxy,sessionAuthenticationStrategy,sessionRegistry,propertyConfigurer,org.springframework.security.authentication.dao.DaoAuthenticationProvider#0,org.springframework.security.authentication.DefaultAuthenticationEventPublisher#0,org.springframework.security.authenticationManager,saltSource,dataSource,jdbcTemplate,passwordEncoder,jdbcUserService,loggerListener,formLoginFilter,authenticationEntryPoint,accessDeniedHandler,concurrencyFilter]; root of factory hierarchy 
2011-08-29 08:49:22,601 {ABSOLUTE} INFO SchedulerFactoryBean,Thread-9:760 - Shutting down Quartz Scheduler 
2011-08-29 08:49:22,601 {ABSOLUTE} INFO QuartzScheduler,Thread-9:616 - Scheduler org.springframework.scheduling.quartz.SchedulerFactoryBean#0_$_NON_CLUSTERED shutting down. 
2011-08-29 08:49:22,602 {ABSOLUTE} INFO QuartzScheduler,Thread-9:537 - Scheduler org.springframework.scheduling.quartz.SchedulerFactoryBean#0_$_NON_CLUSTERED paused. 
2011-08-29 08:49:22,603 {ABSOLUTE} INFO QuartzScheduler,Thread-9:688 - Scheduler org.springframework.scheduling.quartz.SchedulerFactoryBean#0_$_NON_CLUSTERED shutdown complete. 
2011-08-29 08:49:22,882 {ABSOLUTE} INFO XmlWebApplicationContext,Thread-9:1002 - Closing Root WebApplicationContext: startup date [Sun Aug 28 20:53:34 CEST 2011]; root of context hierarchy 
2011-08-29 08:49:22,883 {ABSOLUTE} INFO DefaultLifecycleProcessor,Thread-9:345 - Stopping beans in phase 2147483647 
2011-08-29 08:49:22,903 {ABSOLUTE} INFO QuartzScheduler,Thread-9:537 - Scheduler org.springframework.scheduling.quartz.SchedulerFactoryBean#0_$_NON_CLUSTERED paused. 
2011-08-29 08:49:22,904 {ABSOLUTE} INFO DefaultListableBeanFactory,Thread-9:422 - Destroying singletons in org.s[email protected]402fb002: defining beans [org.springframework.context.annotation.internalConfigurationAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,org.springframework.context.annotation.internalCommonAnnotationProcessor,MerchantSimpleJsonWebservice,merchantDao,AdvertisementSimpleJsonWebservice,advertisementDao,ContactFormSubmitsSimpleJsonWebservice,contactFormSubmitsDao,PlayerCustomJsonWebservice,PlayerCustomJsonWebserviceImpl,submitSolutionDao,GenerateWinnersAndFillMailingQueueJobExecutor,GenerateWinnersAndFillMailingQueueJobDetail,GenerateWinnersAndFillMailingQueueJob,SendEmailsFromMailQueueJobExecutor,SendEmailsFromMailQueueJobDetail,SendEmailsFromMailQueueJob,org.springframework.scheduling.quartz.SchedulerFactoryBean#0,org.springframework.security.web.PortMapperImpl#0,org.springframework.security.web.context.HttpSessionSecurityContextRepository#0,org.springframework.security.authentication.ProviderManager#0,org.springframework.security.access.vote.AffirmativeBased#0,org.springframework.security.web.access.intercept.FilterSecurityInterceptor#0,org.springframework.security.web.access.DefaultWebInvocationPrivilegeEvaluator#0,org.springframework.security.authentication.AnonymousAuthenticationProvider#0,org.springframework.security.web.savedrequest.HttpSessionRequestCache#0,org.springframework.security.config.http.UserDetailsServiceInjectionBeanPostProcessor#0,org.springframework.security.filterChainProxy,sessionAuthenticationStrategy,sessionRegistry,propertyConfigurer,org.springframework.security.authentication.dao.DaoAuthenticationProvider#0,org.springframework.security.authentication.DefaultAuthenticationEventPublisher#0,org.springframework.security.authenticationManager,saltSource,dataSource,jdbcTemplate,passwordEncoder,jdbcUserService,loggerListener,formLoginFilter,authenticationEntryPoint,accessDeniedHandler,concurrencyFilter]; root of factory hierarchy 
2011-08-29 08:49:22,913 {ABSOLUTE} INFO SchedulerFactoryBean,Thread-9:760 - Shutting down Quartz Scheduler 
2011-08-29 08:49:22,914 {ABSOLUTE} INFO QuartzScheduler,Thread-9:616 - Scheduler org.springframework.scheduling.quartz.SchedulerFactoryBean#0_$_NON_CLUSTERED shutting down. 
2011-08-29 08:49:22,914 {ABSOLUTE} INFO QuartzScheduler,Thread-9:537 - Scheduler org.springframework.scheduling.quartz.SchedulerFactoryBean#0_$_NON_CLUSTERED paused. 
2011-08-29 08:49:22,915 {ABSOLUTE} INFO QuartzScheduler,Thread-9:688 - Scheduler org.springframework.scheduling.quartz.SchedulerFactoryBean#0_$_NON_CLUSTERED shutdown complete. 
2011-08-29 08:49:26,484 {ABSOLUTE} INFO ContextLoader,main:187 - Root WebApplicationContext: initialization started 

बाद में, दो वसंत उदाहरणों शुरू कर दिया हो रहे हैं?

+0

क्वार्ट्ज 'लॉगिंग स्तर को थोड़ा सा बढ़ाने के लिए यह अच्छा विचार हो सकता है कि नौकरी वास्तव में निष्पादन के लिए दो बार निर्धारित हो जाती है या नहीं। – fvu

+0

धन्यवाद। मैंने स्प्रिंग लॉग स्तर को डीबग करने के लिए रखा है, और ऐसा लगता है कि वसंत दो बार चलता है (लेकिन यह एकमात्र ऐप तैनात है)! या तो वसंत दो बार चलता है, या क्वार्ट्ज शेड्यूलर बीन दो बार तत्काल होता है। मैंने –

+0

से ऊपर दिए गए प्रश्न में लॉग डाल दिया है मैंने क्वार्ट्ज के बिना भी इस व्यवहार को देखा है। वसंत संदर्भ दो बार लोड हो रहा था जब भी मैं टॉमकैट पर ऐप चलाता था (नेटबीन्स के भीतर से खिड़कियों पर भी)। – kunal

उत्तर

7

मैंने इसे ठीक किया, न केवल क्वार्ट्ज दो बार चल रहा था, लेकिन मेरा ऐप दो बार तैनात किया गया था। यह टॉमकैट दस्तावेज़ों में निम्नलिखित के कारण था:

स्वत: परिनियोजन का उपयोग करते समय, एक XML संदर्भ फ़ाइल द्वारा परिभाषित डॉकबेस ऐपबेस निर्देशिका के बाहर होना चाहिए। यदि ऐसा नहीं है, तो वेब एप्लिकेशन को तैनात करने में कठिनाइयों का अनुभव किया जा सकता है या एप्लिकेशन को दो बार तैनात किया जा सकता है। इस स्थिति से बचने के लिए तैनाती अनदेखी विशेषता का उपयोग किया जा सकता है।

अंत में, ध्यान दें कि यदि आप सर्वर.एक्सएमएल में संदर्भों को स्पष्ट रूप से परिभाषित कर रहे हैं, तो आपको शायद स्वचालित एप्लिकेशन परिनियोजन बंद कर देना चाहिए या सावधानीपूर्वक अनदेखा करना चाहिए। अन्यथा, वेब अनुप्रयोगों को प्रत्येक को दो बार तैनात किया जाएगा, और इससे अनुप्रयोगों के लिए समस्याएं हो सकती हैं।

मैंने mod_jk काम करने के तरीके के बारे में एक ट्यूटोरियल का पालन किया, और this tutorial में यह दोष था।

0

क्या आपके पास अंततः आपके यूबुनट मशीन पर एक टोमकैट उदाहरण के अंदर कई एप्लिकेशन चल रहे हैं? मुझे लगता है कि मुझे क्वार्ट्ज कुछ स्थिर कोड रखने के लिए याद है, जो यह एक जावा वीएम में सभी अनुप्रयोगों को थ्रूगआउट साझा करेगा।

+0

आपके उत्तर के लिए धन्यवाद। और हाँ, मैंने अभी यह पता लगाया है कि न केवल क्वार्ट्ज दो बार चल रहा था, लेकिन पूरा ऐप दो बार तैनात किया गया था। नीचे मेरा जवाब देखें। –

3

मेरे लिए, ऑटो तैनाती समस्या थी, और उसे निष्क्रिय करने मैं अपनी server.xml में मेजबान तत्व पर निम्न विशेषताओं को निर्दिष्ट करने के लिए किया था:

deployOnStartup="false" 
autoDeploy="false" 

तो मेरी मेजबान तत्व की तरह दिखाई देता इस:

<Host name="localhost" 
     deployOnStartup="false" 
     appBase="webapps" 
     unpackWARs="false" 
     autoDeploy="false"> 

मैं एक अलग तरह है कि मुझे इस समस्या को हल में मदद मिली में समस्या का ब्यौरा this post पाया।