10
respostas

Configuração de Ambiente EAR

Boa tarde estou tentando configurar um ambiente de trabalhor EARporem está dando erro ao subir a aplicação segue o erro :

13:44:13,854 INFO  [org.hibernate.jpa.internal.util.LogHelper] (ServerService Thread Pool -- 61) HHH000204: Processing PersistenceUnitInfo [
    name: Escola-EJB
    ...]
13:44:14,011 INFO  [org.hibernate.validator.internal.util.Version] (MSC service thread 1-6) HV000001: Hibernate Validator 5.2.4.Final
13:44:14,082 INFO  [org.hibernate.Version] (ServerService Thread Pool -- 61) HHH000412: Hibernate Core {5.0.10.Final}
13:44:14,104 INFO  [org.hibernate.cfg.Environment] (ServerService Thread Pool -- 61) HHH000206: hibernate.properties not found
13:44:14,107 INFO  [org.hibernate.cfg.Environment] (ServerService Thread Pool -- 61) HHH000021: Bytecode provider name : javassist
13:44:14,204 INFO  [org.hibernate.annotations.common.Version] (ServerService Thread Pool -- 61) HCANN000001: Hibernate Commons Annotations {5.0.1.Final}
13:44:14,307 INFO  [org.jboss.weld.deployer] (MSC service thread 1-6) WFLYWELD0003: Processing weld deployment Escola-EJB.jar
13:44:14,378 INFO  [org.jboss.weld.deployer] (MSC service thread 1-4) WFLYWELD0003: Processing weld deployment Escola-WEB.war
13:44:14,572 INFO  [org.jboss.weld.Version] (MSC service thread 1-2) WELD-000900: 2.3.5 (Final)
13:44:14,938 INFO  [org.jboss.as.jpa] (ServerService Thread Pool -- 61) WFLYJPA0010: Starting Persistence Unit (phase 2 of 2) Service 'Escola.ear/Escola-EJB.jar#Escola-EJB'
10 respostas

Oi Marcus,

Pelo log que você mandou não ocorreu nenhum erro.

Apenas foi impresso informações sobre o projeto Escola-EJB.

Boa noite eu vi que o que esta acontecendo é que estou utilizando um mysql 8 e não tenho o drive de conexão adequado por sinal se souber um drive adequado por gentilize posta aqui por favor.

Ah sim, nesse caso precisa atualizar para o novo connector do mysql: https://dev.mysql.com/downloads/connector/j/

Se estiver utilizando maven:

<dependency>
    <groupId>mysql</groupId>
    <artifactId>mysql-connector-java</artifactId>
    <version>8.0.11</version>
</dependency>

