Description:
After upgrade to 8.0.20 and using JHipster (Spring boot+JPA) to store a LocalDate, an exception is thrown.
There is no problem with 8.0.19 (except the "one day bug" that this version (8.0.20) should have fixed I think)
This is after the introduction of new fields is the Connector/J code such as: 'cacheDefaultTimezone' (ServerPreparedQueryBindValue class)
--------- --------- --------- THE STACKTRACE --------- --------- ---------
liquibase.exception.MigrationFailedException: Migration failed for change set config/liquibase/changelog/20200527204525_added_entity_Foo.xml::20200527204525-1-data::jhipster:
Reason: liquibase.exception.DatabaseException: java.sql.BatchUpdateException: java.lang.NullPointerException
at liquibase.changelog.ChangeSet.execute(ChangeSet.java:646)
at liquibase.changelog.visitor.UpdateVisitor.visit(UpdateVisitor.java:53)
at liquibase.changelog.ChangeLogIterator.run(ChangeLogIterator.java:83)
at liquibase.Liquibase.update(Liquibase.java:202)
at liquibase.Liquibase.update(Liquibase.java:179)
at liquibase.integration.spring.SpringLiquibase.performUpdate(SpringLiquibase.java:366)
at liquibase.integration.spring.SpringLiquibase.afterPropertiesSet(SpringLiquibase.java:314)
at org.springframework.boot.autoconfigure.liquibase.DataSourceClosingSpringLiquibase.afterPropertiesSet(DataSourceClosingSpringLiquibase.java:46)
at io.github.jhipster.config.liquibase.AsyncSpringLiquibase.initDb(AsyncSpringLiquibase.java:118)
at io.github.jhipster.config.liquibase.AsyncSpringLiquibase.lambda$afterPropertiesSet$0(AsyncSpringLiquibase.java:93)
at io.github.jhipster.async.ExceptionHandlingAsyncTaskExecutor.lambda$createWrappedRunnable$1(ExceptionHandlingAsyncTaskExecutor.java:78)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: liquibase.exception.DatabaseException: java.sql.BatchUpdateException: java.lang.NullPointerException
at liquibase.statement.ExecutablePreparedStatementBase.execute(ExecutablePreparedStatementBase.java:87)
at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:117)
at liquibase.database.AbstractJdbcDatabase.execute(AbstractJdbcDatabase.java:1276)
at liquibase.database.AbstractJdbcDatabase.executeStatements(AbstractJdbcDatabase.java:1258)
at liquibase.changelog.ChangeSet.execute(ChangeSet.java:609)
... 13 common frames omitted
Caused by: java.sql.BatchUpdateException: java.lang.NullPointerException
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
at com.mysql.cj.util.Util.handleNewInstance(Util.java:192)
at com.mysql.cj.util.Util.getInstance(Util.java:167)
at com.mysql.cj.util.Util.getInstance(Util.java:174)
at com.mysql.cj.jdbc.exceptions.SQLError.createBatchUpdateException(SQLError.java:224)
at com.mysql.cj.jdbc.ServerPreparedStatement.executeBatchSerially(ServerPreparedStatement.java:385)
at com.mysql.cj.jdbc.ClientPreparedStatement.executeBatchInternal(ClientPreparedStatement.java:435)
at com.mysql.cj.jdbc.StatementImpl.executeBatch(StatementImpl.java:796)
at com.zaxxer.hikari.pool.ProxyStatement.executeBatch(ProxyStatement.java:128)
at com.zaxxer.hikari.pool.HikariProxyPreparedStatement.executeBatch(HikariProxyPreparedStatement.java)
at liquibase.statement.BatchDmlExecutablePreparedStatement.executePreparedStatement(BatchDmlExecutablePreparedStatement.java:65)
at liquibase.statement.ExecutablePreparedStatementBase.execute(ExecutablePreparedStatementBase.java:85)
... 17 common frames omitted
Caused by: java.sql.SQLException: java.lang.NullPointerException
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:129)
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:97)
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:89)
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:63)
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:73)
at com.mysql.cj.jdbc.ServerPreparedStatement.executeInternal(ServerPreparedStatement.java:441)
at com.mysql.cj.jdbc.ClientPreparedStatement.executeUpdateInternal(ClientPreparedStatement.java:1092)
at com.mysql.cj.jdbc.ClientPreparedStatement.executeUpdateInternal(ClientPreparedStatement.java:1040)
at com.mysql.cj.jdbc.ServerPreparedStatement.executeBatchSerially(ServerPreparedStatement.java:357)
... 23 common frames omitted
Caused by: java.lang.NullPointerException: null
at com.mysql.cj.ServerPreparedQueryBindValue.storeDate(ServerPreparedQueryBindValue.java:287)
at com.mysql.cj.ServerPreparedQueryBindValue.storeBinding(ServerPreparedQueryBindValue.java:239)
at com.mysql.cj.ServerPreparedQuery.prepareExecutePacket(ServerPreparedQuery.java:301)
at com.mysql.cj.ServerPreparedQuery.serverExecute(ServerPreparedQuery.java:206)
at com.mysql.cj.jdbc.ServerPreparedStatement.serverExecute(ServerPreparedStatement.java:635)
at com.mysql.cj.jdbc.ServerPreparedStatement.executeInternal(ServerPreparedStatement.java:418)
... 26 common frames omitted
How to repeat:
- git clone https://github.com/ctamisier/myjhipster
- create a MySQL database named 'myjhipster'
- ./mvnw -Dspring-boot.run.arguments="--spring.datasource.password=<replace-with-your-mysql-root-password>"
And then check the logs.
Suggested fix:
I've investigated a bit and I put a comment here:
https://github.com/mysql/mysql-connector-j/commit/c1e9c7d1f3ff5b31ca6a2744707ae4dd7840cf3c...
[29 May 2020 8:33]
Alexander Soklakov
Thanks Clément!
[2 Jun 2020 6:27]
Thomas Heigl
I'm seeing this as well. Can confirm that is works with 8.0.19.
[17 Jun 2020 11:23]
Silvio Molinari
Is this being prioritised for 8.0.21? This is a very serious bug which will affect a large number of applications, especially now this version is pulled in automatically by spring boot 2.2.7, unless a particular version is specified.
Posted by developer:
Added the following entry to the C/J 8.0.22 changlelog:
"Using a PreparedStatement to store a Date into the database sometimes resulted in a NullPointerException. It was because some assignments were missing in ServerPreparedQueryBindValue.clone(), and this patch corrected the issue."
Page generated in 0.062 sec. using MySQL 8.4.7-u6-cloud
Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the
respective copyright holders. It is not reviewed in advance
by Oracle and does not necessarily represent the opinion of
Oracle or any other party.
Description: After upgrade to 8.0.20 and using JHipster (Spring boot+JPA) to store a LocalDate, an exception is thrown. There is no problem with 8.0.19 (except the "one day bug" that this version (8.0.20) should have fixed I think) This is after the introduction of new fields is the Connector/J code such as: 'cacheDefaultTimezone' (ServerPreparedQueryBindValue class) --------- --------- --------- THE STACKTRACE --------- --------- --------- liquibase.exception.MigrationFailedException: Migration failed for change set config/liquibase/changelog/20200527204525_added_entity_Foo.xml::20200527204525-1-data::jhipster: Reason: liquibase.exception.DatabaseException: java.sql.BatchUpdateException: java.lang.NullPointerException at liquibase.changelog.ChangeSet.execute(ChangeSet.java:646) at liquibase.changelog.visitor.UpdateVisitor.visit(UpdateVisitor.java:53) at liquibase.changelog.ChangeLogIterator.run(ChangeLogIterator.java:83) at liquibase.Liquibase.update(Liquibase.java:202) at liquibase.Liquibase.update(Liquibase.java:179) at liquibase.integration.spring.SpringLiquibase.performUpdate(SpringLiquibase.java:366) at liquibase.integration.spring.SpringLiquibase.afterPropertiesSet(SpringLiquibase.java:314) at org.springframework.boot.autoconfigure.liquibase.DataSourceClosingSpringLiquibase.afterPropertiesSet(DataSourceClosingSpringLiquibase.java:46) at io.github.jhipster.config.liquibase.AsyncSpringLiquibase.initDb(AsyncSpringLiquibase.java:118) at io.github.jhipster.config.liquibase.AsyncSpringLiquibase.lambda$afterPropertiesSet$0(AsyncSpringLiquibase.java:93) at io.github.jhipster.async.ExceptionHandlingAsyncTaskExecutor.lambda$createWrappedRunnable$1(ExceptionHandlingAsyncTaskExecutor.java:78) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) at java.base/java.lang.Thread.run(Thread.java:834) Caused by: liquibase.exception.DatabaseException: java.sql.BatchUpdateException: java.lang.NullPointerException at liquibase.statement.ExecutablePreparedStatementBase.execute(ExecutablePreparedStatementBase.java:87) at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:117) at liquibase.database.AbstractJdbcDatabase.execute(AbstractJdbcDatabase.java:1276) at liquibase.database.AbstractJdbcDatabase.executeStatements(AbstractJdbcDatabase.java:1258) at liquibase.changelog.ChangeSet.execute(ChangeSet.java:609) ... 13 common frames omitted Caused by: java.sql.BatchUpdateException: java.lang.NullPointerException at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490) at com.mysql.cj.util.Util.handleNewInstance(Util.java:192) at com.mysql.cj.util.Util.getInstance(Util.java:167) at com.mysql.cj.util.Util.getInstance(Util.java:174) at com.mysql.cj.jdbc.exceptions.SQLError.createBatchUpdateException(SQLError.java:224) at com.mysql.cj.jdbc.ServerPreparedStatement.executeBatchSerially(ServerPreparedStatement.java:385) at com.mysql.cj.jdbc.ClientPreparedStatement.executeBatchInternal(ClientPreparedStatement.java:435) at com.mysql.cj.jdbc.StatementImpl.executeBatch(StatementImpl.java:796) at com.zaxxer.hikari.pool.ProxyStatement.executeBatch(ProxyStatement.java:128) at com.zaxxer.hikari.pool.HikariProxyPreparedStatement.executeBatch(HikariProxyPreparedStatement.java) at liquibase.statement.BatchDmlExecutablePreparedStatement.executePreparedStatement(BatchDmlExecutablePreparedStatement.java:65) at liquibase.statement.ExecutablePreparedStatementBase.execute(ExecutablePreparedStatementBase.java:85) ... 17 common frames omitted Caused by: java.sql.SQLException: java.lang.NullPointerException at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:129) at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:97) at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:89) at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:63) at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:73) at com.mysql.cj.jdbc.ServerPreparedStatement.executeInternal(ServerPreparedStatement.java:441) at com.mysql.cj.jdbc.ClientPreparedStatement.executeUpdateInternal(ClientPreparedStatement.java:1092) at com.mysql.cj.jdbc.ClientPreparedStatement.executeUpdateInternal(ClientPreparedStatement.java:1040) at com.mysql.cj.jdbc.ServerPreparedStatement.executeBatchSerially(ServerPreparedStatement.java:357) ... 23 common frames omitted Caused by: java.lang.NullPointerException: null at com.mysql.cj.ServerPreparedQueryBindValue.storeDate(ServerPreparedQueryBindValue.java:287) at com.mysql.cj.ServerPreparedQueryBindValue.storeBinding(ServerPreparedQueryBindValue.java:239) at com.mysql.cj.ServerPreparedQuery.prepareExecutePacket(ServerPreparedQuery.java:301) at com.mysql.cj.ServerPreparedQuery.serverExecute(ServerPreparedQuery.java:206) at com.mysql.cj.jdbc.ServerPreparedStatement.serverExecute(ServerPreparedStatement.java:635) at com.mysql.cj.jdbc.ServerPreparedStatement.executeInternal(ServerPreparedStatement.java:418) ... 26 common frames omitted How to repeat: - git clone https://github.com/ctamisier/myjhipster - create a MySQL database named 'myjhipster' - ./mvnw -Dspring-boot.run.arguments="--spring.datasource.password=<replace-with-your-mysql-root-password>" And then check the logs. Suggested fix: I've investigated a bit and I put a comment here: https://github.com/mysql/mysql-connector-j/commit/c1e9c7d1f3ff5b31ca6a2744707ae4dd7840cf3c...