问题
I hope you can help me with this question. There are other posts that have questions about the same error, but it's not the same thing as they talk about different things. I'm currently developing a basic Java web app implementing MVC pattern, which performs CRUD operations to a MySQL 8.0 DB, the web server is GlassFish 4.1.1, and the MySQL connector is 8.0.17 and NetBeans IDE 8.2. All views are created and they are working fine, but when I try to insert or query some information into the DB through the JSP interface, the following error is shown in the GlassFish server log.
I haven't done anything to that file.
I have already checked the DB password and user and it's ok, I've tested it in Workbench and connects fine.
I have tested this same code on two different computers but get the same error.
My Connection class looks like this:
package Config;
import java.sql.*;
public class Conexion {
Connection con;
public Conexion(){
try {
Class.forName("com.mysql.cj.jdbc.Driver");
con=DriverManager.getConnection("jdbc:mysql://localhost:3306/mydb","root","mypassword");
} catch (Exception e) {
System.err.println("Error"+e);
}
}
public Connection getConnection(){
return con;
}
}
And I am getting the following error:
Grave: Errorjava.sql.SQLNonTransientConnectionException: Cannot open enter code here`file:C:\Users\myusername\AppData\Roaming\NetBeans\8.2\config\GF_4.1.1\domain1/config/keystore.jks [Keystore was tampered with, or password was incorrect]
I've also got these two errors in my Glassfish log, I don't know if they may be the cause of the issue.
Please help me
Thanks in advance.
来源:https://stackoverflow.com/questions/57863113/error-trying-to-perform-crud-from-java-webapp-to-mysql-db