Olá,
Estou tentando configurar uma aplicação web com seam 3, hibernate 4 no jboss as 7.
Tudo estava funcionando até eu precisar me conectar ao MySQL… Esta dando uma mensagem
de warning no log do Jboss e ele não completa o deploy.
13:32:50,243 INFO [org.jboss.as.server.controller] (DeploymentScanner-threads - 2) Deployment of "tiny-web.war" was rolled back with failure message {"Services with missing/unavailable dependencies" => ["jboss.naming.context.java.module.tiny-web.tiny-web.env.jdbc.tinyDatasource missing [ jboss.naming.context.java.jboss.resources.jdbc.tinyDatasource ]"]}
13:32:50,249 INFO [org.jboss.weld] (MSC service thread 1-2) Stopping weld service
13:32:50,257 INFO [org.jboss.jpa] (MSC service thread 1-2) stopping Persistence Unit Service 'tiny-web.war#tiny'
13:32:50,342 INFO [org.jboss.as.server.deployment] (MSC service thread 1-4) Stopped deployment tiny-web.war in 99ms
13:32:50,343 ERROR [org.jboss.as.deployment] (DeploymentScanner-threads - 1) {"Composite operation failed and was rolled back. Steps that failed:" => {"Operation step-2" => {"Services with missing/unavailable dependencies" => ["jboss.naming.context.java.module.tiny-web.tiny-web.env.jdbc.tinyDatasource missing [ jboss.naming.context.java.jboss.resources.jdbc.tinyDatasource ]"]}}}
Meu persistence.xml está assim:
<?xml version="1.0" encoding="UTF-8"?>
<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">
<!-- MySQL -->
<persistence-unit name="tiny" transaction-type="JTA">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<jta-data-source>java:/tinyDatasource</jta-data-source>
<properties>
<property name="hibernate.dialect" value="org.hibernate.dialect.MySQL5Dialect" />
<property name="hibernate.hbm2ddl.auto" value="update" />
<property name="hibernate.show_sql" value="true" />
<property name="hibernate.format_sql" value="true" />
<property name="jboss.entity.manager.factory.jndi.name" value="java:/tinyEntityManagerFactory" />
</properties>
</persistence-unit>
</persistence>
No meu web.xml tem tmb
<!-- JDBC DataSources (java:comp/env/jdbc) -->
<resource-ref>
<description>Tiny Datasource</description>
<res-ref-name>jdbc/tinyDatasource</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
No Jboss AS 7 eu criei o caminho
contendo:
<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.0" name="com.mysql">
<resources>
<resource-root path="mysql-connector-java-5.1.18-bin.jar"/>
</resources>
<dependencies>
<module name="javax.api"/>
</dependencies>
</module>
e no standalone.xml ficou assim:
<datasource jndi-name="java:/tinyDatasource" pool-name="tiny" enabled="true" use-java-context="true" jta="true" use-ccm="true">
<connection-url>jdbc:mysql://localhost:3306/tiny</connection-url>
<driver-class>com.mysql.jdbc.Driver</driver-class>
<driver>mysql-connector-java-5.1.18-bin.jar</driver>
<transaction-isolation>TRANSACTION_READ_COMMITTED</transaction-isolation>
<pool>
<min-pool-size>5</min-pool-size>
<max-pool-size>50</max-pool-size>
<prefill>true</prefill>
<use-strict-min>false</use-strict-min>
</pool>
<security>
<user-name>root</user-name>
<password></password>
</security>
<validation>
<validate-on-match>false</validate-on-match>
<background-validation>false</background-validation>
<useFastFail>false</useFastFail>
</validation>
<statement>
<prepared-statement-cache-size>100</prepared-statement-cache-size>
<share-prepared-statements/>
</statement>
</datasource>
<drivers>
<driver name="mysql-connector-java-5.1.18-bin.jar" module="com.mysql"/>
</drivers>
Alguem sabe qual poderia ser o problema ?
Eu consultei essa documentação de migração do jboss 5 para o 7
https://docs.jboss.org/author/display/AS7/How+do+I+migrate+my+application+from+AS5+or+AS6+to+AS7
Inclusive ali ele recomenda remover o hibernate do meu projeto, e utilizar o do jboss, então coloquei
como provided, mas não resolveu.
No começo do deploy parece que vai funcionar, porque ele chegar a fazer alguma coisa
13:32:44,542 INFO [org.jboss.as.server.deployment] (MSC service thread 1-12) Starting deployment of "tiny-web.war"
13:32:46,372 INFO [org.jboss.jpa] (MSC service thread 1-1) read persistence.xml for tiny
13:32:46,379 INFO [org.jboss.as.jpa] (MSC service thread 1-13) added javax.persistence.api, javaee.api, org.jboss.as.jpa, org.javassist dependencies to tiny-web.war
13:32:46,380 INFO [org.jboss.as.jpa] (MSC service thread 1-13) added (default provider) org.hibernate dependency to application deployment (since 1 PU(s) didn't specify jboss.as.jpa.providerModule)
13:32:46,380 INFO [org.jboss.as.jpa] (MSC service thread 1-13) added org.hibernate dependency to application deployment
13:32:46,639 INFO [org.jboss.weld] (MSC service thread 1-8) Processing CDI deployment: tiny-web.war
13:32:46,901 INFO [org.jboss.weld] (MSC service thread 1-11) Starting Services for CDI deployment: tiny-web.war
13:32:46,933 INFO [org.jboss.weld.Version] (MSC service thread 1-11) WELD-000900 1.1.2 (Final)
13:32:46,959 INFO [org.jboss.jpa] (MSC service thread 1-3) starting Persistence Unit Service 'tiny-web.war#tiny'
13:32:47,051 INFO [org.hibernate.annotations.common.Version] (MSC service thread 1-3) HCANN000001: Hibernate Commons Annotations {4.0.0.CR2}
13:32:47,055 INFO [org.hibernate.Version] (MSC service thread 1-3) HHH00412:Hibernate Core {4.0.0.CR2}
13:32:47,056 INFO [org.hibernate.cfg.Environment] (MSC service thread 1-3) HHH00206:hibernate.properties not found
13:32:47,058 INFO [org.hibernate.cfg.Environment] (MSC service thread 1-3) HHH00021:Bytecode provider name : javassist
13:32:47,072 INFO [org.hibernate.ejb.Ejb3Configuration] (MSC service thread 1-3) HHH00204:Processing PersistenceUnitInfo [
name: tiny
...]
13:32:47,127 INFO [org.hibernate.service.jdbc.connections.internal.ConnectionProviderInitiator] (MSC service thread 1-3) HHH00130:Instantiating explicit connection provider: org.hibernate.ejb.connection.InjectedDataSourceConnectionProvider
13:32:47,162 INFO [org.hibernate.dialect.Dialect] (MSC service thread 1-3) HHH00400:Using dialect: org.hibernate.dialect.MySQL5Dialect
13:32:47,174 INFO [org.hibernate.engine.transaction.internal.TransactionFactoryInitiator] (MSC service thread 1-3) HHH00268:Transaction strategy: org.hibernate.engine.transaction.internal.jta.CMTTransactionFactory
13:32:47,177 INFO [org.hibernate.hql.internal.ast.ASTQueryTranslatorFactory] (MSC service thread 1-3) HHH00397:Using ASTQueryTranslatorFactory
13:32:47,284 INFO [org.hibernate.tool.hbm2ddl.SchemaUpdate] (MSC service thread 1-3) HHH00228:Running hbm2ddl schema update
13:32:47,285 INFO [org.hibernate.tool.hbm2ddl.SchemaUpdate] (MSC service thread 1-3) HHH00102:Fetching database metadata
13:32:47,288 INFO [org.hibernate.tool.hbm2ddl.SchemaUpdate] (MSC service thread 1-3) HHH00396:Updating schema
13:32:47,289 INFO [org.hibernate.tool.hbm2ddl.SchemaUpdate] (MSC service thread 1-3) HHH00232:Schema update complete
13:32:47,306 INFO [org.jboss.weld] (MSC service thread 1-9) Starting weld service