"jboss.undertow.deployment.default-server.default-host./Escola-WEB.UndertowDeploymentInfoService" ], "Services that may be the cause:" => ["jboss.jdbc-driver.com_mysql"] } } 13:54:35,800 ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) WFLYCTL0013: Operation ("add") failed - address: ([ ("subsystem" => "datasources"), ("data-source" => "livrariaDS") ]) - failure description: { "WFLYCTL0412: Required services that are not installed:" => ["jboss.jdbc-driver.com_mysql"], "WFLYCTL0180: Services with missing/unavailable dependencies" => [ "jboss.driver-demander.java:/livrariaDS is missing [jboss.jdbc-driver.com_mysql]", "org.wildfly.data-source.livrariaDS is missing [jboss.jdbc-driver.com_mysql]" ] } 13:54:35,801 ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) WFLYCTL0013: Operation ("add") failed - address: ([ ("subsystem" => "datasources"), ("data-source" => "EscolaDS") ]) - failure description: { "WFLYCTL0412: Required services that are not installed:" => ["jboss.jdbc-driver.com_mysql"], "WFLYCTL0180: Services with missing/unavailable dependencies" => [ "jboss.driver-demander.java:/EscolaDS is missing [jboss.jdbc-driver.com_mysql]", "org.wildfly.data-source.EscolaDS is missing [jboss.jdbc-driver.com_mysql]" ] } 13:54:35,805 ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) WFLYCTL0013: Operation ("add") failed - address: ([ ("subsystem" => "datasources"), ("data-source" => "livrariaDS") ]) - failure description: { "WFLYCTL0412: Required services that are not installed:" => [ "jboss.jdbc-driver.com_mysql", "jboss.jdbc-driver.com_mysql" ], "WFLYCTL0180: Services with missing/unavailable dependencies" => [ "jboss.driver-demander.java:/livrariaDS is missing [jboss.jdbc-driver.com_mysql]", "org.wildfly.data-source.livrariaDS is missing [jboss.jdbc-driver.com_mysql]", "org.wildfly.data-source.livrariaDS is missing [jboss.jdbc-driver.com_mysql]" ] } 13:54:35,816 ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) WFLYCTL0013: Operation ("add") failed - address: ([ ("subsystem" => "datasources"), ("data-source" => "EscolaDS") ]) - failure description: { "WFLYCTL0412: Required services tha

Esse é o erro que acontece quando eu coloco a versão do drive 8

Esse é meu arquivo module

<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.0" name="com.mysql">
    <resources>
        <resource-root path="mysql-connector-java-8.0.12-sources.jar"/>
    </resources>
    <dependencies>
        <module name="javax.api"/>
    </dependencies>
</module>

Oi Marcus,

Altere a configuração do modulo para adicionar mais essa dependencia:

<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.0" name="com.mysql">
    <resources>
        <resource-root path="mysql-connector-java-8.0.12-sources.jar"/>
    </resources>
    <dependencies>
        <module name="javax.api"/>
        <module name="javax.transaction.api"/>
    </dependencies>
</module>

E confira no standalone.xml se está assim:

<datasource jndi-name="java:jboss/datasources/livrariaDS"
    pool-name="livrariaDS" enabled="true"
    use-java-context="true">
    <connection-url>jdbc:mysql://host:3306/livraria?useSSL=false</connection-url>
    <driver>com.mysql</driver>
    <security>
        <user-name>root</user-name>
        <password>root</password>
    </security>
</datasource>

<driver name="com.mysql" module="com.mysql">
    <driver-class>com.mysql.cj.jdbc.Driver</driver-class>
</driver>
 WFLYEJB0473: JNDI bindings for session bean named 'EstudanteDao' in deployment unit 'subdeployment "Escola-EJB.jar" of deployment "Escola.ear"' are as follows:

    java:global/Escola/Escola-EJB/EstudanteDao!br.com.em.jpa.beans.EstudanteDaoLocal
    java:app/Escola-EJB/EstudanteDao!br.com.em.jpa.beans.EstudanteDaoLocal
    java:module/EstudanteDao!br.com.em.jpa.beans.EstudanteDaoLocal
    java:global/Escola/Escola-EJB/EstudanteDao!br.com.em.jpa.beans.EstudanteDaoRemote
    java:app/Escola-EJB/EstudanteDao!br.com.em.jpa.beans.EstudanteDaoRemote
    java:module/EstudanteDao!br.com.em.jpa.beans.EstudanteDaoRemote
    java:jboss/exported/Escola/Escola-EJB/EstudanteDao!br.com.em.jpa.beans.EstudanteDaoRemote

"WFLYCTL0180: Services with missing/unavailable dependencies" => undefined,
    "WFLYCTL0288: One or more services were unable to start due to one or more indirect dependencies not being available." => {
        "Services that were unable to start:" => [
            "jboss.deployment.subunit.\"Escola.ear\".\"Escola-EJB.jar\".CdiValidatorFactoryService",
            "jboss.deployment.subunit.\"Escola.ear\".\"Escola-EJB.jar\".component.EstudanteDao.JndiBindingsService",
            "jboss.deployment.subunit.\"Escola.ear\".\"Escola-EJB.jar\".component.EstudanteDao.START",
            "jboss.deployment.subunit.\"Escola.ear\".\"Escola-EJB.jar\".component.EstudanteDao.WeldInstantiator",
            "jboss.deployment.subunit.\"Escola.ear\".\"Escola-EJB.jar\".component.EstudanteDao.WeldInterceptorBindingsService",
            "jboss.deployment.subunit.\"Escola.ear\".\"Escola-EJB.jar\".deploymentCompleteService",
            "jboss.deployment.subunit.\"Escola.ear\".\"Escola-EJB.jar\".jndiDependencyService",
            "jboss.deployment.subunit.\"Escola.ear\".\"Escola-EJB.jar\".moduleDeploymentRuntimeInformationStart",
            "jboss.deployment.subunit.\"Escola.ear\".\"Escola-WEB.war\".CdiValidatorFactoryService",
            "jboss.deployment.subunit.\"Escola.ear\".\"Escola-WEB.war\".component.\"com.sun.faces.config.ConfigureListener\".START",
            "jboss.deployment.subunit.\"Escola.ear\".\"Escola-WEB.war\".component.\"javax.faces.webapp.FacesServlet\".START",
            "jboss.deployment.subunit.\"Escola.ear\".\"Escola-WEB.war\".component.\"javax.faces.webapp.FacetTag\".START",
            "jboss.deployment.subunit.\"Escola.ear\".\"Escola-WEB.war\".component.\"javax.servlet.jsp.jstl.tlv.PermittedTaglibsTLV\".START",
            "jboss.deployment.subunit.\"Escola.ear\".\"Escola-WEB.war\".component.\"javax.servlet.jsp.jstl.tlv.ScriptFreeTLV\".START",
            "jboss.deployment.subunit.\"Escola.ear\".\"Escola-WEB.war\".deploymentCompleteService",
            "jboss.deployment.unit.\"Escola.ear\".CdiValidatorFactoryService",
            "jboss.deployment.unit.\"Escola.ear\".WeldStartService",
            "jboss.deployment.unit.\"Escola.ear\".deploymentCompleteService",
            "jboss.naming.context.java.comp.Escola.Escola-EJB.EstudanteDao.env.\"br.com.em.jpa.beans.EstudanteDao\".manager",
            "jboss.persistenceunit.\"Escola.ear/Escola-EJB.jar#Escola-EJB\"",
            "jboss.persistenceunit.\"Escola.ear/Escola-EJB.jar#Escola-EJB\".__FIRST_PHASE__",
            "jboss.undertow.deployment.default-server.default-host./Escola-WEB",
            "jboss.undertow.deployment.default-server.default-host./Escola-WEB.UndertowDeploymentInfoService"
        ],
        "Services that may be the cause:" => ["jboss.jdbc-driver.com_mysql"]
    }
}
17:53:38,207 ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) WFLYCTL0013: Operation ("add") failed - address: ([
    ("subsystem" => "datasources"),
    ("data-source" => "EscolaDS")
]) - failure description: {
    "WFLYCTL0412: Required services that are not installed:" => ["jboss.jdbc-driver.com_mysql"],
    "WFLYCTL0180: Services with missing/unavailable dependencies" => [
        "org.wildfly.data-source.EscolaDS is missing [jboss.jdbc-driver.com_mysql]",
        "jboss.driver-demander.java:/EscolaDS is missing [jboss.jdbc-driver.com_mysql]"
    ]
}
17:53:38,212 ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) WFLYCTL0013: Operation ("add") failed - address: ([
    ("subsystem" => "datasources"),
    ("data-source" => "EscolaDS")
]) - failure description: {
    "WFLYCTL0412: Required services that are not installed:" => [
        "jboss.jdbc-driver.com_mysql",
        "jboss.jdbc-driver.com_mysql"
    ],
    "WFLYCTL0180: Services with missing/unavailable dependencies" => [
        "org.wildfly.data-source.EscolaDS is missing [jboss.jdbc-driver.com_mysql]",
        "jboss.driver-demander.java:/EscolaDS is missing [jboss.jdbc-driver.com_mysql]",
        "org.wildfly.data-source.EscolaDS is missing [jboss.jdbc-driver.com_mysql]"
    ]
}

Continua com erro se eu coloco a versão do mysql mais antiga funciona estourando alguns erros, só que como tudo evolui muito rapidamente gostaria de já aprender com esse drive.

Oi Marcus,

Estranho não funcionar com o mysql 8. Pois pela mensagem de erro o problema é que o WildFly não encontrou o modulo.

Aqui tem um exemplo de projeto que funciona com o MySQL 8: https://github.com/cassiusvm/cadastrocrud

Veja se tem alguma configuração que ficou faltando.