Configurei o meu projeto Java Web pra usar JTA ao realizar transações com o Banco de Dados. Meu projeto tem 4 módulos do Maven, um é exclusivo para as classes model e para a camada de persistência. Quando compilo no Maven o resultado é sucesso, mas ao tentar subir a aplicação no WildFly, estoura o problema abaixo de configuração do driver MySQL:
Deploying on WildFly Application Server
profile mode: false
debug mode: true
force redeploy: true
Iniciando WildFly Application Server
WildFly Application Server iniciado
Implantação inicial de for_clinic-web até /usr/local/WildFly/wildfly-11.0.0.Final/standalone/deployments/for_clinic-web-1.0.0-SNAPSHOT.war
Distribuição inicial do for_clinic-web completada
Implantando /usr/local/WildFly/wildfly-11.0.0.Final/standalone/deployments/for_clinic-web-1.0.0-SNAPSHOT.war
{"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.unit.\"for_clinic-web-1.0.0-SNAPSHOT.war\".CdiValidatorFactoryService",
"jboss.deployment.unit.\"for_clinic-web-1.0.0-SNAPSHOT.war\".WeldStartService",
"jboss.deployment.unit.\"for_clinic-web-1.0.0-SNAPSHOT.war\".component.\"com.sun.faces.config.ConfigureListener\".START",
"jboss.deployment.unit.\"for_clinic-web-1.0.0-SNAPSHOT.war\".component.\"com.sun.faces.config.ConfigureListener\".WeldInstantiator",
"jboss.deployment.unit.\"for_clinic-web-1.0.0-SNAPSHOT.war\".component.\"javax.faces.webapp.FacesServlet\".START",
"jboss.deployment.unit.\"for_clinic-web-1.0.0-SNAPSHOT.war\".component.\"javax.faces.webapp.FacesServlet\".WeldInstantiator",
"jboss.deployment.unit.\"for_clinic-web-1.0.0-SNAPSHOT.war\".component.\"javax.faces.webapp.FacetTag\".START",
"jboss.deployment.unit.\"for_clinic-web-1.0.0-SNAPSHOT.war\".component.\"javax.faces.webapp.FacetTag\".WeldInstantiator",
"jboss.deployment.unit.\"for_clinic-web-1.0.0-SNAPSHOT.war\".component.\"javax.servlet.jsp.jstl.tlv.PermittedTaglibsTLV\".START",
"jboss.deployment.unit.\"for_clinic-web-1.0.0-SNAPSHOT.war\".component.\"javax.servlet.jsp.jstl.tlv.PermittedTaglibsTLV\".WeldInstantiator",
"jboss.deployment.unit.\"for_clinic-web-1.0.0-SNAPSHOT.war\".component.\"javax.servlet.jsp.jstl.tlv.ScriptFreeTLV\".START",
"jboss.deployment.unit.\"for_clinic-web-1.0.0-SNAPSHOT.war\".component.\"javax.servlet.jsp.jstl.tlv.ScriptFreeTLV\".WeldInstantiator",
"jboss.deployment.unit.\"for_clinic-web-1.0.0-SNAPSHOT.war\".component.\"org.jboss.weld.servlet.WeldInitialListener\".START",
"jboss.deployment.unit.\"for_clinic-web-1.0.0-SNAPSHOT.war\".component.\"org.jboss.weld.servlet.WeldInitialListener\".WeldInstantiator",
"jboss.deployment.unit.\"for_clinic-web-1.0.0-SNAPSHOT.war\".component.\"org.jboss.weld.servlet.WeldTerminalListener\".START",
"jboss.deployment.unit.\"for_clinic-web-1.0.0-SNAPSHOT.war\".component.\"org.jboss.weld.servlet.WeldTerminalListener\".WeldInstantiator",
"jboss.deployment.unit.\"for_clinic-web-1.0.0-SNAPSHOT.war\".component.pacienteBusiness.START",
"jboss.deployment.unit.\"for_clinic-web-1.0.0-SNAPSHOT.war\".component.pacienteBusiness.WeldInstantiator",
"jboss.deployment.unit.\"for_clinic-web-1.0.0-SNAPSHOT.war\".component.pacienteBusiness.WeldInterceptorBindingsService",
"jboss.deployment.unit.\"for_clinic-web-1.0.0-SNAPSHOT.war\".component.pacienteDAO.START",
"jboss.deployment.unit.\"for_clinic-web-1.0.0-SNAPSHOT.war\".component.pacienteDAO.WeldInstantiator",
"jboss.deployment.unit.\"for_clinic-web-1.0.0-SNAPSHOT.war\".component.pacienteDAO.WeldInterceptorBindingsService",
"jboss.deployment.unit.\"for_clinic-web-1.0.0-SNAPSHOT.war\".component.pacienteService.START",
"jboss.deployment.unit.\"for_clinic-web-1.0.0-SNAPSHOT.war\".component.pacienteService.WeldInstantiator",
"jboss.deployment.unit.\"for_clinic-web-1.0.0-SNAPSHOT.war\".component.pacienteService.WeldInterceptorBindingsService",
"jboss.deployment.unit.\"for_clinic-web-1.0.0-SNAPSHOT.war\".component.usuarioDAO.START",
"jboss.deployment.unit.\"for_clinic-web-1.0.0-SNAPSHOT.war\".component.usuarioDAO.WeldInstantiator",
"jboss.deployment.unit.\"for_clinic-web-1.0.0-SNAPSHOT.war\".component.usuarioDAO.WeldInterceptorBindingsService",
"jboss.deployment.unit.\"for_clinic-web-1.0.0-SNAPSHOT.war\".component.usuarioService.START",
"jboss.deployment.unit.\"for_clinic-web-1.0.0-SNAPSHOT.war\".component.usuarioService.WeldInstantiator",
"jboss.deployment.unit.\"for_clinic-web-1.0.0-SNAPSHOT.war\".component.usuarioService.WeldInterceptorBindingsService",
"jboss.deployment.unit.\"for_clinic-web-1.0.0-SNAPSHOT.war\".deploymentCompleteService",
"jboss.deployment.unit.\"for_clinic-web-1.0.0-SNAPSHOT.war\".jndiDependencyService",
"jboss.deployment.unit.\"for_clinic-web-1.0.0-SNAPSHOT.war\".moduleDeploymentRuntimeInformationStart",
"jboss.naming.context.java.module.\"for_clinic-web-1.0.0-SNAPSHOT\".\"for_clinic-web-1.0.0-SNAPSHOT\".env.\"br.com.for_systems.for_clinic_domain.persistence.dao.GenericDAO\".entityManager",
"jboss.persistenceunit.\"for_clinic-web-1.0.0-SNAPSHOT.war#FOR_Clinic-PU\"",
"jboss.persistenceunit.\"for_clinic-web-1.0.0-SNAPSHOT.war#FOR_Clinic-PU\".__FIRST_PHASE__",
"jboss.undertow.deployment.default-server.default-host./for_clinic",
"jboss.undertow.deployment.default-server.default-host./for_clinic.UndertowDeploymentInfoService"
],
"Services that may be the cause:" => ["jboss.jdbc-driver.mysql"]
Meu arquivo persistence.xml :
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.1" xmlns="http://xmlns.jcp.org/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd">
<persistence-unit name="FOR_Clinic-PU" transaction-type="JTA">
<description>JPA-Hibernate Configuração</description>
<provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>
<jta-data-source>java:/jboss/datasources/for_clinic_DS</jta-data-source>
<exclude-unlisted-classes>false</exclude-unlisted-classes>
<properties>
<property name="hibernate.cache.provider_class" value="org.hibernate.cache.NoCacheProvider"/>
<property name="hibernate.show_sql" value="true"/>
<property name="hibernate.format_sql" value="true"/>
<property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect"/>
<property name="hibernate.connection.charSet" value="UTF-8"/>
</properties>
</persistence-unit>
</persistence>
E aqui está a configuração do meu DataSource no WildFly:
<datasource jndi-name="java:jboss/datasources/for_clinic_DS" pool-name="for_clinic_DS" enabled="true" use-java-context="true">
<connection-url>jdbc:mysql://127.0.0.1:3306/for_clinic?zeroDateTimeBehavior=convertToNull</connection-url>
<driver>mysql</driver>
<security>
<user-name>root</user-name>
<password>310990</password>
</security>
</datasource>
<drivers>
<driver name="mysql" module="com.mysql">
<xa-datasource-class>com.mysql.jdbc.Driver</xa-datasource-class>
</driver>
Dentro do diretório do WildFly, configurei e adicionei o driver do MySQL no seguinte caminho (modules/system/layers/base/com/mysql/main) e adicionei o module.xml abaixo:
<?xml version=”1.0″ encoding=”UTF-8″?>
<module xmlns="urn:jboss:module:1.1" name="com.mysql">
<resources>
<resource-root path="mysql-connector-java-5.1.45-bin.jar"/>
</resources>
<dependencies>
<module name="javax.api"/>
<module name="javax.transaction.api"/>
<module name="javax.servlet.api" optional="true"/>
</dependencies>
</module>
Alguém faz ideia do que pode estar acontecendo? Obrigado!