Bonjour, je débute avec Spring.

Voici la class ProduitImpl.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
package dao;
 
import java.util.ArrayList;
import java.util.List;
 
public class ProduitImpl implements ProduitDAO{
 
	private List<Produit> produits = new ArrayList<Produit>();
 
	public void init(){
 
		System.out.println("www.sybaway.com");
	}
 
	public void addProduit(Produit p) {
 
		p.setIdProduit(new Long (produits.size() + 1) );
		produits.add(p);
 
	}
 
	public void deleteProduit(Long id) {
 
		for(Produit p: produits){
 
			if(p.getIdProduit().equals(id)){
			produits.remove(p);
			break;
			}
		}	
	}
 
	public Produit getProduitById(Long id) {
 
		Produit produit = null;
		for(Produit p: produits){
			if(p.getIdProduit().equals(id)){
			produit = p;
			break;
			}
		}
		return produit;
	}
 
	public List<Produit> getAllProduits() {
 
		return produits;
	}
 
	public void updateProduit(Produit p) {
 
 
	}
 
}
La classe ProduitImplMetier.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
package services;
 
import java.util.List;
 
import dao.Produit;
import dao.ProduitDAO;
 
public class ProduitImplMetier implements ProduitMetier{
 
	private ProduitDAO dao;
 
	public void addProduit(Produit p) {
		dao.addProduit(p);
 
	}
 
	public void deleteProduit(Long id) {
		dao.deleteProduit(id);
 
	}
 
	public List<Produit> getAllProduits() {
 
		return dao.getAllProduits();
	}
 
	public Produit getProduitById(Long id) {
 
		return dao.getProduitById(id);
	}
 
	public void setDao(ProduitDAO dao) {
		this.dao = dao;
	}
 
}
et enfin mon fichier spring-beans.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
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:tx="http://www.springframework.org/schema/tx"
    xmlns:context="http://www.springframework.org/schema/context"
    xsi:schemaLocation="http://www.springframework.org/schema/beans
              <a href="http://www.springframework.org/schema/beans/spring-beans-2.5.xsd" target="_blank">http://www.springframework.org/schem...-beans-2.5.xsd</a>
              <a href="http://www.springframework.org/schema/tx" target="_blank">http://www.springframework.org/schema/tx</a>
              <a href="http://www.springframework.org/schema/tx/spring-tx-2.5.xsd" target="_blank">http://www.springframework.org/schem...ing-tx-2.5.xsd</a>
              <a href="http://www.springframework.org/schema/context" target="_blank">http://www.springframework.org/schema/context</a>
              http://www.springframework.org/schema/context/spring-context-2.5.xsd">
 
 <bean class="dao.ProduitImpl" id="sybawayDAO" init-method="init" ></bean>
 <bean class="services.ProduitImplMetier"  id="sybawayServices">
 	<property name="dao" ref="sybawayDAO" ></property>
 </bean>	
 
 </beans>
J'ai une exception disant que :
GRAVE: Exception lors de l'envoi de l'évènement contexte initialisé (context initialized) à l'instance de classe d'écoute (listener) org.springframework.web.context.ContextLoaderListener
org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [dao.ProduitImpl] for bean with name 'sybawayDAO' defined in ServletContext resource [/WEB-INF/spring-beans.xml]; nested exception is java.lang.ClassNotFoundException: dao.ProduitImpl
at org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1208)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.predictBeanType(AbstractAutowireCapableBeanFactory.java:568)
at org.springframework.beans.factory.support.AbstractBeanFactory.isFactoryBean(AbstractBeanFactory.java:1277)
at org.springframework.beans.factory.support.AbstractBeanFactory.isFactoryBean(AbstractBeanFactory.java:844)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:539)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:842)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:416)
at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:261)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:192)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4206)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4705)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1057)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:840)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1057)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:463)
at org.apache.catalina.core.StandardService.start(StandardService.java:525)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:754)
at org.apache.catalina.startup.Catalina.start(Catalina.java:595)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
Caused by: java.lang.ClassNotFoundException: dao.ProduitImpl
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1680)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1526)
at org.springframework.util.ClassUtils.forName(ClassUtils.java:258)
at org.springframework.beans.factory.support.AbstractBeanDefinition.resolveBeanClass(AbstractBeanDefinition.java:408)
at org.springframework.beans.factory.support.AbstractBeanFactory.doResolveBeanClass(AbstractBeanFactory.java:1229)
at org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1200)
... 24 more
17 févr. 2014 21:06:32 org.apache.catalina.core.StandardContext start
GRAVE: Error listenerStart
17 févr. 2014 21:06:32 org.apache.catalina.core.StandardContext start
GRAVE: Erreur de démarrage du contexte [/GestionProduitSpringHibernateSybaway] suite aux erreurs précédentes
17 févr. 2014 21:06:32 org.apache.catalina.core.ApplicationContext log
INFO: Closing Spring root WebApplicationContext
17 févr. 2014 21:06:32 org.apache.coyote.http11.Http11Protocol start
INFO: Démarrage de Coyote HTTP/1.1 sur http-8080
17 févr. 2014 21:06:32 org.apache.jk.common.ChannelSocket init
INFO: JK: ajp13 listening on /0.0.0.0:8009
17 févr. 2014 21:06:32 org.apache.jk.server.JkMain start
INFO: Jk running ID=0 time=0/23 config=null
17 févr. 2014 21:06:32 org.apache.catalina.startup.Catalina start
INFO: Server startup in 803 ms
Merci d'avance.