com.microsoft.sqlserver.jdbc.SQLServerException: The connection is closed.

Spring JIRA | Andrei Tuzhilin | 5 years ago
  1. 0

    Spring configuration: {code:xml} <bean id="txDbo" class="org.springframework.jdbc.datasource.DataSourceTransactionManager"> <property name="dataSource" ref="dboDataSource"/> </bean> <bean id="txMain" class="org.springframework.jdbc.datasource.DataSourceTransactionManager"> <property name="dataSource" ref="mainDataSource"/> </bean> <bean id="txChained" class="org.springframework.data.neo4j.transaction.ChainedTransactionManager"> <constructor-arg> <util:list> <ref bean="txDbo"/> <ref bean="txMain"/> </util:list> </constructor-arg> </bean> <int-jdbc:inbound-channel-adapter data-source="dboDataSource" channel="inboundDboListChannel" update="#{@sql['DBO_SET_TRANSIT']}" update-per-row="true" query="#{@sql['DBO_GET_MESSAGES']}" max-rows-per-poll="1000" row-mapper="dboRowMapper" > <int:poller fixed-delay="500"> <int:transactional transaction-manager="txChained"/> </int:poller> </int-jdbc:inbound-channel-adapter> {code} After DBO connection crash (closed due to network issues) I get an error every time executor uses the crashed thread (other threads perform fine): {noformat} [#2012-01-30 18:09:58,619|ERROR|task-scheduler-3|o.s.i.h.LoggingHandler --: |org.springframework.jdbc.UncategorizedSQLException: StatementCallback; uncategorized SQLException for SQL [ select MessageID, Number, source_number , Message, Priority, DocID from MessagesToSend order by MessageID ]; SQL state [null]; error code [0]; The connection is closed.; nested exception is com.microsoft.sqlserver.jdbc.SQLServerException: The connection is closed. at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:83) at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:80) at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:80) at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:407) at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:456) at org.springframework.integration.jdbc.JdbcPollingChannelAdapter.doPoll(JdbcPollingChannelAdapter.java:200) at org.springframework.integration.jdbc.JdbcPollingChannelAdapter.poll(JdbcPollingChannelAdapter.java:148) at org.springframework.integration.jdbc.JdbcPollingChannelAdapter.receive(JdbcPollingChannelAdapter.java:135) at org.springframework.integration.endpoint.SourcePollingChannelAdapter.doPoll(SourcePollingChannelAdapter.java:89) at org.springframework.integration.endpoint.AbstractPollingEndpoint$1.call(AbstractPollingEndpoint.java:146) at org.springframework.integration.endpoint.AbstractPollingEndpoint$1.call(AbstractPollingEndpoint.java:144) at sun.reflect.GeneratedMethodAccessor177.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:318) at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150) at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:110) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202) at $Proxy111.call(Unknown Source) at org.springframework.integration.endpoint.AbstractPollingEndpoint$Poller$1.run(AbstractPollingEndpoint.java:207) at org.springframework.integration.util.ErrorHandlingTaskExecutor$1.run(ErrorHandlingTaskExecutor.java:52) at org.springframework.core.task.SyncTaskExecutor.execute(SyncTaskExecutor.java:48) at org.springframework.integration.util.ErrorHandlingTaskExecutor.execute(ErrorHandlingTaskExecutor.java:49) at org.springframework.integration.endpoint.AbstractPollingEndpoint$Poller.run(AbstractPollingEndpoint.java:202) at org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErrorHandlingRunnable.java:53) at org.springframework.scheduling.concurrent.ReschedulingRunnable.run(ReschedulingRunnable.java:81) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) at java.util.concurrent.FutureTask.run(FutureTask.java:138) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:98) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:206) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) at java.lang.Thread.run(Thread.java:662) Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: The connection is closed. at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDriverError(SQLServerException.java:171) at com.microsoft.sqlserver.jdbc.SQLServerConnection.checkClosed(SQLServerConnection.java:319) at com.microsoft.sqlserver.jdbc.SQLServerConnection.createStatement(SQLServerConnection.java:1829) at com.microsoft.sqlserver.jdbc.SQLServerConnection.createStatement(SQLServerConnection.java:1542) at org.apache.tomcat.dbcp.dbcp.DelegatingConnection.createStatement(DelegatingConnection.java:257) at org.apache.tomcat.dbcp.dbcp.PoolingDataSource$PoolGuardConnectionWrapper.createStatement(PoolingDataSource.java:216) at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:390) ... 32 more #] {noformat}

    Spring JIRA | 5 years ago | Andrei Tuzhilin
    com.microsoft.sqlserver.jdbc.SQLServerException: The connection is closed.
  2. 0

    Spring configuration: {code:xml} <bean id="txDbo" class="org.springframework.jdbc.datasource.DataSourceTransactionManager"> <property name="dataSource" ref="dboDataSource"/> </bean> <bean id="txMain" class="org.springframework.jdbc.datasource.DataSourceTransactionManager"> <property name="dataSource" ref="mainDataSource"/> </bean> <bean id="txChained" class="org.springframework.data.neo4j.transaction.ChainedTransactionManager"> <constructor-arg> <util:list> <ref bean="txDbo"/> <ref bean="txMain"/> </util:list> </constructor-arg> </bean> <int-jdbc:inbound-channel-adapter data-source="dboDataSource" channel="inboundDboListChannel" update="#{@sql['DBO_SET_TRANSIT']}" update-per-row="true" query="#{@sql['DBO_GET_MESSAGES']}" max-rows-per-poll="1000" row-mapper="dboRowMapper" > <int:poller fixed-delay="500"> <int:transactional transaction-manager="txChained"/> </int:poller> </int-jdbc:inbound-channel-adapter> {code} After DBO connection crash (closed due to network issues) I get an error every time executor uses the crashed thread (other threads perform fine): {noformat} [#2012-01-30 18:09:58,619|ERROR|task-scheduler-3|o.s.i.h.LoggingHandler --: |org.springframework.jdbc.UncategorizedSQLException: StatementCallback; uncategorized SQLException for SQL [ select MessageID, Number, source_number , Message, Priority, DocID from MessagesToSend order by MessageID ]; SQL state [null]; error code [0]; The connection is closed.; nested exception is com.microsoft.sqlserver.jdbc.SQLServerException: The connection is closed. at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:83) at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:80) at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:80) at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:407) at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:456) at org.springframework.integration.jdbc.JdbcPollingChannelAdapter.doPoll(JdbcPollingChannelAdapter.java:200) at org.springframework.integration.jdbc.JdbcPollingChannelAdapter.poll(JdbcPollingChannelAdapter.java:148) at org.springframework.integration.jdbc.JdbcPollingChannelAdapter.receive(JdbcPollingChannelAdapter.java:135) at org.springframework.integration.endpoint.SourcePollingChannelAdapter.doPoll(SourcePollingChannelAdapter.java:89) at org.springframework.integration.endpoint.AbstractPollingEndpoint$1.call(AbstractPollingEndpoint.java:146) at org.springframework.integration.endpoint.AbstractPollingEndpoint$1.call(AbstractPollingEndpoint.java:144) at sun.reflect.GeneratedMethodAccessor177.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:318) at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150) at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:110) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202) at $Proxy111.call(Unknown Source) at org.springframework.integration.endpoint.AbstractPollingEndpoint$Poller$1.run(AbstractPollingEndpoint.java:207) at org.springframework.integration.util.ErrorHandlingTaskExecutor$1.run(ErrorHandlingTaskExecutor.java:52) at org.springframework.core.task.SyncTaskExecutor.execute(SyncTaskExecutor.java:48) at org.springframework.integration.util.ErrorHandlingTaskExecutor.execute(ErrorHandlingTaskExecutor.java:49) at org.springframework.integration.endpoint.AbstractPollingEndpoint$Poller.run(AbstractPollingEndpoint.java:202) at org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErrorHandlingRunnable.java:53) at org.springframework.scheduling.concurrent.ReschedulingRunnable.run(ReschedulingRunnable.java:81) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) at java.util.concurrent.FutureTask.run(FutureTask.java:138) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:98) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:206) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) at java.lang.Thread.run(Thread.java:662) Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: The connection is closed. at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDriverError(SQLServerException.java:171) at com.microsoft.sqlserver.jdbc.SQLServerConnection.checkClosed(SQLServerConnection.java:319) at com.microsoft.sqlserver.jdbc.SQLServerConnection.createStatement(SQLServerConnection.java:1829) at com.microsoft.sqlserver.jdbc.SQLServerConnection.createStatement(SQLServerConnection.java:1542) at org.apache.tomcat.dbcp.dbcp.DelegatingConnection.createStatement(DelegatingConnection.java:257) at org.apache.tomcat.dbcp.dbcp.PoolingDataSource$PoolGuardConnectionWrapper.createStatement(PoolingDataSource.java:216) at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:390) ... 32 more #] {noformat}

    Spring JIRA | 5 years ago | Andrei Tuzhilin
    com.microsoft.sqlserver.jdbc.SQLServerException: The connection is closed.
  3. 0

    [LPS-13536] Issue while using DMS. JDBC Connect Reset. - Liferay Issues

    liferay.com | 1 year ago
    com.liferay.portal.kernel.job.JobExecutionException: com.microsoft.sqlserver.jdbc.SQLServerException: The connection is closed.
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    MS SQL Server - can't auto reconnect if db connection lost - Forums | Liferay

    liferay.com | 1 year ago
    com.liferay.portal.kernel.job.JobExecutionException: com.microsoft.sqlserver.jdbc.SQLServerException: The connection is closed.
  6. 0

    MS SQL Server - can't auto reconnect if db connection lost - Forums | Liferay

    liferay.com | 12 months ago
    com.liferay.portal.kernel.job.JobExecutionException: com.microsoft.sqlserver.jdbc.SQLServerException: The connection is closed.

  1. Andreas Häber 594 times, last 1 month ago
1 unregistered visitors
Not finding the right solution?
Take a tour to get the most out of Samebug.

Tired of useless tips?

Automated exception search integrated into your IDE

Root Cause Analysis

  1. com.microsoft.sqlserver.jdbc.SQLServerException

    The connection is closed.

    at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDriverError()
  2. com.microsoft.sqlserver
    SQLServerConnection.createStatement
    1. com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDriverError(SQLServerException.java:171)
    2. com.microsoft.sqlserver.jdbc.SQLServerConnection.checkClosed(SQLServerConnection.java:319)
    3. com.microsoft.sqlserver.jdbc.SQLServerConnection.createStatement(SQLServerConnection.java:1829)
    4. com.microsoft.sqlserver.jdbc.SQLServerConnection.createStatement(SQLServerConnection.java:1542)
    4 frames
  3. org.apache.tomcat
    PoolingDataSource$PoolGuardConnectionWrapper.createStatement
    1. org.apache.tomcat.dbcp.dbcp.DelegatingConnection.createStatement(DelegatingConnection.java:257)
    2. org.apache.tomcat.dbcp.dbcp.PoolingDataSource$PoolGuardConnectionWrapper.createStatement(PoolingDataSource.java:216)
    2 frames
  4. Spring Framework
    JdbcTemplate.query
    1. org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:390)
    2. org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:456)
    2 frames
  5. org.springframework.integration
    JdbcPollingChannelAdapter.receive
    1. org.springframework.integration.jdbc.JdbcPollingChannelAdapter.doPoll(JdbcPollingChannelAdapter.java:200)
    2. org.springframework.integration.jdbc.JdbcPollingChannelAdapter.poll(JdbcPollingChannelAdapter.java:148)
    3. org.springframework.integration.jdbc.JdbcPollingChannelAdapter.receive(JdbcPollingChannelAdapter.java:135)
    3 frames
  6. Spring Integration Core
    AbstractPollingEndpoint$1.call
    1. org.springframework.integration.endpoint.SourcePollingChannelAdapter.doPoll(SourcePollingChannelAdapter.java:89)
    2. org.springframework.integration.endpoint.AbstractPollingEndpoint$1.call(AbstractPollingEndpoint.java:146)
    3. org.springframework.integration.endpoint.AbstractPollingEndpoint$1.call(AbstractPollingEndpoint.java:144)
    3 frames
  7. Java RT
    Method.invoke
    1. sun.reflect.GeneratedMethodAccessor177.invoke(Unknown Source)
    2. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    3. java.lang.reflect.Method.invoke(Method.java:597)
    3 frames
  8. Spring AOP
    ReflectiveMethodInvocation.proceed
    1. org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:318)
    2. org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
    3. org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
    3 frames
  9. Spring Tx
    TransactionInterceptor.invoke
    1. org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:110)
    1 frame
  10. Spring AOP
    JdkDynamicAopProxy.invoke
    1. org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
    2. org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
    2 frames
  11. Unknown
    $Proxy111.call
    1. $Proxy111.call(Unknown Source)
    1 frame
  12. Spring Integration Core
    ErrorHandlingTaskExecutor$1.run
    1. org.springframework.integration.endpoint.AbstractPollingEndpoint$Poller$1.run(AbstractPollingEndpoint.java:207)
    2. org.springframework.integration.util.ErrorHandlingTaskExecutor$1.run(ErrorHandlingTaskExecutor.java:52)
    2 frames
  13. Spring Core
    SyncTaskExecutor.execute
    1. org.springframework.core.task.SyncTaskExecutor.execute(SyncTaskExecutor.java:48)
    1 frame
  14. Spring Integration Core
    AbstractPollingEndpoint$Poller.run
    1. org.springframework.integration.util.ErrorHandlingTaskExecutor.execute(ErrorHandlingTaskExecutor.java:49)
    2. org.springframework.integration.endpoint.AbstractPollingEndpoint$Poller.run(AbstractPollingEndpoint.java:202)
    2 frames
  15. Spring Context
    ReschedulingRunnable.run
    1. org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErrorHandlingRunnable.java:53)
    2. org.springframework.scheduling.concurrent.ReschedulingRunnable.run(ReschedulingRunnable.java:81)
    2 frames
  16. Java RT
    Thread.run
    1. java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
    2. java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
    3. java.util.concurrent.FutureTask.run(FutureTask.java:138)
    4. java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:98)
    5. java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:206)
    6. java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
    7. java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
    8. java.lang.Thread.run(Thread.java:662)
    8 frames