Bonjour a tous,
je developpe une application ejb3,mais qund je demarre le serveur j'ai cette errers:
Mon ejb3 projet est:BaseHotele
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 05:20:16,157 WARN [WebServiceDeployerEJB] Ingore ejb deployment with null classname: org.jboss.metadata.ejb.jboss.JBossSessionBeanMetaData@8fd19516{HotelTestBean} 05:20:16,216 ERROR [ProfileServiceBootstrap] Failed to load profile: Summary of incomplete deployments (SEE PREVIOUS ERRORS FOR DETAILS): DEPLOYMENTS MISSING DEPENDENCIES: Deployment "jboss.j2ee:jar=BaseHotele.jar,name=HotelTestBean,service=EJB3" is missing the following dependencies: Dependency "<UNKNOWN jboss.j2ee:jar=BaseHotele.jar,name=HotelTestBean,service=EJB3>" (should be in state "Described", but is actually in state "** UNRESOLVED Demands 'persistence.unit:unitName=#BaseHotele' **") Deployment "persistence.unit:unitName=#BaseHotele" is missing the following dependencies: Dependency "jboss.jca:name=ejb3ProjectDS,service=DataSourceBinding" (should be in state "Create", but is actually in state "** NOT FOUND Depends on 'jboss.jca:name=ejb3ProjectDS,service=DataSourceBinding' **") DEPLOYMENTS IN ERROR: Deployment "<UNKNOWN jboss.j2ee:jar=BaseHotele.jar,name=HotelTestBean,service=EJB3>" is in error due to the following reason(s): ** UNRESOLVED Demands 'persistence.unit:unitName=#BaseHotele' ** Deployment "jboss.jca:name=ejb3ProjectDS,service=DataSourceBinding" is in error due to the following reason(s): ** NOT FOUND Depends on 'jboss.jca:name=ejb3ProjectDS,service=DataSourceBinding' ** 05:20:16,237 INFO [Http11Protocol] D�marrage de Coyote HTTP/1.1 sur http-127.0.0.1-8080 05:20:16,369 INFO [AjpProtocol] Starting Coyote AJP/1.3 on ajp-127.0.0.1-8009 05:20:16,376 INFO [ServerImpl] JBoss (Microcontainer) [5.0.1.GA (build: SVNTag=JBoss_5_0_1_GA date=200902231221)] Started in 46s:288ms
Mon persistence.xml:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14 <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_1_0.xsd" version="1.0"> <persistence-unit name="BaseHotele"> <jta-data-source>java:ejb3ProjectDS</jta-data-source> <properties> <property name="hibernate.dialect" value="org.hibernate.dialect.HSQLDialect"/> <property name="hibernate.hbm2ddl.auto" value="create-drop"/> </properties> </persistence-unit> </persistence>
Mon hsqlbd-ds.xml est:
Ma HotelTestBean est:
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115 <datasources> <local-tx-datasource> <!-- The jndi name of the DataSource, it is prefixed with java:/ --> <!-- Datasources are not available outside the virtual machine --> <jndi-name>ejb3ProjectDS</jndi-name> <!-- For server mode db, allowing other processes to use hsqldb over tcp. This requires the org.jboss.jdbc.HypersonicDatabase mbean. <connection-url>jdbc:hsqldb:hsql://${jboss.bind.address}:1701</connection-url> --> <!-- For totally in-memory db, not saved when jboss stops. The org.jboss.jdbc.HypersonicDatabase mbean is required for proper db shutdown <connection-url>jdbc:hsqldb:.</connection-url> --> <!-- For in-process persistent db, saved when jboss stops. The org.jboss.jdbc.HypersonicDatabase mbean is required for proper db shutdown --> <!-- <connection-url>jdbc:hsqldb:${jboss.server.data.dir}${/}hypersonic${/}localDB</connection-url--> <connection-url>jdbc:hsqldb:data/tutorial</connection-url> <!-- The driver class --> <driver-class>org.hsqldb.jdbcDriver</driver-class> <!-- The login and password --> <user-name>sa</user-name> <password></password> <!--example of how to specify class that determines if exception means connection should be destroyed --> <!--exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.DummyExceptionSorter</exception-sorter-class-name--> <!-- this will be run before a managed connection is removed from the pool for use by a client--> <!--<check-valid-connection-sql>select * from something</check-valid-connection-sql> --> <!-- The minimum connections in a pool/sub-pool. Pools are lazily constructed on first use --> <min-pool-size>5</min-pool-size> <!-- The maximum connections in a pool/sub-pool --> <max-pool-size>20</max-pool-size> <!-- The time before an unused connection is destroyed --> <!-- NOTE: This is the check period. It will be destroyed somewhere between 1x and 2x this timeout af ter last use --> <!-- TEMPORARY FIX! - Disable idle connection removal, HSQLDB has a problem with not reaping threads on closed connections --> <idle-timeout-minutes>0</idle-timeout-minutes> <!-- sql to call when connection is created <new-connection-sql>some arbitrary sql</new-connection-sql> --> <!-- sql to call on an existing pooled connection when it is obtained from pool <check-valid-connection-sql>some arbitrary sql</check-valid-connection-sql> --> <!-- example of how to specify a class that determines a connection is valid before it is handed out from the pool <valid-connection-checker-class-name>org.jboss.resource.adapter.jdbc.vendor.DummyValidConnectionChecker</valid-connection-checker-class-name> --> <!-- Whether to check all statements are closed when the connection is returned to the pool, this is a debugging feature that should be turned off in production --> <track-statements/> <!-- Use the getConnection(user, pw) for logins <application-managed-security/> --> <!-- Use the security domain defined in conf/login-config.xml --> <security-domain>HsqlDbRealm</security-domain> <!-- Use the security domain defined in conf/login-config.xml or the getConnection(user, pw) for logins. The security domain takes precedence. <security-domain-and-application>HsqlDbRealm</security-domain-and-application> --> <!-- HSQL DB benefits from prepared statement caching --> <prepared-statement-cache-size>32</prepared-statement-cache-size> <!-- corresponding type-mapping in the standardjbosscmp-jdbc.xml (optional) --> <metadata> <type-mapping>Hypersonic SQL</type-mapping> </metadata> <!-- When using in-process (standalone) mode --> <depends>jboss:service=Hypersonic,database=localDB</depends> <!-- Uncomment when using hsqldb in server mode <depends>jboss:service=Hypersonic</depends> --> </local-tx-datasource> <!-- Uncomment if you want hsqldb accessed over tcp (server mode) <mbean code="org.jboss.jdbc.HypersonicDatabase" name="jboss:service=Hypersonic"> <attribute name="Port">1701</attribute> <attribute name="BindAddress">${jboss.bind.address}</attribute> <attribute name="Silent">true</attribute> <attribute name="Database">default</attribute> <attribute name="Trace">false</attribute> <attribute name="No_system_exit">true</attribute> </mbean> --> <!-- For hsqldb accessed from jboss only, in-process (standalone) mode --> <mbean code="org.jboss.jdbc.HypersonicDatabase" name="jboss:service=Hypersonic,database=localDB"> <attribute name="Database">localDB</attribute> <attribute name="InProcessMode">true</attribute> </mbean> </datasources>
Mon HotelTestBeanLocal:
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 package de.laliluna.library; import javax.ejb.Stateless; import java.util.Iterator; import java.util.List; import javax.persistence.EntityManager; import javax.persistence.PersistenceContext; @Stateless public class HotelTestBean implements HotelTestBeanRemote ,HotelTestBeanLocal { @PersistenceContext EntityManager em; public static final String RemoteJNDIName = HotelTestBean.class.getSimpleName() + "/remote"; public static final String LocalJNDIName = HotelTestBean.class.getSimpleName() + "/local"; public void test() { Hotel hotel1 = new Hotel("pyramide",25,30); em.persist(hotel1); Hotel hotel2 = new Hotel("paradis",50,23); em.persist(hotel2); Hotel hotel3 = new Hotel("intercontinentale",78,19 ); em.persist(hotel3); System.out.println("list some Hotels"); List someHotels = em.createQuery("from Hotel b where b.nomHotel=:name").setParameter("name", "paradis").getResultList(); for (Iterator iter = someHotels.iterator(); iter.hasNext();) {Hotel element = (Hotel) iter.next(); System.out.println(element);} System.out.println("List all Hotels"); List allHotels = em.createQuery("from Hotel").getResultList(); for (Iterator iter = allHotels.iterator(); iter.hasNext();) {Hotel element = (Hotel) iter.next(); System.out.println(element);} System.out.println("delete a Hotel"); em.remove(hotel2); System.out.println("List all Hotels"); allHotels = em.createQuery("from Hotel").getResultList(); for (Iterator iter = allHotels.iterator(); iter.hasNext();) {Hotel element = (Hotel) iter.next(); System.out.println(element); } }}
HotelTestBeanRemote:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5 package de.laliluna.library; import javax.ejb.Local; @Local public interface HotelTestBeanLocal { public void test();}
[CODE
package de.laliluna.library;
import javax.ejb.Remote;
@Remote
public interface HotelTestBeanRemote {
public
[/CODE]
le ClientA:
jindi.xml
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 Code: package ClientBeans; import java.util.Iterator; import java.util.List; import java.util.Properties; import javax.naming.Context; import javax.naming.InitialContext; import javax.naming.NamingException; import javax.persistence.EntityManager; import javax.persistence.PersistenceContext; import de.laliluna.library.Hotel; import de.laliluna.library.HotelTestBean; import de.laliluna.library.HotelTestBeanRemote; public class ClientA { /** * @param args */ public static void main(String[] args) { try { Properties props = new Properties(); props.setProperty(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory"); props.setProperty
est ce qu'il me manque d'autre fichier xml!!
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4 java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces java.naming.provider
quelle est le probleme
Partager