Reputation: 1
We have configured a xml based quartz job whic was working fine with java 7 but after upgrading to java 8 the job got hanged after 2, 3 iterations whatever the cron expression is we are testing it for every 5 seconds. We suspect that the problem might be because of DB connection lost without any error or connection pool is empty, or might be VFS2 library. (However we created a saimple app which connects with sftp and do some simple DB operation with JDBC and it runs without any problem).
jdbc.driverClassName=net.sourceforge.jtds.jdbc.Drivercom.microsoft.sqlserver.jdbc.SQLServerDriver
jdbc.url=jdbc:jtds:sqlserver://SERVER_ADDRESS:1433/SERVER_NAME
jdbc.username=USER
jdbc.password=PASS
jdbc.initialSize=5
jdbc.maxTotal=150
jdbc.maxIdle=15
jdbc.minIdle=5
jdbc.maxWaitMillis=10000
jdbc.validationQuery=SELECT 1
jdbc.validationQueryTimeout=10
jdbc.testOnBorrow=true
jdbc.testOnReturn=false
jdbc.testWhileIdle=false
jdbc.timeBetweenEvictionRunsMillis=1803000
jdbc.minEvictableIdleTimeMillis=1800000
jdbc.removeAbandonedOnMaintenance=true
jdbc.removeAbandonedOnBorrow=true
jdbc.removeAbandonedTimeout=300
jdbc.logAbandoned=true
We are using maven based java 8 project exact version of java is: jdk1.8.0_311. This ia web application deployed on tomcat8.5 we also tried tomcat 9 without any successs
Main dependencies are: SPRING4 ,hibernate3.6.9.Final, Apache commons-vfs2 version 2.7.0, DB is sqlServer
These are the xml bean defination of quartz job:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:util="http://www.springframework.org/schema/util"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/util
http://www.springframework.org/schema/util/spring-util-2.5.xsd">
<bean id="automaticInterviewImportJob" class="cem.interview.importtool.quartz.InterviewImportJob" scope = "singleton">
</bean>
<bean id="automaticReportGenerationJob" class="cem.interview.importtool.quartz.ReportGenerationJob" scope = "singleton">
</bean>
<!-- Address import job -->
<bean id="automaticInterviewImportJobDetail"
class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">
<property name="targetObject" ref="automaticInterviewImportJob" />
<property name="targetMethod" value="run" />
<property name="concurrent" value="false"/>
</bean>
<bean id="automaticInterviewImportJobTriger" class="org.springframework.scheduling.quartz.CronTriggerFactoryBean">
<!-- class="org.springframework.scheduling.quartz.SimpleTriggerBean"> -->
<property name="jobDetail" ref="automaticInterviewImportJobDetail"/>
<property name="cronExpression" value="0/5 * * * * ? *"/>
</bean>
<!-- Address import job -->
<bean id="automaticGenerateExcelReportsJobDetail"
class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">
<property name="targetObject" ref="automaticReportGenerationJob" />
<property name="targetMethod" value="run" />
<property name="concurrent" value="false"/>
</bean>
<bean id="automaticGenerateExcelReportJobTriger" class="org.springframework.scheduling.quartz.CronTriggerFactoryBean">
<!-- class="org.springframework.scheduling.quartz.SimpleTriggerBean"> -->
<property name="jobDetail" ref="automaticGenerateExcelReportsJobDetail"/>
<property name="cronExpression" value="0/5 * * * * ? *"/>
</bean>
<bean id="scheduler" class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
<property name="applicationContextSchedulerContextKey" value="applicationContext" />
<property name="waitForJobsToCompleteOnShutdown" value="true" />
<property name="jobFactory">
<bean class="org.springframework.scheduling.quartz.SpringBeanJobFactory"/>
</property>
<property name="globalJobListeners">
<list>
</list>
</property>
<property name="triggers">
<list>
<ref bean="automaticInterviewImportJobTriger" />
<ref bean="automaticGenerateExcelReportJobTriger" />
</list>
</property>
</bean>
</beans>
Upvotes: 0
Views: 47
Reputation: 13
What quartz version you use? Make sure you use Quartz 2.4.0+. Everything that is lower - is not compatible with Java 8.
Can it be the case that other instances of your app with old java version are connected to the same DB acquire lock for some job in db and fails? In other words make sure you update JDK on all your app instances connected to this DB.
Upvotes: 0