Closed
Description
org.springframework.batch.repeat.jms.AsynchronousTests
fails intermittently on windows with the following error:
error 11-Feb-2021 08:30:35 [main] INFO org.apache.activemq.broker.BrokerService - Apache ActiveMQ 5.15.13 (broker, ID:WIN-OUDKQ7UFSBD-53071-1613032189853-0:1) is shutdown
build 11-Feb-2021 08:30:35 [ERROR] Tests run: 2, Failures: 0, Errors: 2, Skipped: 0, Time elapsed: 2.468 s <<< FAILURE! - in org.springframework.batch.repeat.jms.AsynchronousTests
build 11-Feb-2021 08:30:35 [ERROR] testSunnyDay(org.springframework.batch.repeat.jms.AsynchronousTests) Time elapsed: 1.223 s <<< ERROR!
build 11-Feb-2021 08:30:35 org.springframework.dao.DataAccessResourceFailureException: StatementCallback; SQL [delete from T_BARS]; connection exception: closed; nested exception is java.sql.SQLNonTransientConnectionException: connection exception: closed
build 11-Feb-2021 08:30:35 at org.springframework.batch.repeat.jms.AsynchronousTests.onSetUp(AsynchronousTests.java:78)
build 11-Feb-2021 08:30:35 Caused by: java.sql.SQLNonTransientConnectionException: connection exception: closed
build 11-Feb-2021 08:30:35 at org.springframework.batch.repeat.jms.AsynchronousTests.onSetUp(AsynchronousTests.java:78)
build 11-Feb-2021 08:30:35 Caused by: org.hsqldb.HsqlException: connection exception: closed
build 11-Feb-2021 08:30:35 at org.springframework.batch.repeat.jms.AsynchronousTests.onSetUp(AsynchronousTests.java:78)
build 11-Feb-2021 08:30:35
build 11-Feb-2021 08:30:35 [ERROR] testRollback(org.springframework.batch.repeat.jms.AsynchronousTests) Time elapsed: 1.23 s <<< ERROR!
build 11-Feb-2021 08:30:35 org.springframework.dao.DataAccessResourceFailureException: StatementCallback; SQL [delete from T_BARS]; connection exception: closed; nested exception is java.sql.SQLNonTransientConnectionException: connection exception: closed
build 11-Feb-2021 08:30:35 at org.springframework.batch.repeat.jms.AsynchronousTests.onSetUp(AsynchronousTests.java:78)
build 11-Feb-2021 08:30:35 Caused by: java.sql.SQLNonTransientConnectionException: connection exception: closed
build 11-Feb-2021 08:30:35 at org.springframework.batch.repeat.jms.AsynchronousTests.onSetUp(AsynchronousTests.java:78)
build 11-Feb-2021 08:30:35 Caused by: org.hsqldb.HsqlException: connection exception: closed
build 11-Feb-2021 08:30:35 at org.springframework.batch.repeat.jms.AsynchronousTests.onSetUp(AsynchronousTests.java:78)
build 11-Feb-2021 08:30:35
build 11-Feb-2021 08:30:35 [INFO] Running org.springframework.batch.repeat.jms.SynchronousTests
When I remove this test class or add org.junit.Ignore
on it, then another test org.springframework.batch.repeat.jms.SynchronousTests
fails:
[ERROR] Errors:
[ERROR] SynchronousTests.onSetUpBeforeTransaction:92 » DataAccessResourceFailure State...
[ERROR] SynchronousTests.onSetUpBeforeTransaction:92 » DataAccessResourceFailure State...
[ERROR] SynchronousTests.testFullRollback:132->onSetUpBeforeTransaction:92 » DataAccessResourceFailure
[INFO]
[ERROR] Tests run: 1603, Failures: 0, Errors: 3, Skipped: 13
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 02:28 min
[INFO] Finished at: 2021-02-11T10:54:23-05:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.22.2:test (default-test) on project spring-batch-infrastructure: There are test failures.
[ERROR]
[ERROR] Please refer to C:\projects\spring-batch\spring-batch-infrastructure\target\surefire-reports for the individual test results.
[ERROR] Please refer to dump files (if any exist) [date].dump, [date]-jvmRun[N].dump and [date].dumpstream.
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
Here is the content of C:\projects\spring-batch\spring-batch-infrastructure\target\surefire-reports\org.springframework.batch.repeat.jms.SynchronousTests.txt
:
-------------------------------------------------------------------------------
Test set: org.springframework.batch.repeat.jms.SynchronousTests
-------------------------------------------------------------------------------
Tests run: 3, Failures: 0, Errors: 3, Skipped: 0, Time elapsed: 4.044 s <<< FAILURE! - in org.springframework.batch.repeat.jms.SynchronousTests
testFullRollback(org.springframework.batch.repeat.jms.SynchronousTests) Time elapsed: 0 s <<< ERROR!
org.springframework.dao.DataAccessResourceFailureException: StatementCallback; SQL [delete from T_BARS]; connection exception: closed; nested exception is java.sql.SQLNonTransientConnectionException: connection exception: closed
at org.springframework.batch.repeat.jms.SynchronousTests.onSetUpBeforeTransaction(SynchronousTests.java:92)
at org.springframework.batch.repeat.jms.SynchronousTests.testFullRollback(SynchronousTests.java:132)
Caused by: java.sql.SQLNonTransientConnectionException: connection exception: closed
at org.springframework.batch.repeat.jms.SynchronousTests.onSetUpBeforeTransaction(SynchronousTests.java:92)
at org.springframework.batch.repeat.jms.SynchronousTests.testFullRollback(SynchronousTests.java:132)
Caused by: org.hsqldb.HsqlException: connection exception: closed
at org.springframework.batch.repeat.jms.SynchronousTests.onSetUpBeforeTransaction(SynchronousTests.java:92)
at org.springframework.batch.repeat.jms.SynchronousTests.testFullRollback(SynchronousTests.java:132)
JpaNativeQueryProviderIntegrationTeststestPartialRollback(org.springframework.batch.repeat.jms.SynchronousTests) Time elapsed: 1.784 s <<< ERROR!
org.springframework.dao.DataAccessResourceFailureException: StatementCallback; SQL [delete from T_BARS]; connection exception: closed; nested exception is java.sql.SQLNonTransientConnectionException: connection exception: closed
at org.springframework.batch.repeat.jms.SynchronousTests.onSetUpBeforeTransaction(SynchronousTests.java:92)
Caused by: java.sql.SQLNonTransientConnectionException: connection exception: closed
at org.springframework.batch.repeat.jms.SynchronousTests.onSetUpBeforeTransaction(SynchronousTests.java:92)
Caused by: org.hsqldb.HsqlException: connection exception: closed
at org.springframework.batch.repeat.jms.SynchronousTests.onSetUpBeforeTransaction(SynchronousTests.java:92)
testCommit(org.springframework.batch.repeat.jms.SynchronousTests) Time elapsed: 2.106 s <<< ERROR!
org.springframework.dao.DataAccessResourceFailureException: StatementCallback; SQL [delete from T_BARS]; connection exception: closed; nested exception is java.sql.SQLNonTransientConnectionException: connection exception: closed
at org.springframework.batch.repeat.jms.SynchronousTests.onSetUpBeforeTransaction(SynchronousTests.java:92)
Caused by: java.sql.SQLNonTransientConnectionException: connection exception: closed
at org.springframework.batch.repeat.jms.SynchronousTests.onSetUpBeforeTransaction(SynchronousTests.java:92)
Caused by: org.hsqldb.HsqlException: connection exception: closed
at org.springframework.batch.repeat.jms.SynchronousTests.onSetUpBeforeTransaction(SynchronousTests.java:92)
These two tests share the same context defined in /org/springframework/batch/jms/jms-context.xml
and seem to be inter-dependent. The same behaviour happens with other tests sharing the same context:
org.springframework.batch.container.jms.BatchMessageListenerContainerIntegrationTests
org.springframework.batch.jms.ExternalRetryInBatchTests
org.springframework.batch.retry.jms.ExternalRetryTests
org.springframework.batch.retry.jms.SynchronousTests
org.springframework.batch.config.DatasourceTests
org.springframework.batch.config.MessagingTests