Bonjour à tous,
Je developpe une application Java / J2ee avec le framework JPA que je découvre, et j'ai un message d'erreur qui est :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
 
Error 500: javax.servlet.ServletException: <openjpa-1.2.1-SNAPSHOT-r422266:686069 fatal user error> org.apache.openjpa.persistence.ArgumentException: Un nom de classe de source de données ou de pilote JDBC doit être défini dans la propriété ConnectionDriverName.

Mon application contient le framework Strtus, j'ai voulu testé tout simplement,
dans mon Action, l'appel d'une entité :

CreateUserAction.java
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
 
public class CreateUserAction extends Action
 
{
 
    public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response)
            throws Exception {
 
        ActionMessages errors = new ActionMessages();
        ActionForward forward = new ActionForward(); // return value
 
    	CountryManager test = new CountryManager();
   	 test.getCountryName();
 
        // Finish with
        return (forward);
 
    }
}
Ma classe CountryManager.java
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
public class CountryManager {
 
	public class CountryNameResult {
		private int countryId;
		private String countryName;
		private Imt imtId;
 
		public CountryNameResult() {
		}
 
		public CountryNameResult(int countryId, String countryName, Imt imtId) {
			this.countryId = countryId;
			this.countryName = countryName;
			this.imtId = imtId;
		}
 
		public int getcountryId() {
			return countryId;
		}
 
		public void setcountryId(int countryId) {
			this.countryId = countryId;
		}
 
		public String getcountryName() {
			return countryName;
		}
 
		public void setcountryName(String countryName) {
			this.countryName = countryName;
		}
 
		public Imt getimtId() {
			return imtId;
		}
 
		public void setimtId(Imt imtId) {
			this.imtId = imtId;
		}
	}
 
	private EntityManagerFactory emf;
 
	public CountryManager() {
 
	}
 
	public CountryManager(EntityManagerFactory emf) {
		this.emf = emf;
	}
 
	public void setEntityManagerFactory(EntityManagerFactory emf) {
		this.emf = emf;
	}
	@NamedQueryTarget("getCountryName")
	public List<CountryNameResult> getCountryName() {
	//	EntityManager em = getEntityManager();
		System.out.println("========> getCountryName 1 ...");
		 EntityManagerFactory emf = Persistence.createEntityManagerFactory("Project_DemoCenter");
		 System.out.println("========> getCountryName 2 ...");
		 // récupérer un EntityManagerFactory à partir de l'unité de persistance
			 EntityManager em = emf.createEntityManager();
			 System.out.println("========> getCountryName 3 ...");
			 // début transaction
		 EntityTransaction tx = em.getTransaction();
			 System.out.println("========> getCountryName 4 ...");
			 tx.begin();
			 System.out.println("========> getCountryName 5 ...");
		List<CountryNameResult> results = new ArrayList<CountryNameResult>();
		try {
			Query query = em.createNamedQuery("getCountryName");
			List<Object[]> multipleResults = (List<Object[]>) query
					.getResultList();
			for (Object[] result : multipleResults) {
				results.add(new CountryNameResult((Integer) result[0],
						(String) result[1], (Imt) result[2]));
			}
		} finally {
			em.close();
		}
		return results;
	} 
 }
Et mon fichier 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
15
16
17
18
19
20
21
22
23
24
25
26
27
28
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="1.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_1_0.xsd">
	<persistence-unit name="Project_DemoCenter">
		<jta-data-source>java:comp/env/Connect_DEMO_DB</jta-data-source>
		<class>com.ibm.db.Brand</class>
		<class>com.ibm.db.Category</class>
		<class>com.ibm.db.Country</class>
		<class>com.ibm.db.Demo</class>
		<class>com.ibm.db.DocumentaryType</class>
		<class>com.ibm.db.Hardware</class>
		<class>com.ibm.db.Imt</class>
		<class>com.ibm.db.Iot</class>
		<class>com.ibm.db.MinimalTime</class>
		<class>com.ibm.db.News</class>
		<class>com.ibm.db.Request</class>
		<class>com.ibm.db.RequestType</class>
		<class>com.ibm.db.Scenario</class>
		<class>com.ibm.db.Software</class>
		<class>com.ibm.db.SubCategory</class>
		<class>com.ibm.db.TimeZone</class>
		<class>com.ibm.db.Unaccess</class>
		<class>com.ibm.db.User</class>
		<class>com.ibm.db.UserRole</class>
		<properties>
			<property name="openjpa.jdbc.Schema" value="DEMO_DB"/>
		</properties>
	</persistence-unit>
</persistence>
Mon message d'erreur entier le voici :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
 
[31/05/10 11:44:32:546 CEST] 0000001a ComposableReq I org.apache.struts.chain.ComposableRequestProcessor init Initializing composable request processor for module prefix ''
[31/05/10 11:44:32:609 CEST] 0000001a servlet       I com.ibm.ws.webcontainer.servlet.ServletWrapper init SRVE0242I: [web2ProjectEAR] [/Project_DemoCenter] [/portailDemoCenter.jsp] : L'initialisation a abouti.
[31/05/10 11:44:44:703 CEST] 0000001a CreateAction  I org.apache.struts.chain.commands.servlet.CreateAction createAction Initialize action of type: com.ibm.project_democenter.actions.CreateUserAction
[31/05/10 11:44:44:718 CEST] 0000001a SystemOut     O ========> getCountryName 1 ...
[31/05/10 11:44:44:734 CEST] 0000001a SystemOut     O ========> getCountryName 2 ...
[31/05/10 16:10:28:109 CEST] 0000009a SystemOut     O 0  Project_DemoCenter  INFO   [WebContainer : 0] openjpa.Runtime - Démarrage d'OpenJPA 1.2.1-SNAPSHOT
[31/05/10 16:10:28:109 CEST] 0000009a Helpers       W   NMSV0612W: A NameNotFoundException occurred on an indirect lookup on the name "java:comp/env/Connect_DEMO_DB". The name "java:comp/env/Connect_DEMO_DB" maps to a JNDI name in deployment descriptor bindings for the application performing the JNDI lookup. Make sure that the JNDI name mapping in the deployment descriptor binding is correct. If the JNDI name mapping is correct, make sure the target resource can be resolved with the specified name relative to the default initial context. NameNotFoundException data follows:
javax.naming.NameNotFoundException: Context: PC-180Node01Cell/nodes/PC-180Node01/servers/server1, name: jdbc/Connect_DEMO_DB: First component in name Connect_DEMO_DB not found. [Root exception is org.omg.CosNaming.NamingContextPackage.NotFound: IDL:omg.org/CosNaming/NamingContext/NotFound:1.0]
	at com.ibm.ws.naming.jndicos.CNContextImpl.mapNotFoundException(CNContextImpl.java:4360)
	at com.ibm.ws.naming.jndicos.CNContextImpl.doLookup(CNContextImpl.java:1793)
	at com.ibm.ws.naming.jndicos.CNContextImpl.doLookup(CNContextImpl.java:1748)
	at com.ibm.ws.naming.jndicos.CNContextImpl.lookupExt(CNContextImpl.java:1499)
	at com.ibm.ws.naming.jndicos.CNContextImpl.lookupExt(CNContextImpl.java:1537)
J'ai beau avoir mis les bons drivers pour une connection sur une base DB2 (driver db2jcc.jar et db2jcc_license_cu.jar), j'ai ce message !

Merci d'avance pour votre aide....pour déboguer mon appli