Announcement Announcement Module
Collapse
No announcement yet.
Exception occurs when using the SchedulerFactoryBean and a datasource Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Exception occurs when using the SchedulerFactoryBean and a datasource

    I am trying to use the SchedulerFactoryBean with a datasource, but am receiving an exception when it tries to update the Job in the database after it has been fired. It's able to create the Job in the database, but it is not able to update the record after the job has finished firing. I am at a total loss as to why there are connection reset exceptions happening. I am using the following libraries and servers:

    Spring 2.0
    Quartz 1.6.0
    JTDS 1.2
    SQL Server 2005
    JBoss AS 4.0.4 GA
    ServiceMix 3.0.1

    I can't imagine that the reason I am having connectivity issues is because it's running under ServiceMix, but you never know.

    Here is the configuration for the SchedulerFactoryBean, this bean is later used in a bean that I have in a ServiceMix configuration file. But there isn't all that much going on in that so I have left it out.

    Code:
    <beans>
      <bean id="dataSource" class="org.springframework.jndi.JndiObjectFactoryBean">	
        <property name="jndiName"><value>java:quartzDs</value></property>		
      </bean>
    	
      <bean id="scheduler" 
        class="org.springframework.scheduling.quartz.SchedulerFactoryBean" lazy-init="false">
        <property name="dataSource">
            <ref bean="dataSource"/>
        </property>
        <property name="autoStartup"><value>true</value></property>
        <property name="applicationContextSchedulerContextKey"><value>applicationContext</value></property> 
        <property name="waitForJobsToCompleteOnShutdown"><value>true</value></property> 
        <property name="quartzProperties">
          <props>
            <!-- ThreadPool -->
            <prop key="org.quartz.scheduler.instanceName">RandomList Timer</prop>
            <prop key="org.quartz.scheduler.instanceId">AUTO</prop>
            <!-- ThreadPool -->
            <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>
              <!-- Job store -->
            <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.useProperties">false</prop>
            <prop key="org.quartz.jobStore.selectWithLockSQL">SELECT * FROM {0}LOCKS UPDLOCK WHERE LOCK_NAME = ?</prop>
            <prop key="org.quartz.jobStore.isClustered">true</prop>
          </props>
        </property>
      </bean>
      
    </beans>
    Here is the exception that I am receiving:

    2007-02-03 21:20:00,061 INFO [STDOUT] 21:20:00,061 ERROR [ErrorLogger] An error occured while marking executed job complete. job= 'ServiceMix.Randomlist Job'
    org.quartz.JobPersistenceException: Failed to obtain DB connection from data source 'springNonTxDataSource.RandomList Timer': org.jboss.util.NestedSQLException: Could not create connection; - nested throwable: (java.sql.SQLException: I/O Error: Connection reset); - nested throwable: (org.jboss.resource.JBossResourceException: Could not create connection; - nested throwable: (java.sql.SQLException: I/O Error: Connection reset)) [See nested exception: org.jboss.util.NestedSQLException: Could not create connection; - nested throwable: (java.sql.SQLException: I/O Error: Connection reset); - nested throwable: (org.jboss.resource.JBossResourceException: Could not create connection; - nested throwable: (java.sql.SQLException: I/O Error: Connection reset))]
    at org.quartz.impl.jdbcjobstore.JobStoreCMT.getNonMan agedTXConnection(JobStoreCMT.java:167)
    at org.quartz.impl.jdbcjobstore.JobStoreSupport.execu teInNonManagedTXLock(JobStoreSupport.java:3652)
    at org.quartz.impl.jdbcjobstore.JobStoreSupport.execu teInNonManagedTXLock(JobStoreSupport.java:3624)
    at org.quartz.impl.jdbcjobstore.JobStoreSupport.trigg eredJobComplete(JobStoreSupport.java:2868)
    at org.quartz.core.QuartzScheduler.notifyJobStoreJobC omplete(QuartzScheduler.java:1698)
    at org.quartz.core.JobRunShell.run(JobRunShell.java:2 73)
    at org.quartz.simpl.SimpleThreadPool$WorkerThread.run (SimpleThreadPool.java:529)
    Caused by: org.jboss.util.NestedSQLException: Could not create connection; - nested throwable: (java.sql.SQLException: I/O Error: Connection reset); - nested throwable: (org.jboss.resource.JBossResourceException: Could not create connection; - nested throwable: (java.sql.SQLException: I/O Error: Connection reset))
    at org.jboss.resource.adapter.jdbc.WrapperDataSource. getConnection(WrapperDataSource.java:94)
    at org.springframework.scheduling.quartz.LocalDataSou rceJobStore$2.getConnection(LocalDataSourceJobStor e.java:125)
    at org.quartz.utils.DBConnectionManager.getConnection (DBConnectionManager.java:112)
    at org.quartz.impl.jdbcjobstore.JobStoreCMT.getNonMan agedTXConnection(JobStoreCMT.java:164)
    ... 6 more
    Caused by: org.jboss.resource.JBossResourceException: Could not create connection; - nested throwable: (java.sql.SQLException: I/O Error: Connection reset)
    at org.jboss.resource.adapter.jdbc.local.LocalManaged ConnectionFactory.createManagedConnection(LocalMan agedConnectionFactory.java:177)
    at org.jboss.resource.connectionmanager.InternalManag edConnectionPool.createConnectionEventListener(Int ernalManagedConnectionPool.java:539)
    at org.jboss.resource.connectionmanager.InternalManag edConnectionPool.getConnection(InternalManagedConn ectionPool.java:228)
    at org.jboss.resource.connectionmanager.JBossManagedC onnectionPool$BasePool.getConnection(JBossManagedC onnectionPool.java:417)
    at org.jboss.resource.connectionmanager.BaseConnectio nManager2.getManagedConnection(BaseConnectionManag er2.java:324)
    at org.jboss.resource.connectionmanager.TxConnectionM anager.getManagedConnection(TxConnectionManager.ja va:301)
    at org.jboss.resource.connectionmanager.BaseConnectio nManager2.allocateConnection(BaseConnectionManager 2.java:379)
    at org.jboss.resource.connectionmanager.BaseConnectio nManager2$ConnectionManagerProxy.allocateConnectio n(BaseConnectionManager2.java:812)
    at org.jboss.resource.adapter.jdbc.WrapperDataSource. getConnection(WrapperDataSource.java:88)
    ... 9 more
    Caused by: java.sql.SQLException: I/O Error: Connection reset
    at net.sourceforge.jtds.jdbc.TdsCore.nextToken(TdsCor e.java:2277)
    at net.sourceforge.jtds.jdbc.TdsCore.login(TdsCore.ja va:599)
    at net.sourceforge.jtds.jdbc.ConnectionJDBC2.<init>(C onnectionJDBC2.java:331)
    at net.sourceforge.jtds.jdbc.ConnectionJDBC3.<init>(C onnectionJDBC3.java:50)
    at net.sourceforge.jtds.jdbc.Driver.connect(Driver.ja va:178)
    at org.jboss.resource.adapter.jdbc.local.LocalManaged ConnectionFactory.createManagedConnection(LocalMan agedConnectionFactory.java:169)
    ... 17 more
    Caused by: java.net.SocketException: Connection reset
    at java.net.SocketInputStream.read(SocketInputStream. java:168)
    at java.io.DataInputStream.readFully(DataInputStream. java:176)
    at java.io.DataInputStream.readFully(DataInputStream. java:152)
    at net.sourceforge.jtds.jdbc.SharedSocket.readPacket( SharedSocket.java:826)
    at net.sourceforge.jtds.jdbc.SharedSocket.getNetPacke t(SharedSocket.java:707)
    at net.sourceforge.jtds.jdbc.ResponseStream.getPacket (ResponseStream.java:466)
    at net.sourceforge.jtds.jdbc.ResponseStream.read(Resp onseStream.java:103)
    at net.sourceforge.jtds.jdbc.TdsCore.nextToken(TdsCor e.java:2172)
    ... 22 more

  • #2
    I don't think this is Spring related. I would guess there is something wrong in the dataSource configuration. I would have a look at the client and server logs, see if there are any clues.

    Comment


    • #3
      As it turns out there's an issue with my SQL Server 2005 instance that's causing the connection to get reset. I know this because I tried a different SQL Server instance and it works just fine.

      Thanks,

      -Jeff

      Comment


      • #4
        Ahhh pesky SQL Server . Glad you sorted it anyway!

        Comment

        Working...
        X