Bonjour,
Je me suis acheté le livre "Java Persistenbce et Hibernate" en francais.
Je suis au chapitre 2 qui traite des fichiers de configurations. Je me suis rendu sur le site de Eyrolles comme il me sugéré pour récupérer le projet de test : "java-persistance".
Comme ils disent sur le site, le projet regroupe aussi bien les codes sources du libre ainsi que
JBoss intégré préconfiguré prete à l'emploi...
Voici les différentes étapes que j'ai fait exactement :
1./ importation du projet dans Eclipse 3.3.2
2./ copie du driver de la base de donnée
hsqldb : hsqldb.jar dans le repertoire lib du projet. Dans éclipse, dans les propriétés du projet, j'ai fais "Add External JAR" et est ajouté hsqldb.jar.
3./ lancement de la méthode ch2Tests.EjbTestCase.testEntityManager() pour vérifier que l'installation (en reprenant mot pour mot du livre)
Mais j'obtiens ces erreurs
dans la vue Junit d'Eclipse :
Quote:
java.lang.RuntimeException: Failed to bootstrap
at org.jboss.embedded.junit.BaseTestCase.bootstrap(BaseTestCase.java:103)
at org.jboss.embedded.junit.BaseTestCase.setUp(BaseTestCase.java:66)
at junit.framework.TestCase.runBare(TestCase.java:125)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
Caused by: org.jboss.deployers.spi.IncompleteDeploymentException: Summary of incomplete deployments (SEE PREVIOUS ERRORS FOR DETAILS):
*** DEPLOYMENTS IN ERROR: Name -> Error
vfsfile:/J:/MesDocuments/java/TomcatInstall/Tomcat%206.0/webapps/java-persistance/classes/deploy/jboss-local-jdbc.rar -> java.io.FileNotFoundException: File does not exist: J:\MesDocuments\java\TomcatInstall\Tomcat%206.0
vfsfile:/J:/MesDocuments/java/TomcatInstall/Tomcat%206.0/webapps/java-persistance/classes/deploy/jboss-xa-jdbc.rar -> java.io.FileNotFoundException: File does not exist: J:\MesDocuments\java\TomcatInstall\Tomcat%206.0
vfsfile:/J:/MesDocuments/java/TomcatInstall/Tomcat%206.0/webapps/java-persistance/classes/deploy/jms-ra.rar -> java.io.FileNotFoundException: File does not exist: J:\MesDocuments\java\TomcatInstall\Tomcat%206.0
*** CONTEXTS MISSING DEPENDENCIES: Name -> Dependency{Required State:Actual State}
jboss.jca:name=DefaultDS,service=DataSourceBinding
-> jboss.jca:name=DefaultDS,service=LocalTxCM{Create:Configured}
-> jboss.jca:name=DefaultDS,service=LocalTxCM{Start:Configured}
.....
Dans la console, cela donne :
Quote:
22:20:13,817 ERROR [RARParserDeployer] Error during deployment: vfsfile:/J:/MesDocuments/java/TomcatInstall/Tomcat%206.0/webapps/java-persistance/classes/deploy/jboss-local-jdbc.rar
org.jboss.deployers.spi.DeploymentException: Error parsing meta data jboss-local-jdbc.rar/META-INF/ra.xml
at org.jboss.deployers.spi.DeploymentException.rethrowAsDeploymentException(DeploymentException.java:49)
at org.jboss.deployers.plugins.deployers.helpers.ObjectModelFactoryDeployer.parse(ObjectModelFactoryDeployer.java:114)
...
J'ai fais une recherche sur RARParserDeployer (erreur retourner dans la console) et je suis tombé sur le fichier jca-deployers-beans.xml.
Voici le contenu
Quote:
<?xml version="1.0" encoding="UTF-8"?>
<!-- JCA Deployers -->
<deployment xmlns="urn:jboss:bean-deployer:2.0">
<bean name="JCAMetaDataRepository" class="org.jboss.resource.metadata.repository.DefaultJCAMetaDataRepository"/>
<!-- RAR Deployment -->
<bean name="RARParserDeployer" class="org.jboss.resource.deployers.RARParserDeployer">
<property name="metaDataRepository"><inject bean="JCAMetaDataRepository"/></property>
<install bean="MainDeployer" method="addDeployer">
<parameter><this/></parameter>
</install>
<uninstall bean="MainDeployer" method="removeDeployer">
<parameter><this/></parameter>
</uninstall>
<property name="type">rar</property>
</bean>
<bean name="RARDeployer" class="org.jboss.resource.deployers.RARDeployer">
<property name="workManagerName">jboss.jca:service=WorkManager</property>
<property name="XATerminatorName">jboss:service=TransactionManager</property>
<install bean="MainDeployer" method="addDeployer">
<parameter><this/></parameter>
</install>
<uninstall bean="MainDeployer" method="removeDeployer">
<parameter><this/></parameter>
</uninstall>
<property name="type">rar</property>
</bean>
<!-- ConnectionFactory Deployment -->
<bean name="ConnectionFactoryDeployer" class="org.jboss.system.deployers.ServiceXSLDeployer">
<property name="suffix">-ds.xml</property>
<property name="XSLPath">stylesheets/NoJRMPConnectionFactoryTemplate.xsl</property>
<install bean="MainDeployer" method="addDeployer">
<parameter><this/></parameter>
</install>
<uninstall bean="MainDeployer" method="removeDeployer">
<parameter><this/></parameter>
</uninstall>
<property name="type">jca-ds</property>
</bean>
</deployment>
Ou ai je fauté ?
J'ai pourtant suivi scrupuleusement les recommandation du livre..
Hibernate version: Hibernate 3
Code between sessionFactory.openSession() and session.close():
Name and version of the database you are using: hsqldb
Debug level Hibernate log excerpt:
Problems with Session and transaction handling?
Read this:
http://hibernate.org/42.html