JBoss + JPA + Hibernate + MySql
Bonjour,
je voudrais faire une application JEE sur un serveur JBoss AS 5.0, l'application doit utiliser JPA pour la manipulation de la BD.
d'après ce que j'ai compris, JBoss supporte automatiquement Hibernate, et il suffit de mettre dans le persistence.xml le datasource. donc voila ce que j'ai fait:
Persistence.xml :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
| <?xml version="1.0" encoding="UTF-8"?>
<persistence
version="2.0" 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">
<persistence-unit name="IDPConfigurer">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<jta-data-source>MysqlDS</jta-data-source>
<class>org.idpconfigurer.dto.Component</class>
<properties>
<property
name="hibernate.dialect"
value="org.hibernate.dialect.OracleDialect"/>
</properties>
</persistence-unit>
</persistence> |
Dans le dossier "deploy" de JBoss, j'ai mis le fichier "mysql-ds.xml" suivant :
Code:
1 2 3 4 5 6 7 8 9
| <datasources>
<local-tx-datasource>
<jndi-name>MySqlDS</jndi-name>
<connection-url>jdbc:mysql://localhost:3306/idp</connection-url>
<driver-class>com.mysql.jdbc.Driver</driver-class>
<user-name>root</user-name>
<password>rootroot</password>
</local-tx-datasource>
</datasources> |
Quand au jar du connector MySql, je l'ai mis dans le dossier "lib" du serveur "defaut".
Lors du déploiement voici l'erreur que je reçois :
Code:
1 2 3 4 5 6 7 8
| 09:05:19,085 ERROR [ProfileServiceBootstrap] Failed to load profile: Summary of incomplete deployments (SEE PREVIOUS ERRORS FOR DETAILS):
DEPLOYMENTS MISSING DEPENDENCIES:
Deployment "persistence.unit:unitName=#IDPConfigurer" is missing the following dependencies:
Dependency "jboss.jca:name=MysqlDS,service=DataSourceBinding" (should be in state "Create", but is actually in state "** NOT FOUND Depends on 'jboss.jca:name=MysqlDS,service=DataSourceBinding' **")
DEPLOYMENTS IN ERROR:
Deployment "jboss.jca:name=MysqlDS,service=DataSourceBinding" is in error due to the following reason(s): ** NOT FOUND Depends on 'jboss.jca:name=MysqlDS,service=DataSourceBinding' ** |
Un coup de main? :oops: