Bonjour, je suis en train d'écrire mon premier test des EJB3,
je suis en train de suivre le tutoriel de serge Tahe JEE qui se trouve sur developpez.com
Quand j'ai importé le projet et essayé de le tester , j'ai eu une exception que j'ai rien compris car je suis débutant avec les EJB
voila l'exeception :
j' ai rien changé du code du projet écrit par Serge, voila le bout de code
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23 Exception in thread "main" java.lang.RuntimeException: java.lang.IllegalStateException: Incompletely deployed: *** DEPLOYMENTS IN ERROR: Name -> Error datasourceFactory -> java.lang.IllegalArgumentException: Null value metadata *** DEPLOYMENTS MISSING DEPENDENCIES: Name -> Dependency{Required State:Actual State} datasource -> datasourceFactory{Instantiated:**ERROR**} at org.jboss.ejb3.embedded.EJB3StandaloneBootstrap.deployXmlResource(EJB3StandaloneBootstrap.java:103) at tests.InitDB.main(InitDB.java:28) Caused by: java.lang.IllegalStateException: Incompletely deployed: *** DEPLOYMENTS IN ERROR: Name -> Error datasourceFactory -> java.lang.IllegalArgumentException: Null value metadata *** DEPLOYMENTS MISSING DEPENDENCIES: Name -> Dependency{Required State:Actual State} datasource -> datasourceFactory{Instantiated:**ERROR**} at org.jboss.kernel.plugins.deployment.AbstractKernelDeployer.internalValidate(AbstractKernelDeployer.java:241) at org.jboss.kernel.plugins.deployment.AbstractKernelDeployer.validate(AbstractKernelDeployer.java:161) at org.jboss.ejb3.embedded.EJB3StandaloneBootstrap.deployXmlResource(EJB3StandaloneBootstrap.java:99) ... 1 more
cette ligne lance l'exception EJB3StandaloneBootstrap.deployXmlResource("META-INF/jboss-config.xml");
voila le fichier congig de JBOSS
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8 // on démarre le conteneur EJB3 JBoss // les fichiers de configuration ejb3-interceptors-aop.xml et embedded-jboss-beans.xml sont exploités EJB3StandaloneBootstrap.boot(null); // Création des beans propres à l'application EJB3StandaloneBootstrap.deployXmlResource("META-INF/jboss-config.xml"); // Deploy all EJBs found on classpath (slow, scans all) // EJB3StandaloneBootstrap.scanClasspath();
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45 <?xml version="1.0" encoding="UTF-8"?> <deployment xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:jboss:bean-deployer bean-deployer_1_0.xsd" xmlns="urn:jboss:bean-deployer:2.0"> <!-- factory de la DataSource --> <bean name="datasourceFactory" class="org.jboss.resource.adapter.jdbc.local.LocalTxDataSource"> <!-- nom JNDI de la DataSource --> <property name="jndiName">java:/datasource</property> <!-- base de données gérée --> <property name="driverClass">com.mysql.jdbc.Driver</property> <property name="connectionURL">jdbc:mysql://localhost:3306/jpa</property> <property name="userName">root</property> <property name="password"></property> <!-- propriétés pool de connexions --> <property name="minSize">0</property> <property name="maxSize">10</property> <property name="blockingTimeout">1000</property> <property name="idleTimeout">100000</property> <!-- gestionnaire de transactions, ici JTA --> <property name="transactionManager"> <inject bean="TransactionManager" /> </property> <!-- gestionnaire du cache Hibernate --> <property name="cachedConnectionManager"> <inject bean="CachedConnectionManager" /> </property> <!-- propriétés instanciation JNDI ? --> <property name="initialContextProperties"> <inject bean="InitialContextProperties" /> </property> </bean> <!-- la DataSource est demandée à une factory --> <bean name="datasource" class="java.lang.Object"> <constructor factoryMethod="getDatasource"> <factory bean="datasourceFactory" /> </constructor> </bean> </deployment>
Partager