Announcement Announcement Module
Collapse
No announcement yet.
Quartz 1.8.5 + Upgraded Spring 3.1.2 to 3.2.2 - java.lang.reflect.UndeclaredThrowable Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Quartz 1.8.5 + Upgraded Spring 3.1.2 to 3.2.2 - java.lang.reflect.UndeclaredThrowable

    We recently just upgraded our environment from Hibernate 4.1.5.SP1 and Spring 3.1.2.RELEASE to Hibernate 4.2.0 and Spring 3.2.2. The very first issue we encountered after the upgrade was the following issue from our background Quartz scheduler bean when the webapp was loaded inside Tomcat 7.

    Code:
    2013-03-22 10:55:49,231 INFO  [org.springframework.beans.factory.support.DefaultListableBeanFactory]: 
    2013-03-22 10:55:51,601 INFO  [org.quartz.core.SchedulerSignalerImpl]: Initialized Scheduler Signaller of type: class org.quartz.core.SchedulerSignalerImpl
    2013-03-22 10:55:51,601 INFO  [org.quartz.core.QuartzScheduler]: Quartz Scheduler v.1.8.5 created.
    2013-03-22 10:55:51,615 INFO  [org.springframework.scheduling.quartz.LocalDataSourceJobStore]: Using db table-based data access locking (synchronization).
    2013-03-22 10:55:51,618 INFO  [org.springframework.scheduling.quartz.LocalDataSourceJobStore]: JobStoreCMT initialized.
    2013-03-22 10:55:51,624 INFO  [org.quartz.core.QuartzScheduler]: Scheduler meta-data: Quartz Scheduler (v1.8.5) 'schedulerFactoryBean' with instanceId 'CL22551363967751585'
      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 5 threads.
      Using job-store 'org.springframework.scheduling.quartz.LocalDataSourceJobStore' - which supports persistence. and is clustered.
    
    2013-03-22 10:55:51,624 INFO  [org.quartz.impl.StdSchedulerFactory]: Quartz scheduler 'schedulerFactoryBean' initialized from an externally provided properties instance.
    2013-03-22 10:55:51,624 INFO  [org.quartz.impl.StdSchedulerFactory]: Quartz scheduler version: 1.8.5
    2013-03-22 10:55:51,626 INFO  [org.quartz.core.QuartzScheduler]: JobFactory set to: [email protected]
    2013-03-22 10:55:51,738 DEBUG [org.quartz.impl.jdbcjobstore.StdRowLockSemaphore]: Lock 'TRIGGER_ACCESS' is desired by: localhost-startStop-1
    2013-03-22 10:55:51,752 ERROR [org.springframework.scheduling.quartz.SchedulerFactoryBean]: Job registration exception overridden by rollback exception
    java.lang.reflect.UndeclaredThrowableException
    	at com.sun.proxy.$Proxy128.prepareStatement(Unknown Source)
    	at org.quartz.impl.jdbcjobstore.StdRowLockSemaphore.executeSQL(StdRowLockSemaphore.java:81)
    	at org.quartz.impl.jdbcjobstore.DBSemaphore.obtainLock(DBSemaphore.java:112)
    	at org.quartz.impl.jdbcjobstore.JobStoreCMT.executeInLock(JobStoreCMT.java:235)
    	at org.quartz.impl.jdbcjobstore.JobStoreSupport.executeInLock(JobStoreSupport.java:3692)
    	at org.quartz.impl.jdbcjobstore.JobStoreSupport.storeJob(JobStoreSupport.java:1075)
    	at org.quartz.core.QuartzScheduler.addJob(QuartzScheduler.java:886)
    	at org.quartz.impl.StdScheduler.addJob(StdScheduler.java:266)
    	at org.springframework.scheduling.quartz.SchedulerAccessor.addJobToScheduler(SchedulerAccessor.java:342)
    	at org.springframework.scheduling.quartz.SchedulerAccessor.addTriggerToScheduler(SchedulerAccessor.java:365)
    	at org.springframework.scheduling.quartz.SchedulerAccessor.registerJobsAndTriggers(SchedulerAccessor.java:303)
    	at org.springframework.scheduling.quartz.SchedulerFactoryBean.afterPropertiesSet(SchedulerFactoryBean.java:511)
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1547)
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1485)
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:524)
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:461)
    	at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:295)
    	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223)
    	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:292)
    	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
    	at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:608)
    	at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:932)
    	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:479)
    	at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:389)
    	at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:294)
    	at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:112)
    	at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4797)
    	at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5291)
    	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    	at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)
    	at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
    	at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:633)
    	at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1114)
    	at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1673)
    	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
    	at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
    	at java.util.concurrent.FutureTask.run(FutureTask.java:166)
    	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    	at java.lang.Thread.run(Thread.java:722)
    Caused by: java.lang.reflect.InvocationTargetException
    	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    	at java.lang.reflect.Method.invoke(Method.java:601)
    	at org.quartz.impl.jdbcjobstore.AttributeRestoringConnectionInvocationHandler.invoke(AttributeRestoringConnectionInvocationHandler.java:71)
    	... 40 more
    Caused by: java.sql.SQLException: Connection is closed.
    	at org.apache.tomcat.dbcp.dbcp.PoolingDataSource$PoolGuardConnectionWrapper.checkOpen(PoolingDataSource.java:185)
    	at org.apache.tomcat.dbcp.dbcp.PoolingDataSource$PoolGuardConnectionWrapper.prepareStatement(PoolingDataSource.java:312)
    	... 45 more
    Obviously the stack trace appears to point to a closed connection. But according to our review of change logs, nothing caught our eye that implied we needed to modify how connection management was being done.

    Our database connection is defined in tomcat's context.xml as a javax.sql.Datasource which we reference inside our spring configuration when we setup spring's transaction manager and setup the entity manager for hibernate.

    If I comment out the scheduler bean portion of my spring configuration, the webapp starts up just fine and works as expected which leads me to think there is some initialization order changed with Hibernate/Spring between these versions that is affecting Quartz.

    Is this perhaps due to the version we are on or is there a configuration change we may have overlooked?

  • #2
    As a follow-up, also upgraded Quartz to 1.8.6 with no change either.

    Comment


    • #3
      Code:
      <bean id='schedulerFactoryBean' class='org.springframework.scheduling.quartz.SchedulerFactoryBean'>
      
      		<property name="applicationContextSchedulerContextKey" value="applicationContext" />
      		<property name="dataSource" ref="dataSource" />
      		<property name="transactionManager" ref="transactionManager" />
      		<property name="overwriteExistingJobs" value="false" />
      		<property name="autoStartup" value="true" />
      
      		<property name='triggers'>
      			<list>
      				<!-- 
      				<ref bean='delvConfPastDueNotifyTrigger'		/>
                                       -->
      				<ref bean='expiredQuoteNotificationsTrigger' 	/>
      				<ref bean='purgeNoticationsTrigger' 			/>
      				<ref bean='advancedNotifyCalPmTrigger' 			/> 
      				<ref bean='importExchangeRatesTrigger'			/>
      			</list>
      		</property>
      		
      		<property name='quartzProperties'>
      			<props>
      				<prop key="org.quartz.scheduler.instanceName">ClusteredScheduler</prop>
      				<prop key="org.quartz.scheduler.instanceId">AUTO</prop>
      				<prop key="org.quartz.jobStore.misfireThreshold">60000</prop>
      				<prop key="org.quartz.jobStore.class">org.quartz.impl.jdbcjobstore.JobStoreTX</prop>
      				<prop key="org.quartz.jobStore.driverDelegateClass">org.quartz.impl.jdbcjobstore.MSSQLDelegate</prop>
      				<!-- <prop key="org.quartz.jobStore.tablePrefix">quartz_</prop>-->
      				<prop key="org.quartz.jobStore.selectWithLockSQL">SELECT * FROM {0}LOCKS UPDLOCK WHERE LOCK_NAME = ?</prop>
      				<prop key="org.quartz.jobStore.isClustered">true</prop>
      				<prop key="org.quartz.threadPool.class">org.quartz.simpl.SimpleThreadPool</prop>
      				<prop key="org.quartz.threadPool.threadCount">5</prop>
      				<prop key="org.quartz.threadPool.threadPriority">5</prop>
      				<prop key="org.quartz.scheduler.jmx.export">false</prop>
      			</props>
      		</property>
      	</bean>
      If I comment out the triggers, everything starts just fine. I cannot determine what could be wrong with the above configuration. Do any others have any suggestions. This worked prior to the jar upgrades with Spring 3.1.2 and Hibernate 4.1.5.sp1.

      Comment


      • #4
        Reverted Hibernate back to Hibernate 4.1.11 which works for the short-term rather than Hibernate 4.2 and the issue went away.

        After further discussion, one of the changes in Hibernate 4.2 was HHH-7902. I'm not entirely sure whether or not this change is what is causing the problems experienced above or not related to the trigger queries that Spring/Quartz fire during startup, but unfortunately I am unable to define any triggers using Spring 3.2.2 with Hibernate 4.2 when using a JDBC backed jobstore.

        Strangely enough, according to Spring's 3.2.2 changelog, it officially supports Hibernate 4.2.

        Talking in the #hibernate IRC channel, concern was pin-pointed to this line in DEBUG logs:
        013-03-22 15:46:21,419 DEBUG [org.springframework.orm.jpa.JpaTransactionManager]: Exposing JPA transaction as JDBC transaction [org.springframework.orm.jpa.vendor.HibernateJpaDia lect$HibernateConnectionHandle@12947bc6]

        Is anyone else using similar configurations?
        Last edited by crancran; Mar 22nd, 2013, 06:03 PM.

        Comment


        • #5
          No one using a jdbc backed jobstore with Quartz, Spring and Hibernate 4.2?

          Comment


          • #6
            Have you resolved this yet? I got the same problem with Quartz 1.8.5, Spring 3.1.1 and Hibernate 4.2.3
            I'm receiving below error while running integration tests with h2 error message is:

            The object is already closed [90007-161]
            Detail here: http://www.h2database.com/javadoc/or...de.html#c90007

            It's the same problem...

            Stacktrace below.
            STDOUT [ERROR] [2013.07.17 21:45:21] quartz.SchedulerFactoryBean - Job registration exception overridden by rollback exception
            java.lang.reflect.UndeclaredThrowableException
            at com.sun.proxy.$Proxy125.prepareStatement(Unknown Source)
            at org.quartz.impl.jdbcjobstore.StdRowLockSemaphore.e xecuteSQL(StdRowLockSemaphore.java:81)
            at org.quartz.impl.jdbcjobstore.DBSemaphore.obtainLoc k(DBSemaphore.java:112)
            at org.quartz.impl.jdbcjobstore.JobStoreCMT.executeIn Lock(JobStoreCMT.java:235)
            at org.quartz.impl.jdbcjobstore.JobStoreSupport.execu teInLock(JobStoreSupport.java:3692)
            at org.quartz.impl.jdbcjobstore.JobStoreSupport.store Job(JobStoreSupport.java:1075)
            at org.quartz.core.QuartzScheduler.addJob(QuartzSched uler.java:886)
            at org.quartz.impl.StdScheduler.addJob(StdScheduler.j ava:266)
            at org.springframework.scheduling.quartz.SchedulerAcc essor.addJobToScheduler(SchedulerAccessor.java:342 )
            at org.springframework.scheduling.quartz.SchedulerAcc essor.addTriggerToScheduler(SchedulerAccessor.java :365)
            at org.springframework.scheduling.quartz.SchedulerAcc essor.registerJobsAndTriggers(SchedulerAccessor.ja va:303)
            at org.springframework.scheduling.quartz.SchedulerFac toryBean.afterPropertiesSet(SchedulerFactoryBean.j ava:511)
            at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.invokeInitMethods(Abstr actAutowireCapableBeanFactory.java:1514)
            at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.initializeBean(Abstract AutowireCapableBeanFactory.java:1452)
            at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.doCreateBean(AbstractAu towireCapableBeanFactory.java:519)
            at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.createBean(AbstractAuto wireCapableBeanFactory.java:456)
            at org.springframework.beans.factory.support.Abstract BeanFactory$1.getObject(AbstractBeanFactory.java:2 94)
            at org.springframework.beans.factory.support.DefaultS ingletonBeanRegistry.getSingleton(DefaultSingleton BeanRegistry.java:225)
            at org.springframework.beans.factory.support.Abstract BeanFactory.doGetBean(AbstractBeanFactory.java:291 )
            at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:193)
            at org.springframework.beans.factory.support.DefaultL istableBeanFactory.preInstantiateSingletons(Defaul tListableBeanFactory.java:567)
            at org.springframework.context.support.AbstractApplic ationContext.finishBeanFactoryInitialization(Abstr actApplicationContext.java:913)
            at org.springframework.context.support.AbstractApplic ationContext.refresh(AbstractApplicationContext.ja va:464)
            at org.springframework.test.context.support.AbstractG enericContextLoader.loadContext(AbstractGenericCon textLoader.java:103)
            at org.springframework.test.context.support.AbstractG enericContextLoader.loadContext(AbstractGenericCon textLoader.java:1)
            at org.springframework.test.context.support.Delegatin gSmartContextLoader.loadContext(DelegatingSmartCon textLoader.java:228)
            at org.springframework.test.context.TestContext.loadA pplicationContext(TestContext.java:124)
            at org.springframework.test.context.TestContext.getAp plicationContext(TestContext.java:148)
            at org.springframework.test.context.support.Dependenc yInjectionTestExecutionListener.injectDependencies (DependencyInjectionTestExecutionListener.java:109 )
            at org.springframework.test.context.support.Dependenc yInjectionTestExecutionListener.prepareTestInstanc e(DependencyInjectionTestExecutionListener.java:75 )
            at org.springframework.test.context.TestContextManage r.prepareTestInstance(TestContextManager.java:321)
            at org.springframework.test.context.junit4.SpringJUni t4ClassRunner.createTest(SpringJUnit4ClassRunner.j ava:211)
            at org.springframework.test.context.junit4.SpringJUni t4ClassRunner$1.runReflectiveCall(SpringJUnit4Clas sRunner.java:288)
            at org.junit.internal.runners.model.ReflectiveCallabl e.run(ReflectiveCallable.java:15)
            at org.springframework.test.context.junit4.SpringJUni t4ClassRunner.methodBlock(SpringJUnit4ClassRunner. java:290)
            at org.springframework.test.context.junit4.SpringJUni t4ClassRunner.runChild(SpringJUnit4ClassRunner.jav a:231)
            at org.junit.runners.BlockJUnit4ClassRunner.runChild( BlockJUnit4ClassRunner.java:50)
            at org.junit.runners.ParentRunner$3.run(ParentRunner. java:193)
            at org.junit.runners.ParentRunner$1.schedule(ParentRu nner.java:52)
            at org.junit.runners.ParentRunner.runChildren(ParentR unner.java:191)
            at org.junit.runners.ParentRunner.access$000(ParentRu nner.java:42)
            at org.junit.runners.ParentRunner$2.evaluate(ParentRu nner.java:184)
            at org.junit.internal.runners.statements.RunBefores.e valuate(RunBefores.java:28)
            at org.springframework.test.context.junit4.statements .RunBeforeTestClassCallbacks.evaluate(RunBeforeTes tClassCallbacks.java:61)
            at org.junit.internal.runners.statements.RunAfters.ev aluate(RunAfters.java:31)
            at org.springframework.test.context.junit4.statements .RunAfterTestClassCallbacks.evaluate(RunAfterTestC lassCallbacks.java:71)
            at org.junit.runners.ParentRunner.run(ParentRunner.ja va:236)
            at org.springframework.test.context.junit4.SpringJUni t4ClassRunner.run(SpringJUnit4ClassRunner.java:174 )
            at org.apache.maven.surefire.junit4.JUnit4TestSet.exe cute(JUnit4TestSet.java:53)
            at org.apache.maven.surefire.junit4.JUnit4Provider.ex ecuteTestSet(JUnit4Provider.java:123)
            at org.apache.maven.surefire.junit4.JUnit4Provider.in voke(JUnit4Provider.java:104)
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(Native MethodAccessorImpl.java:57)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:43)
            at java.lang.reflect.Method.invoke(Method.java:601)
            at org.apache.maven.surefire.util.ReflectionUtils.inv okeMethodWithArray(ReflectionUtils.java:164)
            at org.apache.maven.surefire.booter.ProviderFactory$P roviderProxy.invoke(ProviderFactory.java:110)
            at org.apache.maven.surefire.booter.SurefireStarter.i nvokeProvider(SurefireStarter.java:175)
            at org.apache.maven.surefire.booter.SurefireStarter.r unSuitesInProcessWhenForked(SurefireStarter.java:1 07)
            at org.apache.maven.surefire.booter.ForkedBooter.main (ForkedBooter.java:68)
            Caused by: java.lang.reflect.InvocationTargetException
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(Native MethodAccessorImpl.java:57)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:43)
            at java.lang.reflect.Method.invoke(Method.java:601)
            at org.quartz.impl.jdbcjobstore.AttributeRestoringCon nectionInvocationHandler.invoke(AttributeRestoring ConnectionInvocationHandler.java:71)
            ... 60 more
            Caused by: org.h2.jdbc.JdbcSQLException: The object is already closed [90007-161]
            at org.h2.message.DbException.getJdbcSQLException(DbE xception.java:329)
            at org.h2.message.DbException.get(DbException.java:16 9)
            at org.h2.message.DbException.get(DbException.java:14 6)
            at org.h2.message.DbException.get(DbException.java:13 5)
            at org.h2.jdbc.JdbcConnection.checkClosed(JdbcConnect ion.java:1391)
            at org.h2.jdbc.JdbcConnection.checkClosed(JdbcConnect ion.java:1369)
            at org.h2.jdbc.JdbcConnection.prepareStatement(JdbcCo nnection.java:265)
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(Native MethodAccessorImpl.java:57)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:43)
            at java.lang.reflect.Method.invoke(Method.java:601)
            at org.springframework.jdbc.datasource.LazyConnection DataSourceProxy$LazyConnectionInvocationHandler.in voke(LazyConnectionDataSourceProxy.java:376)
            at com.sun.proxy.$Proxy39.prepareStatement(Unknown Source)
            ... 65 more

            Comment


            • #7
              Originally posted by blumm View Post
              Have you resolved this yet? I got the same problem with Quartz 1.8.5, Spring 3.1.1 and Hibernate 4.2.3
              I'm receiving below error while running integration tests with h2 error message is:
              IIRC, it was related to https://jira.springsource.org/browse/SPR-10395. Once Spring 3.2.3 was released, we upgraded to the Hibernate 4.2 branch without any issues.

              Comment

              Working...
              X