Solucionado (ver solução)
Solucionado
(ver solução)
6
respostas

Erro ao subir Wildfly 13.0 após configurar o DataSource

Prezados, boa noite.

Ao configurar o meu projeto com as configurações propostas no exercício 3:8 o meu Wildfly não cria as tabelas no meu banco de dados.

Segue meu persistence.xml

<persistence xmlns="http://java.sun.com/xml/ns/persistence"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
        http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"
    version="2.0">

    <persistence-unit name="livraria">
        <provider>org.hibernate.ejb.HibernatePersistence</provider>

        <jta-data-source>java:/livrariaDS</jta-data-source>

        <class>br.com.caelum.livraria.modelo.Autor</class>
        <class>br.com.caelum.livraria.modelo.Livro</class>
        <class>br.com.caelum.livraria.modelo.Usuario</class>

        <properties>

            <!-- Configuracoes especificas do Hibernate -->
            <property name="hibernate.dialect" value="org.hibernate.dialect.MySQL5InnoDBDialect" />
            <property name="hibernate.hbm2ddl.auto" value="update" />
            <property name="hibernate.show_sql" value="true" />

        </properties>
    </persistence-unit>
</persistence>

E abaixo a minha Stacktrace

00:14:39,080 INFO  [org.jboss.as.ejb3.deployment] (MSC service thread 1-5) WFLYEJB0473: JNDI bindings for session bean named 'UsuarioDao' in deployment unit 'deployment "livraria.war"' are as follows:

    java:global/livraria/UsuarioDao!br.com.caelum.livraria.dao.UsuarioDao
    java:app/livraria/UsuarioDao!br.com.caelum.livraria.dao.UsuarioDao
    java:module/UsuarioDao!br.com.caelum.livraria.dao.UsuarioDao
    ejb:livraria/UsuarioDao!br.com.caelum.livraria.dao.UsuarioDao
    java:global/livraria/UsuarioDao
    java:app/livraria/UsuarioDao
    java:module/UsuarioDao

00:14:39,379 INFO  [org.infinispan.factories.GlobalComponentRegistry] (MSC service thread 1-6) ISPN000128: Infinispan version: Infinispan 'Gaina' 9.2.4.Final
00:14:39,580 INFO  [org.jboss.weld.Version] (MSC service thread 1-1) WELD-000900: 3.0.4 (Final)
00:14:39,762 INFO  [org.jboss.as.clustering.infinispan] (ServerService Thread Pool -- 66) WFLYCLINF0002: Started client-mappings cache from ejb container
00:14:40,091 INFO  [javax.enterprise.resource.webcontainer.jsf.config] (ServerService Thread Pool -- 66) Inicializando Mojarra 2.2.13.SP5  para o contexto '/Cirurgia-0.0.1-SNAPSHOT'
00:14:40,767 INFO  [org.wildfly.extension.undertow] (ServerService Thread Pool -- 66) WFLYUT0021: Registered web context: '/Cirurgia-0.0.1-SNAPSHOT' for server 'default-server'
00:14:40,779 ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) WFLYCTL0013: Operation ("deploy") failed - address: ([("deployment" => "livraria.war")]) - failure description: {
    "WFLYCTL0412: Required services that are not installed:" => ["jboss.naming.context.java.livrariaDS"],
    "WFLYCTL0180: Services with missing/unavailable dependencies" => [
        "jboss.persistenceunit.\"livraria.war#livraria\".__FIRST_PHASE__ is missing [jboss.naming.context.java.livrariaDS]",
        "jboss.persistenceunit.\"livraria.war#livraria\" is missing [jboss.naming.context.java.livrariaDS]"
    ]
}
00:14:40,793 INFO  [org.jboss.as.server] (ServerService Thread Pool -- 39) WFLYSRV0010: Deployed "livraria.war" (runtime-name : "livraria.war")
00:14:40,794 INFO  [org.jboss.as.server] (ServerService Thread Pool -- 39) WFLYSRV0010: Deployed "Cirurgia-0.0.1-SNAPSHOT.war" (runtime-name : "Cirurgia-0.0.1-SNAPSHOT.war")
00:14:40,796 INFO  [org.jboss.as.controller] (Controller Boot Thread) WFLYCTL0183: Service status report
WFLYCTL0184:    New missing/unsatisfied dependencies:
      service jboss.naming.context.java.livrariaDS (missing) dependents: [service jboss.persistenceunit."livraria.war#livraria".__FIRST_PHASE__, service jboss.persistenceunit."livraria.war#livraria"] 
WFLYCTL0448: 39 additional services are down due to their dependencies being missing or failed
00:14:40,886 INFO  [org.jboss.as.server] (Controller Boot Thread) WFLYSRV0212: Resuming server
00:14:40,890 INFO  [org.jboss.as] (Controller Boot Thread) WFLYSRV0060: Http management interface listening on http://127.0.0.1:9990/management
00:14:40,890 INFO  [org.jboss.as] (Controller Boot Thread) WFLYSRV0051: Admin console listening on http://127.0.0.1:9990
00:14:40,891 ERROR [org.jboss.as] (Controller Boot Thread) WFLYSRV0026: WildFly Full 13.0.0.Final (WildFly Core 5.0.0.Final) started (with errors) in 9041ms - Started 533 of 768 services (43 services failed or missing dependencies, 321 services are lazy, passive or on-demand)
a

Podem me ajudar?

6 respostas

Posta a configuração do DataSource

Segue meu datasource

<datasource jndi-name="java:/livrariaDS" pool-name="livrariaDS"
                    enabled="true" use-java-context="true">

                    <connection-url>jdbc:mysql://localhost:3306/livraria</connection-url>
                    <driver>com.mysql</driver>
                    <pool>
                        <min-pool-size>10</min-pool-size>
                        <max-pool-size>100</max-pool-size>
                        <prefill>true</prefill>
                    </pool>
                    <security>
                        <user-name>root</user-name>
                        <password></password>
                    </security>
                </datasource>

        <drivers>
                    <driver name="h2"     module="com.h2database.h2">
                        <xa-datasource-class>org.h2.jdbcx.JdbcDataSource</xa-datasource-class>
                         </driver>

                    <driver name="com.mysql" module="com.mysql">
                        <xa-datasource-class>
                            com.mysql.jdbc.jdbc2.optional.MysqlXADataSource
                        </xa-datasource-class>
                    </driver>
                </drivers>

Alguém tem alguma noção no que pode estar causando o erro?

Configurou o driver do mysql como módulo? https://synaptiklabs.com/posts/adding-the-mysql-jdbc-driver-into-wildfly/

Sim realizei esse procedimento. Estou refazendo novamente essa parte, e baixando outra versão do Jboss. Estava usando o Wildfly 13, estou pegando o 12 agora.

solução!

Bom dia Breno.

Obrigado pelo link. Resolvi fazendo um downgrade do Wildfly 13 para o 12. Funcionou perfeitamente. Agradeço a atenção de todos.