shawnmckinney / apache-fortress-demo

Sample web app to demo end-to-end security w/ JavaEE, Spring Security and RBAC fine-grained authorization. All connections use SSL.
Apache License 2.0
19 stars 11 forks source link

update mysql driver from 5.1.9 to 8.0.16 communication link failure #11

Closed shawnmckinney closed 3 years ago

shawnmckinney commented 4 years ago

Accepted github dependabot PR to the latest MySQL JDBC driver has error. Reverting for now, research later.

org.apache.ibatis.exceptions.PersistenceException: 
### Error querying database.  Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Failed to obtain JDBC Connection; nested exception is com.mysql.cj.jdbc.exceptions.CommunicationsException: Communications link f
ailure

The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
### The error may exist in page1.xml
### The error may involve com.mycompany.dao.Page1Dao.getPages1ByCustomer
### The error occurred while executing a query
### Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Failed to obtain JDBC Connection; nested exception is com.mysql.cj.jdbc.exceptions.CommunicationsException: Communications link failure

The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
        at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:26)
        at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:111)
        at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:102)
        at org.apache.ibatis.binding.MapperMethod.executeForMany(MapperMethod.java:119)
        at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:63)
        at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:52)
shawnmckinney commented 4 years ago

Tried a couple things, same error.

a. change driver in fortress.properties:

database.driver=com.mysql.jdbc.Driver to: com.mysql.cj.jdbc.Driver

b. update dependencies:

org.mybatis mybatis 3.5.5 to: 3.2.7
    <dependency>
        <groupId>mysql</groupId>
        <artifactId>mysql-connector-java</artifactId>
        <version>5.1.9</version> to: <version>8.0.16</version>
    </dependency>
    <dependency>
        <groupId>org.mybatis</groupId>
        <artifactId>mybatis-spring</artifactId>
        <version>2.0.5</version> to: <version>1.2.2</version>
    </dependency>
shawnmckinney commented 3 years ago

resolved