It's a bit of a weird bug. When executing a query on certain tables of a MySQL database from the Java driver, the system throws the following error:
java.lang.IllegalArgumentException: HOUR_OF_DAY: 2 -> 3 at java.util.GregorianCalendar.computeTime(GregorianCalendar.java:2829) at java.util.Calendar.updateTime(Calendar.java:3393) at java.util.Calendar.getTimeInMillis(Calendar.java:1782) at com.mysql.cj.result.SqlTimestampValueFactory.createFromTimestamp(SqlTimestampValueFactory.java:97) at com.mysql.cj.result.SqlTimestampValueFactory.createFromTimestamp(SqlTimestampValueFactory.java:44) ...
However, when we run the same query on the Workbench, the query executes successfully.
We are using version 8.0.17 of mysql. Regarding the java driver, we are using version 8.0.17.
In this post we have seen that it may be a problem with the configuration of the serverTimeZone parameter of the database, however, in the connection string we already specified the timezone as Europe/Madrid:
<Resource name="jdbc/mysqldb" auth="Container" type="javax.sql.DataSource"
maxTotal="200" maxIdle="30" maxWaitMillis="3000"
username="..." password="..." driverClassName="com.mysql.cj.jdbc.Driver"
url="jdbc:mysql://localhost:3306/bbdd"
connectionProperties="zeroDateTimeBehavior=CONVERT_TO_NULL;useSSL=false;characterEncoding=utf8;useUnicode=true;useJDBCCompliantTimezoneShift=true;useLegacyDatetimeCode=false;serverTimezone=Europe/Madrid"/>