Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Error - java.sql.exception: HikariDataSource has been closed in JobExecutionListenerSupport #4618

Unanswered
lovinjv asked this question in Q&A
Discussion options

I have an spring batch application which is recently been migrated to springboot v3 , spring batch v5 and jdk 17 . The application works fine but I am facing an issue related to Hikari pool connection whenever some Testcases are executed . We have a db update operation in afterJob method of JonExecutionListener and the Hikari error is coming when the db operation is executed in afterJob.
Error we are getting :
org.springframework.jdbc.CannotGetJDBCConnectionException:Failed to obtain JDBC connection .,
caused by : HikariDatasource HikariDatasource(HikariPool-3) has been closed.

I can see some warning as well -
Hikari pool -1 Connection oracle.jdbc.driver.T4CConnection@663dd728 markes as broken because of SQLSTATE(08006), ErrorCode (17002)

Testclasses are written as 👍

@ExtendWith(SpringExtension.class)
@SpringBootTest
@activeprofiles("junit")
public class TestClassA
{
@Autowired
private BatchJobRunner batchRunner;

@test
private void testMethod(){
batchRunner.runJob();

}
}
}

You must be logged in to vote

Replies: 1 comment

Comment options

This happens when the job is executed in a different thread. Is the taskExecutor of the job launcher asynchronous? This should not happen with the default SyncTaskExecutor.

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
status: waiting-for-reporter Issues for which we are waiting for feedback from the reporter

AltStyle によって変換されたページ (->オリジナル) /