06 julio, 2020

Solucionar el error Netbeans build-impl.xml:1052 (Build Failed)

Al trabajar con NetBeans 8.0.2, GlassFish 4.1 y MySQL 8.0 seguramente te habras topado con el siguiente error al momento de ejecutar una aplicación.

En la consola de NetBeans obtenemos lo siguiente:

build-impl.xml:1052: The module has not been deployed

Y en el navegador obtenemos lo siguiente

HTTP Status 500 - Internal Server Error


type Exception report

messageInternal Server Error

descriptionThe server encountered an internal error that prevented it from fulfilling this request.

exception

org.springframework.web.util.NestedServletException: Request processing failed; nested 
exception is org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get 
JDBC Connection; nested exception is java.sql.SQLNonTransientConnectionException: 
Cannot open file:C:\Users\XxkokoxXT\AppData\Roaming\NetBeans\8.0.2\config\GF_4.1\domain1/
config/keystore.jks [Keystore was tampered with, or password was incorrect]

root cause

org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; 
nested exception is java.sql.SQLNonTransientConnectionException: Cannot open 
file:C:\Users\XxkokoxXT\AppData\Roaming\NetBeans\8.0.2\config\GF_4.1\domain1/config/
keystore.jks [Keystore was tampered with, or password was incorrect]

root cause

java.sql.SQLNonTransientConnectionException: Cannot open file:C:\Users\XxkokoxXT\AppData\
Roaming\NetBeans\8.0.2\config\GF_4.1\domain1/config/keystore.jks [Keystore was tampered 
with, or password was incorrect]

root cause

com.mysql.cj.exceptions.SSLParamsException: Cannot open file:C:\Users\XxkokoxXT\AppData\
Roaming\NetBeans\8.0.2\config\GF_4.1\domain1/config/keystore.jks [Keystore was tampered 
with, or password was incorrect]

root cause

java.io.IOException: Keystore was tampered with, or password was incorrect

root cause

java.security.UnrecoverableKeyException: Password verification failed

note The full stack traces of the exception and its root causes are available in the GlassFish Server Open Source Edition 4.1 logs.


GlassFish Server Open Source Edition 4.1


Para solucionar este inconveniente debemos agregar unos parámetros adicionales a la URL de la conexión. https://stackoverflow.com/questions/51586401/glassfish-keystore-error-after-adding-mysql-connector

public DriverManagerDataSource Conectar(){
        DriverManagerDataSource dataSource = new DriverManagerDataSource();
        dataSource.setDriverClassName("com.mysql.cj.jdbc.Driver");
        dataSource.setUrl("jdbc:mysql://localhost:3306/spring_mvc?autoReconnect=true&useSSL=false");
        dataSource.setUsername("root");
        dataSource.setPassword("root");
        return dataSource;
}



Si todavia tenemos errores


En la consola de NetBeans obtenemos lo siguiente:

com.mysql.cj.exceptions.InvalidConnectionAttributeException: The server time zone value 'Hora est. Pacífico, Sudaméric' is unrecognized or represents more than one time zone. You must configure either the server or JDBC driver (via the serverTimezone configuration property) to use a more specifc time zone value if you want to utilize time zone support.
Y en el navegador obtenemos lo siguiente

HTTP Status 500 - Internal Server Error


type Exception report

messageInternal Server Error

descriptionThe server encountered an internal error that prevented it from fulfilling this request.

exception

org.springframework.web.util.NestedServletException: Request processing failed; nested 
exception is org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get 
JDBC Connection; nested exception is java.sql.SQLNonTransientConnectionException: Could 
not create connection to database server. Attempted reconnect 3 times. Giving up.

root cause

org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; 
nested exception is java.sql.SQLNonTransientConnectionException: Could not create connection 
to database server. Attempted reconnect 3 times. Giving up.

root cause

java.sql.SQLNonTransientConnectionException: Could not create connection to database server. 
Attempted reconnect 3 times. Giving up.

root cause

com.mysql.cj.exceptions.InvalidConnectionAttributeException: The server time zone value 
'Hora est. Pacífico, Sudaméric' is unrecognized or represents more than one time zone. 
You must configure either the server or JDBC driver (via the serverTimezone configuration 
property) to use a more specifc time zone value if you want to utilize time zone support.

note The full stack traces of the exception and its root causes are available in the GlassFish Server Open Source Edition 4.1 logs.


GlassFish Server Open Source Edition 4.1


Para solucionar este inconveniente debemos agregar unos parámetros adicionales a la URL de la conexión.

public DriverManagerDataSource Conectar(){
        DriverManagerDataSource dataSource = new DriverManagerDataSource();
        dataSource.setDriverClassName("com.mysql.cj.jdbc.Driver");
        dataSource.setUrl("jdbc:mysql://localhost:3306/spring_mvc?autoReconnect=true&useSSL=false&useTimezone=true&serverTimezone=UTC");
        dataSource.setUsername("root");
        dataSource.setPassword("root");
        return dataSource;
}





No hay comentarios, ¡cuéntame algo!

Me gustaría saber tu opinión. ¡Saludos!