Announcement Announcement Module
Collapse
No announcement yet.
Quartz + problem JDBC driver Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Quartz + problem JDBC driver

    Hi,

    I configured my quartz scheduling and it is executed.
    My batchjob has some references to other other beans, and they contain a reference to my service which has a ref to my DAO's...
    Here a Jdbc template is configured that works with a Jndi datasource that is configured in my web.xml.

    So when I run my application, there is no problem at all.
    There is also no problem with the persistence.
    But the quartz scheduling throws an exeption that it can't find a jdbc driver.
    however, my dao's are working fine with the driver.
    Does the quartz class need an extra reference to the datasource?

    thx.

    Here is a part of the configuration:
    Code:
    	<!-- Quartz scheduling -->
    	<bean class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
    		<property name="triggers">
    			<list>
    				<ref bean="cronBatchTrigger"/>
    			</list>
    		</property>
    	</bean>
    	
    	<bean id="cronBatchTrigger" class="org.springframework.scheduling.quartz.CronTriggerBean">
    		<property name="jobDetail">
    			<ref bean="disclosuresBatchjob"/>
    		</property>
    		<property name="cronExpression">
    			<value>0 0 11 3 8 ?</value>
    		</property>
    	</bean>
    
    	<!-- Quartz batch job -->
    	<bean id="disclosuresBatchjob" class="org.springframework.scheduling.quartz.JobDetailBean">
    		<property name="jobClass">
    			<value>com.fortis.be.disclosures.batch.JobEntry</value>
    		</property>
    		<property name="jobDataAsMap">
    			<map>
    				<entry key="inputReader"><ref bean="inputReader"/></entry>
    				<entry key="validator"><ref bean="validator"/></entry>
    				<entry key="transferWorker"><ref bean="transferWorker"/></entry>
    				<entry key="metaDataProcessor"><ref bean="metaDataProcessor"/></entry>
    				<entry key="cleaningWorker"><ref bean="cleaningWorker"/></entry>
    			</map>
    		</property>
    	</bean>
    
    ...
    
    	<bean id="dataSource" class="org.springframework.jndi.JndiObjectFactoryBean">
    		<property name="jndiName">
    			<value>java:comp/env/jdbc/DisclosuresDB</value>
    		</property>
    	</bean>
    
    	<bean id="jdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate">
    	 	<property name="dataSource"><ref bean="dataSource"/></property>
    	</bean>
    
    	<bean id="errorDAO" parent="disclosuresProxy">
    		<property name="proxyInterfaces">
    			<value>com.fortis.be.disclosures.dao.DisclosuresErrorDAO</value>
    		</property>
    		<property name="target">
    			<bean class="com.fortis.be.disclosures.dao.impl.DisclosuresErrorDAOImpl">
    				<property name="jdbcTemplate"><ref bean="jdbcTemplate"/></property>
    			</bean>
    		</property>
    	</bean>
    Here is the error:

    03/08/2007 11:00:00 [DefaultQuartzScheduler_Worker-1] ERROR - (org.quartz.core.JobRunShell:211) - Job DEFAULT.disclosuresBatchjob threw an unhandled Exception:
    org.springframework.jdbc.CannotGetJdbcConnectionEx ception: Could not get JDBC Connection; nested exception is org.apache.commons.dbcp.SQLNestedException: Cannot create JDBC driver of class '' for connect URL 'null'
    Caused by:
    org.apache.commons.dbcp.SQLNestedException: Cannot create JDBC driver of class '' for connect URL 'null'
    at org.apache.commons.dbcp.BasicDataSource.createData Source(BasicDataSource.java:780)
    at org.apache.commons.dbcp.BasicDataSource.getConnect ion(BasicDataSource.java:540)
    at org.springframework.jdbc.datasource.DataSourceUtil s.doGetConnection(DataSourceUtils.java:113)
    at org.springframework.jdbc.datasource.DataSourceUtil s.getConnection(DataSourceUtils.java:79)
    at org.springframework.jdbc.core.JdbcTemplate.execute (JdbcTemplate.java:523)
    at org.springframework.jdbc.core.JdbcTemplate.update( JdbcTemplate.java:738)
    at org.springframework.jdbc.core.JdbcTemplate.update( JdbcTemplate.java:796)
    at org.springframework.jdbc.core.JdbcTemplate.update( JdbcTemplate.java:800)
    at com.fortis.be.disclosures.dao.impl.DisclosuresErro rDAOImpl.saveError(DisclosuresErrorDAOImpl.java:48 )
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Native MethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:324)
    at org.springframework.aop.support.AopUtils.invokeJoi npointUsingReflection(AopUtils.java:296)
    at org.springframework.aop.framework.JdkDynamicAopPro xy.invoke(JdkDynamicAopProxy.java:198)
    at $Proxy4.saveError(Unknown Source)
    at com.fortis.be.disclosures.service.impl.DisclosureS erviceImpl.logError(DisclosureServiceImpl.java:54)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Native MethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:324)
    at org.springframework.aop.support.AopUtils.invokeJoi npointUsingReflection(AopUtils.java:296)
    at org.springframework.aop.framework.JdkDynamicAopPro xy.invoke(JdkDynamicAopProxy.java:198)
    at $Proxy5.logError(Unknown Source)
    at com.fortis.be.disclosures.batch.InputValidator.val idate(InputValidator.java:135)
    at com.fortis.be.disclosures.batch.JobEntry.executeIn ternal(JobEntry.java:38)
    at org.springframework.scheduling.quartz.QuartzJobBea n.execute(QuartzJobBean.java:86)
    at org.quartz.core.JobRunShell.run(JobRunShell.java:2 02)
    at org.quartz.simpl.SimpleThreadPool$WorkerThread.run (SimpleThreadPool.java:529)
    Caused by: java.sql.SQLException: No suitable driver
    at java.sql.DriverManager.getDriver(DriverManager.jav a:243)
    at org.apache.commons.dbcp.BasicDataSource.createData Source(BasicDataSource.java:773)
    ... 28 more
    03/08/2007 11:00:00 [DefaultQuartzScheduler_Worker-1] ERROR - (org.quartz.core.ErrorLogger:2156) - Job (DEFAULT.disclosuresBatchjob threw an exception.
    org.quartz.SchedulerException: Job threw an unhandled exception. [See nested exception: org.springframework.jdbc.CannotGetJdbcConnectionEx ception: Could not get JDBC Connection; nested exception is org.apache.commons.dbcp.SQLNestedException: Cannot create JDBC driver of class '' for connect URL 'null']
    at org.quartz.core.JobRunShell.run(JobRunShell.java:2 13)
    at org.quartz.simpl.SimpleThreadPool$WorkerThread.run (SimpleThreadPool.java:529)
    Caused by: org.springframework.jdbc.CannotGetJdbcConnectionEx ception: Could not get JDBC Connection; nested exception is org.apache.commons.dbcp.SQLNestedException: Cannot create JDBC driver of class '' for connect URL 'null'
    at org.springframework.jdbc.datasource.DataSourceUtil s.getConnection(DataSourceUtils.java:82)
    at org.springframework.jdbc.core.JdbcTemplate.execute (JdbcTemplate.java:523)
    at org.springframework.jdbc.core.JdbcTemplate.update( JdbcTemplate.java:738)
    at org.springframework.jdbc.core.JdbcTemplate.update( JdbcTemplate.java:796)
    at org.springframework.jdbc.core.JdbcTemplate.update( JdbcTemplate.java:800)
    at com.fortis.be.disclosures.dao.impl.DisclosuresErro rDAOImpl.saveError(DisclosuresErrorDAOImpl.java:48 )
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Native MethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:324)
    at org.springframework.aop.support.AopUtils.invokeJoi npointUsingReflection(AopUtils.java:296)
    at org.springframework.aop.framework.JdkDynamicAopPro xy.invoke(JdkDynamicAopProxy.java:198)
    at $Proxy4.saveError(Unknown Source)
    at com.fortis.be.disclosures.service.impl.DisclosureS erviceImpl.logError(DisclosureServiceImpl.java:54)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Native MethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:324)
    at org.springframework.aop.support.AopUtils.invokeJoi npointUsingReflection(AopUtils.java:296)
    at org.springframework.aop.framework.JdkDynamicAopPro xy.invoke(JdkDynamicAopProxy.java:198)
    at $Proxy5.logError(Unknown Source)
    at com.fortis.be.disclosures.batch.InputValidator.val idate(InputValidator.java:135)
    at com.fortis.be.disclosures.batch.JobEntry.executeIn ternal(JobEntry.java:38)
    at org.springframework.scheduling.quartz.QuartzJobBea n.execute(QuartzJobBean.java:86)
    at org.quartz.core.JobRunShell.run(JobRunShell.java:2 02)
    ... 1 more
    Caused by: org.apache.commons.dbcp.SQLNestedException: Cannot create JDBC driver of class '' for connect URL 'null'
    at org.apache.commons.dbcp.BasicDataSource.createData Source(BasicDataSource.java:780)
    at org.apache.commons.dbcp.BasicDataSource.getConnect ion(BasicDataSource.java:540)
    at org.springframework.jdbc.datasource.DataSourceUtil s.doGetConnection(DataSourceUtils.java:113)
    at org.springframework.jdbc.datasource.DataSourceUtil s.getConnection(DataSourceUtils.java:79)
    ... 25 more
    Caused by: java.sql.SQLException: No suitable driver
    at java.sql.DriverManager.getDriver(DriverManager.jav a:243)
    at org.apache.commons.dbcp.BasicDataSource.createData Source(BasicDataSource.java:773)
    ... 28 more
    Last edited by mesquite; Aug 3rd, 2007, 06:40 AM.

  • #2
    hi,

    I haven't worked with quartz yet but there is a datasource property that can be set on
    org.springframework.scheduling.quartz.SchedulerFac toryBean.

    Maybe try setting this property?

    greetz,
    Stijn

    Comment


    • #3
      Nomally the scheduler doesn't need a dataSource property.
      The dao's are set just fine.

      But I think it's a tomcat configuration issue.
      The commons dbcp are complaining about a missing resource, however the application is working just fine.

      Comment

      Working...
      X