Discover
After getting the project from the teacher, it was normal when the project started, but when the data was submitted on the web page, Caused by:
java.lang.NullPointerException
An error is reported,
the last log shows
com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Could not create connection to database server.
It was caused by a bug when connecting to mysql.
After checking, it was a database version mismatch problem,
so I checked the mysql version of my computer.
Wow, it's mysql8.0, let's look at the mysql version in the dependencies
It is mysql5.1.32, the two versions do not match,
Solution
Because the mysql installed in my computer is version 8.0, the version in the pom dependency is also changed to 8.0, and mysql8.0.24 version is used here
Then modify the connection pool driver, mysql8.0 can not use the original wording, add cj on the basis of "com.mysql.jdbc.Driver"
com.mysql.cj.jdbc.Driver
Hey, it was finally solved perfectly, congratulations (o°ω°o)