Results 1 to 8 of 8

Thread: Spring + quartz + JMX

  1. #1

    Default Spring + quartz + JMX

    I am using jmx , Spring and Quartz to run and monitor jobs.
    Currently i have two job running, My question is if there is some change in job.
    can we just modify code, build jar and if you drop jar file, scheduler will pick it up changes without stopping scheduler and redeploying whole application.

    I tried to reload context file, but then jmx is throws runtime Exception:Javax.management.RuntimeException:Error occurred in RequiredModelMbean.

    Thank you

  2. #2
    Join Date
    Sep 2006
    Location
    UK
    Posts
    8,424

    Default

    Could you explain in a little more detail exactly what you are trying to do.

  3. #3

    Default

    Quote Originally Posted by karldmoore View Post
    Could you explain in a little more detail exactly what you are trying to do.

    I started jmx and jobs by loading .xml file that includes all bean and jmx configuration.

    I am using jmx to start and stop , reschedule other job related functions.
    <beans>
    <bean id="Scheduler" class="org.springframework.scheduling.quartz.Sched ulerFactoryBean">
    <property name="applicationContextSchedulerContextKey">
    <value>applicationContext</value>
    </property>
    </bean>


    <bean id="jmxBean" class="ninds.nih.gov.crc.scheduler.JmxJobBean">
    <constructor-arg index="0">
    <bean id="jobScheduler" class="ninds.nih.gov.crc.scheduler.JobScheduler">
    <property name="scheduler"><ref bean="Scheduler"/></property>
    </bean>
    </constructor-arg>
    </bean>

    <!-- define an MBeanExporter -->
    <bean id="mbeanExporter" class="org.springframework.jmx.export.MBeanExporte r">
    <!-- the beans to be exported to JMX -->
    <property name="autodetect" value="true" />
    <property name="beans">
    <map>
    <entry key="NightlyJobs:jmxBean=jobScheduler">
    <ref local="jmxBean"/>
    </entry>
    </map>
    </property>
    <property name="registrationBehaviorName" value="REGISTRATION_REPLACE_EXISTING"/>
    </bean>
    </beans>

    if i change code of one job, i have to stop scheduler and restart whole thing in
    order to get new changes.

    so my question is if i modified some file or any code. After i build that .jar and
    copy that .jar in environment , scheduler should pick up change when it run job next time.

    i know that i already loaded beans , so it is not possible that scheduler will pick up new changes. so i tried to reload all context files by running one job ,than jmx throws runtime error

  4. #4
    Join Date
    Sep 2006
    Location
    UK
    Posts
    8,424

    Default

    Ok, so you are basically changing the underlying job code and trying to redeploy it. All without stopping and starting the server. You're expecting that the scheduler will use the new classes. Hmmmm have to say I've never tried that and I'm not really sure. As for the JMX exception, it would be useful to see the stacktrace.

  5. #5

    Default

    Quote Originally Posted by karldmoore View Post
    Ok, so you are basically changing the underlying job code and trying to redeploy it. All without stopping and starting the server. You're expecting that the scheduler will use the new classes. Hmmmm have to say I've never tried that and I'm not really sure. As for the JMX exception, it would be useful to see the stacktrace.

    That is correct,

    public void refreshConfiguration(){ ((ConfigurableApplicationContext)NightlyContext.ge tInstance().getApplicationContext()).refresh();
    }

    if i call above API from jmx to reload configuration after dropping new .jar,
    it destory all singletons , and it shut down jmx and all connection. so i dont know how to deal with this.

    2007-02-22 10:42:28,352 INFO [org.springframework.beans.factory.support.DefaultL
    istableBeanFactory] - <Destroying singletons in {org.springframework.beans.facto
    ry.support.DefaultListableBeanFactory defining beans [sessionFactory,nindscrcTra
    nsactionManager,lookupService,sequenceService,util itySupport,lookupDao,sequenceD
    ao,propertyConfigurer,dataSource,ctGovNightlyDao,n ightlyServiceTransactionInterc
    eptor,ctGovNightlyService,abstractCmeJaxbSupport,a bstractCmeOutBoundDataJaxbSupp
    ort,abstractCMENightlyBatch,crcCmeParticipantMap,c meLookUpService,httpProcessor,
    cmeCornerNightlyDao,cmeLookUpServiceDao,cmeCornerN ightlyService,httpSuccessRespo
    nseCodeList,Scheduler,jmxBean,mbeanExporter]; root of BeanFactory hierarchy}>
    2007-02-22 10:42:28,352 INFO [org.springframework.jmx.export.MBeanExporter] - <U
    nregistering JMX-exposed beans on shutdown>
    2007-02-22 10:42:28,352 INFO [org.springframework.scheduling.quartz.SchedulerFac
    toryBean] - <Shutting down Quartz Scheduler>
    2007-02-22 10:42:28,352 INFO [org.quartz.core.QuartzScheduler] - <Scheduler Defa
    ultQuartzScheduler_$_NON_CLUSTERED shutting down.>
    2007-02-22 10:42:28,352 INFO [org.quartz.core.QuartzScheduler] - <Scheduler Defa
    ultQuartzScheduler_$_NON_CLUSTERED paused.>
    2007-02-22 10:42:28,352 INFO [org.quartz.core.QuartzScheduler] - <Scheduler Defa
    ultQuartzScheduler_$_NON_CLUSTERED shutdown complete.>
    2007-02-22 10:42:28,352 INFO [org.springframework.orm.hibernate3.LocalSessionFac
    toryBean] - <Closing Hibernate SessionFactory>
    2007-02-22 10:42:28,352 INFO [org.hibernate.impl.SessionFactoryImpl] - <closing>

    2007-02-22 10:42:28,383 INFO [org.springframework.beans.factory.xml.XmlBeanDefin
    itionReader] - <Loading XML bean definitions from URL [jar:file:/C:/temp/Quartz/
    newCrcNightly/lib/ctgov-cme-common.jar!/nindscrc-common-context.xml]>


    jmx shows below error, i don't have stack trace for that as it give error in window.

    it throws java.rmi.unmarshalException: Error unmarshalling return header;
    nested exception java.net.socketException.

  6. #6
    Join Date
    Sep 2006
    Location
    UK
    Posts
    8,424

    Default

    I'm not sure dropping the new jar in will work. As I said before I've never tried this, so I'm not sure how it copes with the new classes. It would be useful to see more of the exception if possible however.

  7. #7
    Join Date
    Feb 2007
    Posts
    16

    Default

    Dear member,
    Can you please give post the log file and put the logging level on "debug" ?

    What kind of logger are you using? and what is the web container?


    Than you
    Alan Mehio
    London, UK

  8. #8

    Default Log

    Hi,

    I am sending log, and screen shot of jmx with exception as attachment.
    I am not using any web container to deploy application. I just ran .batch file
    to load context file and everything. because this is not web application.




    ********************** Below log shows after i invoke RefreshConfiguration API to load new classes ****************************************



    2007-02-23 12:00:06,649 DEBUG [org.hibernate.jdbc.ConnectionManager] - running Session.finalize()
    2007-02-23 12:01:41,992 INFO [org.springframework.beans.factory.support.DefaultL istableBeanFactory] - Destroying singletons in {org.springframework.beans.factory.support.Default ListableBeanFactory defining beans [sessionFactory,nindscrcTransactionManager,lookupSe rvice,sequenceService,utilitySupport,lookupDao,seq uenceDao,propertyConfigurer,dataSource,ctGovNightl yDao,nightlyServiceTransactionInterceptor,ctGovNig htlyService,abstractCmeJaxbSupport,abstractCmeOutB oundDataJaxbSupport,abstractCMENightlyBatch,crcCme ParticipantMap,cmeLookUpService,httpProcessor,cmeC ornerNightlyDao,cmeLookUpServiceDao,cmeCornerNight lyService,httpSuccessResponseCodeList,Scheduler,jm xBean,jobsList,mbeanExporter,nightlyJobs:type=Hibe rnateStatistics,rmiRegistry,connectorServer,server]; root of BeanFactory hierarchy}
    2007-02-23 12:01:42,008 DEBUG [org.springframework.beans.factory.support.Disposab leBeanAdapter] - Applying DestructionAwareBeanPostProcessors to bean with name 'connectorServer'
    2007-02-23 12:01:42,008 DEBUG [org.springframework.beans.factory.support.Disposab leBeanAdapter] - Invoking destroy() on bean with name 'connectorServer'
    2007-02-23 12:01:42,008 INFO [org.springframework.jmx.support.ConnectorServerFac toryBean] - Stopping JMX connector server: javax.management.remote.rmi.RMIConnectorServer@ad4 83
    2007-02-23 12:01:42,289 DEBUG [org.springframework.beans.factory.support.Disposab leBeanAdapter] - Applying DestructionAwareBeanPostProcessors to bean with name 'rmiRegistry'
    2007-02-23 12:01:42,289 DEBUG [org.springframework.beans.factory.support.Disposab leBeanAdapter] - Invoking destroy() on bean with name 'rmiRegistry'
    2007-02-23 12:01:42,289 INFO [org.springframework.remoting.rmi.RmiRegistryFactor yBean] - Unexporting RMI registry
    2007-02-23 12:01:42,305 DEBUG [org.springframework.beans.factory.support.Disposab leBeanAdapter] - Applying DestructionAwareBeanPostProcessors to bean with name 'mbeanExporter'
    2007-02-23 12:01:42,320 DEBUG [org.springframework.beans.factory.support.Disposab leBeanAdapter] - Invoking destroy() on bean with name 'mbeanExporter'
    2007-02-23 12:01:42,336 INFO [org.springframework.jmx.export.MBeanExporter] - Unregistering JMX-exposed beans on shutdown
    2007-02-23 12:01:42,367 DEBUG [org.springframework.beans.factory.support.DefaultL istableBeanFactory] - Retrieved dependent beans for bean 'server': [mbeanExporter, connectorServer]
    2007-02-23 12:01:42,367 DEBUG [org.springframework.beans.factory.support.Disposab leBeanAdapter] - Applying DestructionAwareBeanPostProcessors to bean with name 'server'
    2007-02-23 12:01:42,367 DEBUG [org.springframework.beans.factory.support.Disposab leBeanAdapter] - Invoking destroy() on bean with name 'server'
    2007-02-23 12:01:42,383 DEBUG [org.springframework.beans.factory.support.DefaultL istableBeanFactory] - Retrieved dependent beans for bean 'Scheduler': [jobScheduler]
    2007-02-23 12:01:42,383 DEBUG [org.springframework.beans.factory.support.DefaultL istableBeanFactory] - Retrieved dependent beans for bean 'jobScheduler': [jmxBean]
    2007-02-23 12:01:42,383 DEBUG [org.springframework.beans.factory.support.DefaultL istableBeanFactory] - Retrieved dependent beans for bean 'jmxBean': [mbeanExporter]
    2007-02-23 12:01:42,383 DEBUG [org.springframework.beans.factory.support.Disposab leBeanAdapter] - Applying DestructionAwareBeanPostProcessors to bean with name 'Scheduler'
    2007-02-23 12:01:42,383 DEBUG [org.springframework.beans.factory.support.Disposab leBeanAdapter] - Invoking destroy() on bean with name 'Scheduler'
    2007-02-23 12:01:42,383 INFO [org.springframework.scheduling.quartz.SchedulerFac toryBean] - Shutting down Quartz Scheduler
    2007-02-23 12:01:42,383 INFO [org.quartz.core.QuartzScheduler] - Scheduler DefaultQuartzScheduler_$_NON_CLUSTERED shutting down.
    2007-02-23 12:01:42,383 INFO [org.quartz.core.QuartzScheduler] - Scheduler DefaultQuartzScheduler_$_NON_CLUSTERED paused.
    2007-02-23 12:01:42,383 DEBUG [org.quartz.simpl.SimpleThreadPool] - WorkerThread is shutting down
    2007-02-23 12:01:42,383 DEBUG [org.quartz.simpl.SimpleThreadPool] - WorkerThread is shutting down
    2007-02-23 12:01:42,414 DEBUG [org.quartz.simpl.SimpleThreadPool] - WorkerThread is shutting down
    2007-02-23 12:01:42,430 DEBUG [org.quartz.simpl.SimpleThreadPool] - WorkerThread is shutting down
    2007-02-23 12:01:42,430 DEBUG [org.quartz.simpl.SimpleThreadPool] - WorkerThread is shutting down
    2007-02-23 12:01:42,430 DEBUG [org.quartz.simpl.SimpleThreadPool] - WorkerThread is shutting down
    2007-02-23 12:01:42,430 DEBUG [org.quartz.simpl.SimpleThreadPool] - WorkerThread is shutting down
    2007-02-23 12:01:42,430 DEBUG [org.quartz.simpl.SimpleThreadPool] - WorkerThread is shutting down
    2007-02-23 12:01:42,414 DEBUG [org.quartz.simpl.SimpleThreadPool] - WorkerThread is shutting down
    2007-02-23 12:01:42,430 DEBUG [org.quartz.simpl.SimpleThreadPool] - WorkerThread is shutting down
    2007-02-23 12:01:42,430 INFO [org.quartz.core.QuartzScheduler] - Scheduler DefaultQuartzScheduler_$_NON_CLUSTERED shutdown complete.
    2007-02-23 12:01:42,461 DEBUG [org.springframework.beans.factory.support.DefaultL istableBeanFactory] - Retrieved dependent beans for bean 'httpSuccessResponseCodeList': [httpProcessor]
    2007-02-23 12:01:42,461 DEBUG [org.springframework.beans.factory.support.DefaultL istableBeanFactory] - Retrieved dependent beans for bean 'httpProcessor': [cmeCornerNightlyServiceTarget]
    2007-02-23 12:01:42,461 DEBUG [org.springframework.beans.factory.support.DefaultL istableBeanFactory] - Retrieved dependent beans for bean 'cmeCornerNightlyServiceTarget': [cmeCornerNightlyService]
    2007-02-23 12:01:42,461 DEBUG [org.springframework.beans.factory.support.Disposab leBeanAdapter] - Applying DestructionAwareBeanPostProcessors to bean with name 'httpSuccessResponseCodeList'
    2007-02-23 12:01:42,461 DEBUG [org.springframework.beans.factory.support.Disposab leBeanAdapter] - Invoking destroy() on bean with name 'httpSuccessResponseCodeList'
    2007-02-23 12:01:42,492 DEBUG [org.springframework.beans.factory.support.DefaultL istableBeanFactory] - Retrieved dependent beans for bean 'crcCmeParticipantMap': [cmeCornerNightlyServiceTarget]
    2007-02-23 12:01:42,492 DEBUG [org.springframework.beans.factory.support.Disposab leBeanAdapter] - Applying DestructionAwareBeanPostProcessors to bean with name 'crcCmeParticipantMap'
    2007-02-23 12:01:42,492 DEBUG [org.springframework.beans.factory.support.Disposab leBeanAdapter] - Invoking destroy() on bean with name 'crcCmeParticipantMap'
    2007-02-23 12:01:42,508 DEBUG [org.springframework.beans.factory.support.DefaultL istableBeanFactory] - Retrieved dependent beans for bean 'sessionFactory': [nindscrcTransactionManager, lookupDao, sequenceDao, ctGovNightlyDao, cmeLookUpServiceDao, cmeCornerNightlyDao, nightlyJobs:type=HibernateStatistics]
    2007-02-23 12:01:42,523 DEBUG [org.springframework.beans.factory.support.DefaultL istableBeanFactory] - Retrieved dependent beans for bean 'nindscrcTransactionManager': [nightlyServiceTransactionInterceptor]
    2007-02-23 12:01:42,523 DEBUG [org.springframework.beans.factory.support.DefaultL istableBeanFactory] - Retrieved dependent beans for bean 'lookupDao': [lookupService]
    2007-02-23 12:01:42,570 DEBUG [org.springframework.beans.factory.support.DefaultL istableBeanFactory] - Retrieved dependent beans for bean 'lookupService': [ctGovNightlyServiceTarget, cmeCornerNightlyServiceTarget]
    2007-02-23 12:01:42,570 DEBUG [org.springframework.beans.factory.support.DefaultL istableBeanFactory] - Retrieved dependent beans for bean 'ctGovNightlyServiceTarget': [ctGovNightlyService]
    2007-02-23 12:01:42,601 DEBUG [org.springframework.beans.factory.support.DefaultL istableBeanFactory] - Retrieved dependent beans for bean 'sequenceDao': [sequenceService]
    2007-02-23 12:01:42,601 DEBUG [org.springframework.beans.factory.support.DefaultL istableBeanFactory] - Retrieved dependent beans for bean 'sequenceService': [ctGovNightlyServiceTarget]
    2007-02-23 12:01:42,601 DEBUG [org.springframework.beans.factory.support.DefaultL istableBeanFactory] - Retrieved dependent beans for bean 'ctGovNightlyDao': [ctGovNightlyServiceTarget]
    2007-02-23 12:01:42,601 DEBUG [org.springframework.beans.factory.support.DefaultL istableBeanFactory] - Retrieved dependent beans for bean 'cmeLookUpServiceDao': [cmeLookUpService]
    2007-02-23 12:01:42,601 DEBUG [org.springframework.beans.factory.support.DefaultL istableBeanFactory] - Retrieved dependent beans for bean 'cmeLookUpService': [cmeCornerNightlyServiceTarget]
    2007-02-23 12:01:42,601 DEBUG [org.springframework.beans.factory.support.DefaultL istableBeanFactory] - Retrieved dependent beans for bean 'cmeCornerNightlyDao': [cmeCornerNightlyServiceTarget]
    2007-02-23 12:01:42,601 DEBUG [org.springframework.beans.factory.support.Disposab leBeanAdapter] - Applying DestructionAwareBeanPostProcessors to bean with name 'sessionFactory'
    2007-02-23 12:01:42,601 DEBUG [org.springframework.beans.factory.support.Disposab leBeanAdapter] - Invoking destroy() on bean with name 'sessionFactory'
    2007-02-23 12:01:42,601 INFO [org.springframework.orm.hibernate3.LocalSessionFac toryBean] - Closing Hibernate SessionFactory
    2007-02-23 12:01:42,648 INFO [org.hibernate.impl.SessionFactoryImpl] - closing
    Attached Images Attached Images

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •