2
respostas

"WFLYJCA0040: failed to invoke operation: WFLYJCA0047: Connection is not valid"

Ao testar a conexão com o Datasource recebo

"Unable to test connection for datasource AgendamentoEmailDS details."

Ao clicar em details recebo

"WFLYJCA0040: failed to invoke operation: WFLYJCA0047: Connection is not valid"

Código utilizado

https://github.com/alura-cursos/1750-jakartaee/archive/construindo_o_primeiro_ejb.zip

logs do <WILDFLY-HOME>\standalone\log\server.log

2020-10-24 18:12:35,179 ERROR [org.jboss.as.controller.management-operation] (External Management Request Threads -- 1) WFLYCTL0013: Operation ("test-connection-in-pool") failed - address: ([
    ("subsystem" => "datasources"),
    ("data-source" => "AgendamentoEmailDS")
]) - failure description: "WFLYJCA0040: failed to invoke operation: WFLYJCA0047: Connection is not valid"
2020-10-24 18:12:35,179 INFO  [org.jboss.as.controller] (External Management Request Threads -- 1) WFLYCTL0183: Service status report
WFLYCTL0186:   Services which failed to start:      service jboss.persistenceunit."agendamento-email-0.0.1-SNAPSHOT.war#AgendamentoEmailDS": org.hibernate.service.spi.ServiceException: Unable to create requested service [org.hibernate.engine.jdbc.env.spi.JdbcEnvironment]

Dentro de <WILDFLY-HOME>\modules\com\mysql\main Temos:

  • mysql-connector-java-8.0.22
  • modules.xml

Conteúdo do <WILDFLY-HOME>\modules\com\mysql\main\modules.xml

<?xml version='1.0' encoding='UTF-8'?>

<module xmlns="urn:jboss:module:1.1" name="com.mysql">

    <resources>
        <resource-root path="mysql-connector-java-8.0.22.jar"/>
    </resources>

    <dependencies>
        <module name="javax.api"/>
        <module name="javax.transaction.api"/>
    </dependencies>
</module>
2 respostas

Consegui resolver com a solução desse tópico

https://cursos.alura.com.br/forum/topico-duvida-conexao-126164

"opa, era o timezone do banco.

SET @@global.time_zone = '+3:00';"

Sugiro inserir uma nota na aula.

Abraços

Obrigado por compartilhar a solução Gustavo

Vou pedir para incluirem na descrição da aula.

Bons estudos