title: Could not open JDBC Connection for transaction
body: <p>I would like to report a configuration problem that seems strange to me.
  Here's the application context configuration file I'm using</p>
  
  <pre><code>  &lt;beans xmlns="http://www.springframework.org/schema/beans"
             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xmlns:context="http://www.springframework.org/schema/context" xmlns:tx="http://www.springframework.org/schema/tx"
             xsi:schemaLocation="http://www.springframework.org/schema/beans
           http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
             http://www.springframework.org/schema/context
             http://www.springframework.org/schema/context/spring-context-3.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd"&gt;
  
      &lt;context:annotation-config/&gt;
  
  &lt;bean id="propertyConfigurer"
        class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"&gt;
      &lt;property name="locations"&gt;
          &lt;list&gt;
              &lt;value&gt;classpath:jdbc.properties&lt;/value&gt;
          &lt;/list&gt;
      &lt;/property&gt;
  &lt;/bean&gt;
  
  &lt;bean id="processingStratagyContainer" class="ru.rt.mnp.translator.converter.process.ProcessingStratagyContainer"&gt;
      &lt;property name="fileProcessingStratagyMap"&gt;
          &lt;map&gt;
              &lt;entry key="Port_Increment" value-ref="portIncrementProcessingStratagy"/&gt;
              &lt;entry key="Return_Increment" value-ref="returnIncrementProcessingStratagy"/&gt;
              &lt;entry key="Port_All" value-ref="portAllProcessingStratagy"/&gt;
          &lt;/map&gt;
      &lt;/property&gt;
  &lt;/bean&gt;
  
  &lt;!--�������� ������������������ ������������������ ������������--&gt;
  &lt;bean id="portIncrementProcessingStratagy"
        class="ru.rt.mnp.translator.converter.process.PortIncrementProcessingStratagy"&gt;
      &lt;property name="rowSizeColumnPosition" value="11"/&gt;
      &lt;property name="columnBindings"&gt;
          &lt;map&gt;
              &lt;!--first has index 0--&gt;
              &lt;entry key="1" value="number[java.lang.String]"/&gt;
              &lt;entry key="5" value="old_route[java.lang.String]"/&gt;
              &lt;entry key="6" value="new_route[java.lang.String]"/&gt;
              &lt;entry key="9" value="region_code[java.lang.String]"/&gt;
              &lt;entry key="10" value="port_date[java.util.Date]{yyyy-MM-dd'T'HH:mm:ssXXX}"/&gt;
          &lt;/map&gt;
      &lt;/property&gt;
  &lt;/bean&gt;
  
  &lt;bean id="returnIncrementProcessingStratagy"
        class="ru.rt.mnp.translator.converter.process.ReturnIncrementProcessingStratagy"&gt;
      &lt;property name="rowSizeColumnPosition" value="9"/&gt;
      &lt;property name="columnBindings"&gt;
          &lt;map&gt;
              &lt;!--first has index 0--&gt;
              &lt;entry key="1" value="number[java.lang.String]"/&gt;
              &lt;entry key="5" value="old_route[java.lang.String]"/&gt;
              &lt;entry key="6" value="new_route[java.lang.String]"/&gt;
              &lt;entry key="7" value="region_code[java.lang.String]"/&gt;
              &lt;entry key="8" value="port_date[java.util.Date]{yyyy-MM-dd'T'HH:mm:ssXXX}"/&gt;
          &lt;/map&gt;
      &lt;/property&gt;
  &lt;/bean&gt;
  
  &lt;bean id="portAllProcessingStratagy"
        class="ru.rt.mnp.translator.converter.process.PortAllProcessingStratagy"&gt;
      &lt;property name="rowSizeColumnPosition" value="6"/&gt;
      &lt;property name="columnBindings"&gt;
          &lt;map&gt;
              &lt;!--first has index 0--&gt;
              &lt;entry key="0" value="number[java.lang.String]"/&gt;
              &lt;entry key="3" value="new_route[java.lang.String]"/&gt;
              &lt;entry key="4" value="region_code[java.lang.String]"/&gt;
              &lt;entry key="5" value="port_date[java.util.Date]{yyyy-MM-dd'T'HH:mm:ssXXX}"/&gt;
          &lt;/map&gt;
      &lt;/property&gt;
  &lt;/bean&gt;
  
  
  
  
  &lt;bean id="postProcessingStratagyContainer" class="ru.rt.mnp.translator.converter.postprocess.PostProcessingStratagyContainer"&gt;
      &lt;property name="postProcessingStratagableMap"&gt;
          &lt;map&gt;
              &lt;entry key="Port_Increment" value-ref="mnpTrfPartPostProcessingStratagy"/&gt;
              &lt;entry key="Return_Increment" value-ref="mnpTrfPartPostProcessingStratagy"/&gt;
              &lt;entry key="Port_All" value-ref="mnpTrfFullPostProcessingStratagy"/&gt;
              &lt;entry key="IncrementCounter" value-ref="incrementCounterPostProcessingStratagy"/&gt;
              &lt;entry key="HistoryRequestFull" value-ref="historyRequestFullPostProcessingStratagy"/&gt;
              &lt;entry key="HistoryRequestPart" value-ref="historyRequestPartPostProcessingStratagy"/&gt;
          &lt;/map&gt;
      &lt;/property&gt;
  &lt;/bean&gt;
  
  
  &lt;bean id="mnpTrfPartPostProcessingStratagy"
        class="ru.rt.mnp.translator.converter.postprocess.MnpTrfPartPostProcessingStratagy" &gt;
        &lt;property name="placeInPostProcessingChain" value="1"/&gt;
  &lt;/bean&gt;
  
  &lt;bean id="mnpTrfFullPostProcessingStratagy"
        class="ru.rt.mnp.translator.converter.postprocess.MnpTrfFullPostProcessingStratagy" &gt;
      &lt;property name="placeInPostProcessingChain" value="2"/&gt;
  &lt;/bean&gt;
  
  &lt;bean id="incrementCounterPostProcessingStratagy"
        class="ru.rt.mnp.translator.converter.postprocess.IncrementCounterPostProcessingStratagy" &gt;
      &lt;property name="placeInPostProcessingChain" value="9"/&gt;
  &lt;/bean&gt;
  
  &lt;bean id="historyRequestFullPostProcessingStratagy"
        class="ru.rt.mnp.translator.converter.postprocess.HistoryRequestFullPostProcessingStratagy" &gt;
      &lt;property name="placeInPostProcessingChain" value="4"/&gt;
  &lt;/bean&gt;
  
  &lt;bean id="historyRequestPartPostProcessingStratagy"
        class="ru.rt.mnp.translator.converter.postprocess.HistoryRequestPartPostProcessingStratagy"&gt;
      &lt;property name="placeInPostProcessingChain" value="3"/&gt;
  &lt;/bean&gt;
  
  &lt;bean id="convertTask" class="ru.rt.mnp.translator.converter.job.ConvertTask"/&gt;
  &lt;bean id="testTask" class="ru.rt.mnp.translator.converter.job.TestTask"/&gt;
  &lt;bean id="historyRequestTask" class="ru.rt.mnp.translator.converter.job.HistoryRequestTask"/&gt;
  
  **&lt;bean id="dataSource" class="org.springframework.jdbc.datasource.SingleConnectionDataSource"&gt;
      &lt;property name="driverClassName" value="org.postgresql.Driver"/&gt;
      &lt;property name="url" value="${url}"/&gt;
      &lt;property name="username" value="****"/&gt;
      &lt;property name="password" value="****"/&gt;
  &lt;/bean&gt;**
  
  &lt;tx:annotation-driven transaction-manager="transactionManager"/&gt;
  &lt;bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager"&gt;
      &lt;property name="dataSource" ref="dataSource"/&gt;
  &lt;/bean&gt;
  
  &lt;bean id="mnpHistoryDao" class="ru.rt.mnp.translator.converter.storage.MnpHistoryDao"&gt;
      &lt;property name="jdbcTemplate" ref="jdbcTemplate"/&gt;
  &lt;/bean&gt;
  
  &lt;bean id="jdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate"&gt;
      &lt;constructor-arg name="dataSource" ref="dataSource"/&gt;
  &lt;/bean&gt;
  
  &lt;!-- specifing class and method that is going to be called on a specified
   time basis --&gt;
  &lt;bean id="convertJob"
        class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean"&gt;
      &lt;property name="targetObject" ref="convertTask"/&gt;
      &lt;property name="targetMethod" value="execute"/&gt;
  &lt;/bean&gt;
  
  &lt;bean id="convertTestJob"
        class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean"&gt;
      &lt;property name="targetObject" ref="testTask"/&gt;
      &lt;property name="targetMethod" value="execute"/&gt;
  &lt;/bean&gt;
  
  &lt;bean id="historyRequestJob"
        class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean"&gt;
      &lt;property name="targetObject" ref="historyRequestTask"/&gt;
      &lt;property name="targetMethod" value="execute"/&gt;
  &lt;/bean&gt;
  
  &lt;!-- simple trigger specify repeat interval and delay time --&gt;
  &lt;bean id="cronTrigger"
        class="org.springframework.scheduling.quartz.CronTriggerFactoryBean"&gt;
      &lt;property name="jobDetail" ref="convertJob"/&gt;
      &lt;!--&lt;property name="cronExpression" value="0 5 0,2,4,6,8,10,12,14,16,18,20,22 ? * *"/&gt;--&gt;
      &lt;property name="cronExpression" value="0 15,45 * ? * *"/&gt;
      &lt;property name="startDelay" value="1000"/&gt;
  &lt;/bean&gt;
  
  
  &lt;bean id="cronTestTrigger"
        class="org.springframework.scheduling.quartz.CronTriggerFactoryBean"&gt;
      &lt;property name="jobDetail" ref="convertTestJob"/&gt;
      &lt;property name="cronExpression" value="0 0/10 * ? * *"/&gt;
      &lt;property name="startDelay" value="1000"/&gt;
  &lt;/bean&gt;
  
  &lt;bean id="cronHistoryRequestTrigger"
        class="org.springframework.scheduling.quartz.CronTriggerFactoryBean"&gt;
      &lt;property name="jobDetail" ref="historyRequestJob"/&gt;
      &lt;property name="cronExpression" value="0/10 * * ? * *"/&gt;
      &lt;property name="startDelay" value="1000"/&gt;
  &lt;/bean&gt;
  
  &lt;!-- scheduler factory bean to bind,the executing code and time intervals
   together --&gt;
  &lt;bean class="org.springframework.scheduling.quartz.SchedulerFactoryBean"&gt;
      &lt;property name="configLocation" value="classpath:quartz.properties"/&gt;
      &lt;property name="jobDetails"&gt;
          &lt;list&gt;
              &lt;ref bean="convertJob"/&gt;
              &lt;ref bean="convertTestJob"/&gt;
              &lt;ref bean="historyRequestJob"/&gt;
          &lt;/list&gt;
      &lt;/property&gt;
      &lt;property name="triggers"&gt;
          &lt;list&gt;
              &lt;ref bean="cronTrigger"/&gt;
              &lt;ref bean="cronTestTrigger"/&gt;
              &lt;ref bean="cronHistoryRequestTrigger"/&gt;
          &lt;/list&gt;
      &lt;/property&gt;
  &lt;/bean&gt;
  </code></pre>
  
  <p></p>
  
  <p>But when run the converting action, i have this error:</p>
  
  <blockquote>
    <p>Problems with processing file /***.zip
    org.springframework.transaction.CannotCreateTransactionException:
    Could not open JDBC Connection for transaction; nested exception is
    java.sql.SQLException: Connection was closed in
    SingleConnectionDataSource. Check that user code checks shouldClose()
    before closing Connections, or set 'suppressClose' to 'true'
            at org.springframework.jdbc.datasource.DataSourceTransactionManager.doBegin(DataSourceTransactionManager.java:241)
            at org.springframework.transaction.support.AbstractPlatformTransactionManager.getTransaction(AbstractPlatformTransactionManager.java:372)
            at org.springframework.transaction.interceptor.TransactionAspectSupport.createTransactionIfNecessary(TransactionAspectSupport.java:417)
            at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:255)
            at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:94)
            at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
            at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
            at com.sun.proxy.$Proxy5.processFile(Unknown Source)
            at ru.rt.mnp.translator.converter.job.ConvertTask.execute(ConvertTask.java:69)
            at sun.reflect.GeneratedMethodAccessor12.invoke(Unknown Source)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
            at java.lang.reflect.Method.invoke(Method.java:497)
            at org.springframework.util.MethodInvoker.invoke(MethodInvoker.java:273)
            at org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean$MethodInvokingJob.executeInternal(MethodInvokingJobDetailFactoryBean.java:311)
            at org.springframework.scheduling.quartz.QuartzJobBean.execute(QuartzJobBean.java:113)
            at org.quartz.core.JobRunShell.run(JobRunShell.java:207)
            at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:560)
    Caused by: java.sql.SQLException: Connection was closed in
    SingleConnectionDataSource. Check that user code checks shouldClose()
    before closing Connections, or set 'suppressClose' to 'true'
            at org.springframework.jdbc.datasource.SingleConnectionDataSource.getConnection(SingleConnectionDataSource.java:189)
            at org.springframework.jdbc.datasource.DataSourceTransactionManager.doBegin(DataSourceTransactionManager.java:203)</p>
  </blockquote>
  
  <p>Can anyone explain me what is the problem ?
  What should i do to fix this?</p>
  
  <p>Thank you!</p>