Error trying to perform CRUD from JAVA webApp to MySQL DB

限于喜欢 提交于 2020-03-04 23:04:38

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!