1
resposta

Problemas com o DataSource

Prezados, fiz as configurações de acordo com a aula, mais esta aparecendo o seguinte erro após de dar o Full Publish :

02:15:31,243 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-4) WFLYSRV0028: Stopped deployment casadocodigo.war (runtime-name: casadocodigo.war) in 16ms
02:15:31,331 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-6) WFLYSRV0027: Starting deployment of "casadocodigo.war" (runtime-name: "casadocodigo.war")
02:15:31,356 INFO  [org.jboss.as.jpa] (MSC service thread 1-4) WFLYJPA0002: Read persistence.xml for casadocodigo-dev
02:15:31,364 INFO  [org.jboss.weld.deployer] (MSC service thread 1-7) WFLYWELD0003: Processing weld deployment casadocodigo.war
02:15:31,392 ERROR [org.jboss.as.controller.management-operation] (DeploymentScanner-threads - 2) WFLYCTL0013: Operation ("full-replace-deployment") failed - address: ([]) - failure description: {
    "WFLYCTL0412: Required services that are not installed:" => ["jboss.naming.context.java.jboss.datasources.casadocodigoDS"],
    "WFLYCTL0180: Services with missing/unavailable dependencies" => [
        "jboss.persistenceunit.\"casadocodigo.war#casadocodigo-dev\".__FIRST_PHASE__ is missing [jboss.naming.context.java.jboss.datasources.casadocodigoDS]",
        "jboss.persistenceunit.\"casadocodigo.war#casadocodigo-dev\" is missing [jboss.naming.context.java.jboss.datasources.casadocodigoDS]"
    ]
}
02:15:31,401 INFO  [org.jboss.as.server] (DeploymentScanner-threads - 2) WFLYSRV0016: Replaced deployment "casadocodigo.war" with deployment "casadocodigo.war"
02:15:31,402 INFO  [org.jboss.as.controller] (DeploymentScanner-threads - 2) WFLYCTL0183: Service status report
WFLYCTL0185:    Newly corrected services:
      service jboss.deployment.unit."casadocodigo.war".component."javax.faces.webapp.FacetTag".CREATE (new available)
      service jboss.deployment.unit."casadocodigo.war".component."javax.faces.webapp.FacetTag".WeldInstantiator (new available)

A pasta com o jar do mysql foi criada (wildfly-10.1.0/modules/com/mysql/main) com seu respectivo module.xml.

Este é o arquivo persistence.xml:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<persistence xmlns="http://xmlns.jcp.org/xml/ns/persistence"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.1"
    xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence
    http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd">
    <persistence-unit name="casadocodigo-dev"
        transaction-type="JTA">
        <description>Dev persistence unit</description>
        <provider>org.hibernate.ejb.HibernatePersistence</provider>
        <!-- java transaction api || JNDI -->
        <jta-data-source>java:jboss/datasources/casadocodigoDS</jta-data-source>
        <properties>
            <property name="hibernate.hbm2ddl.auto" value="update" />
            <property name="hibernate.show_sql" value="true" />
            <property name="hibernate.format_sql" value="true" />
            <property name="hibernate.dialect" value="org.hibernate.dialect.MySQL5InnoDBDialect" />
        </properties>
    </persistence-unit>
</persistence>

O banco foi criado, as credenciais (usuario) esta correto, meu BD é sem senha.

O mais curioso que após de dar o Full Publish o arquivo standalone-full.xml remove o datasource e o driver.

Que poderia estar acontecendo?

Obrigado pela atenção.

1 resposta

Opa, se você editou o arquivo com o servidor rodando(digo por dentro do eclipse), acho que isso pode acontecer mesmo. Então minha sugestão é parar o servidor, editar o arquivo e verificar de novo.