org.springframework.transaction.CannotCreateTransactionException: Could not open JDBC Connection for transaction; nested exception is java.lang.IllegalArgumentException: Connection must not be null

Spring JIRA | ismail altuntas | 3 years ago
  1. 0

    I have a custom Datasource implementation that not throw any exception when there is no DB connection. I am using this Datasource implementation with JdbcTemplate.java utility and when there is no connection JdbcTemplate throwing a NullPointerExeption. see the stack trace: {code} java.lang.NullPointerException at org.springframework.jdbc.core.JdbcTemplate$SimplePreparedStatementCreator.createPreparedStatement(JdbcTemplate.java:1375) at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:580) at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:636) at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:665) at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:685) at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:693) {code} I think DataSourceUtils.getConnection() method should check the connection if it is null and then throw CannotGetJdbcConnectionException exception. So that appplication should check a meaningfull exception to take an action in this case. Similarly to above case when a transactional operation exist following exception is occured. In this case also CannotGetJdbcConnectionException should be occured ; {code} org.springframework.transaction.CannotCreateTransactionException: Could not open JDBC Connection for transaction; nested exception is java.lang.IllegalArgumentException: Connection must not be null at org.springframework.jdbc.datasource.DataSourceTransactionManager.doBegin(DataSourceTransactionManager.java:240) at org.springframework.transaction.support.AbstractPlatformTransactionManager.getTransaction(AbstractPlatformTransactionManager.java:371) at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:127) {code} Thanks

    Spring JIRA | 3 years ago | ismail altuntas
    org.springframework.transaction.CannotCreateTransactionException: Could not open JDBC Connection for transaction; nested exception is java.lang.IllegalArgumentException: Connection must not be null
  2. 0

    I have a custom Datasource implementation that not throw any exception when there is no DB connection. I am using this Datasource implementation with JdbcTemplate.java utility and when there is no connection JdbcTemplate throwing a NullPointerExeption. see the stack trace: {code} java.lang.NullPointerException at org.springframework.jdbc.core.JdbcTemplate$SimplePreparedStatementCreator.createPreparedStatement(JdbcTemplate.java:1375) at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:580) at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:636) at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:665) at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:685) at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:693) {code} I think DataSourceUtils.getConnection() method should check the connection if it is null and then throw CannotGetJdbcConnectionException exception. So that appplication should check a meaningfull exception to take an action in this case. Similarly to above case when a transactional operation exist following exception is occured. In this case also CannotGetJdbcConnectionException should be occured ; {code} org.springframework.transaction.CannotCreateTransactionException: Could not open JDBC Connection for transaction; nested exception is java.lang.IllegalArgumentException: Connection must not be null at org.springframework.jdbc.datasource.DataSourceTransactionManager.doBegin(DataSourceTransactionManager.java:240) at org.springframework.transaction.support.AbstractPlatformTransactionManager.getTransaction(AbstractPlatformTransactionManager.java:371) at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:127) {code} Thanks

    Spring JIRA | 3 years ago | ismail altuntas
    org.springframework.transaction.CannotCreateTransactionException: Could not open JDBC Connection for transaction; nested exception is java.lang.IllegalArgumentException: Connection must not be null
  3. 0

    Connecting to mysql database | Activiti Forums

    activiti.org | 1 year ago
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'demoDataGenerator' defined in ServletContext resource [/WEB-INF/activiti-standalone-context.xml]: Cannot resolve reference to bean 'processEngine' while setting bean property 'processEngine'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'processEngine': FactoryBean threw exception on object creation; nested exception is org.springframework.transaction.CannotCreateTransactionException: Could not open JDBC Connection for transaction; nested exception is org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (null, message from server: "Host 'INDIC5Z8T7.in.int.atosorigin.com' is not allowed to connect to this MySQL server")
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    Unsupported operation READ_COMMITTED/SERIALIZABLE

    Stack Overflow | 1 year ago | user5412028
    org.springframework.transaction.CannotCreateTransactionException: Could not open JDBC Connection for transaction; nested exception is java.sql.SQLException: JDBC-590722:Unsupported operation. Supports READ_COMMITTED/SERIALIZABLE.
  6. 0

    Caused by: org.postgresql.util.PSQLException: FATAL: password authentication failed for user "admin"

    Stack Overflow | 5 months ago | Sarronya
    org.springframework.transaction.CannotCreateTransactionException: Could not open JDBC Connection for transaction; nested exception is org.postgresql.util.PSQLException: FATAL: password authentication failed for user "admin"

  1. kkandda 3 times, last 6 months ago
2 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. org.springframework.transaction.CannotCreateTransactionException

    Could not open JDBC Connection for transaction; nested exception is java.lang.IllegalArgumentException: Connection must not be null

    at org.springframework.jdbc.datasource.DataSourceTransactionManager.doBegin()
  2. Spring Framework
    DataSourceTransactionManager.doBegin
    1. org.springframework.jdbc.datasource.DataSourceTransactionManager.doBegin(DataSourceTransactionManager.java:240)
    1 frame
  3. Spring Tx
    TransactionTemplate.execute
    1. org.springframework.transaction.support.AbstractPlatformTransactionManager.getTransaction(AbstractPlatformTransactionManager.java:371)
    2. org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:127)
    2 frames