6
respostas

New missing/unsatisfied dependencies

Boa tarde pessoal, após fazer toda a configuração e subir o servidor, está dando erro na persistence-unit. O mysql é 8 e já tentei trocar o connector, mas dá o mesmo erro. Desde já agradeço.

log

13:54:31,213 INFO  [org.jboss.weld.deployer] (MSC service thread 1-1) JBAS016005: Starting Services for CDI deployment: livraria.war
13:54:31,237 INFO  [org.jboss.weld.Version] (MSC service thread 1-1) WELD-000900 1.1.5 (AS71)
13:54:31,284 INFO  [org.jboss.as] (MSC service thread 1-7) JBAS015951: Admin console listening on http://127.0.0.1:9990
13:54:31,284 ERROR [org.jboss.as] (MSC service thread 1-7) JBAS015875: JBoss AS 7.1.1.Final "Brontes" started (with errors) in 3196ms - Started 210 of 319 services (32 services failed or missing dependencies, 76 services are passive or on-demand)
13:54:31,485 INFO  [org.jboss.as.server] (DeploymentScanner-threads - 2) JBAS015870: Deploy of deployment "livraria.war" was rolled back with failure message {"JBAS014771: Services with missing/unavailable dependencies" => ["jboss.persistenceunit.\"livraria.war#livraria\"jboss.naming.context.java.livrariaDSMissing[jboss.persistenceunit.\"livraria.war#livraria\"jboss.naming.context.java.livrariaDS]"]}
13:54:33,228 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-3) JBAS015877: Stopped deployment livraria.war in 1743ms
13:54:33,229 INFO  [org.jboss.as.controller] (DeploymentScanner-threads - 2) JBAS014774: Service status report
JBAS014775:    New missing/unsatisfied dependencies:
      service jboss.naming.context.java.livrariaDS (missing) dependents: [service jboss.persistenceunit."livraria.war#livraria"] 

13:54:33,231 ERROR [org.jboss.as.server.deployment.scanner] (DeploymentScanner-threads - 1) {"JBAS014653: Composite operation failed and was rolled back. Steps that failed:" => {"Operation step-2" => {"JBAS014771: Services with missing/unavailable dependencies" => ["jboss.persistenceunit.\"livraria.war#livraria\"jboss.naming.context.java.livrariaDSMissing[jboss.persistenceunit.\"livraria.war#livraria\"jboss.naming.context.java.livrariaDS]"]}}}

imagem do persistence.xml

https://snag.gy/LHngh0.jpg standalone.xml

        <subsystem xmlns="urn:jboss:domain:datasources:1.0">
            <datasources>
                <datasource jndi-name="java:jboss/datasources/ExampleDS" pool-name="ExampleDS" enabled="true" use-java-context="true">
                    <connection-url>jdbc:h2:mem:test;DB_CLOSE_DELAY=-1</connection-url>
                    <driver>h2</driver>
                    <security>
                        <user-name>sa</user-name>
                        <password>sa</password>
                    </security>
                </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>123456</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>
            </datasources>
        </subsystem>
6 respostas

Fala Márcio, tudo bem?

Além do datasource, você precisa configurar o jta-data-source no seu arquivo persistence.xml

Abraço!

Oi Otávio, o jta-data-source está configurado, segue imagem novamente do persitence.xml.

https://snag.gy/LHngh0.jpg

Coloca jndi-name="java:jboss/livrariaDS" no standalone.xml e java:jboss/livrariaDS no jta-data-source para ver se resolve

Bom dia Otávio, coloquei jndi-name="java:jboss/livrariaDS" no standalone.xml e jta-data-source, mas o erro continua o mesmo. Já refiz toda a configuração pra ver se não tinha nada errado, tô travado nisso :-(

OBS: acesso o MySQL normalmente pelo comand line.

Segue o link do projeto no gitlab, se puder dar uma olhada agradeço. abç.

https://gitlab.com/CURSO_EJB_ALURA/livraria.git

Ninguém?

Marcio,

Tenta trocar para

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