voila ...
je dois commencer un projet utilisant le framework spring( base de donnée Mysql et orm Hibernate)... ni une ni deux je me mets dessus ....
je crée une appli ( simplissime) qui enregistre une personne dans ma base ( id, nom,prenom ...effectivement c est simple...)
je lance mon appli web et voila l erreur ( sinon je ne serais pas là..!!):
je ne comprends pas ce qu il veut dire !!! ou du moins je comprends mal... car si le probleme est qu 'il ne trouve pas la classe ""org/hibernate/HibernateException"" alors je dis stop ( puisqu'elle y est belle bien)..org.springframework.beans.factory.BeanDefinitionStoreException: Error registering bean with name 'personneDao' defined in ServletContext resource [/WEB-INF/Z8-servlet.xml]: Class that bean class [dao.PersonneDaoImpl] depends on not found; nested exception is java.lang.NoClassDefFoundError: org/hibernate/HibernateException
si quelqu'un à une piste ...
merci a vous tous ...
supertunar... a tunar with no tune!!
voici mes sources:
Z8-servlet:
Code xml : 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 <!-- sessionFactory --> <bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"> <property name="configLocation"> <value>classpath:hibernate.cfg.xml</value> </property> <property name="configurationClass"> <value>org.hibernate.cfg.AnnotationConfiguration</value> </property> </bean> <!-- General --> <bean id="personneDao" class="dao.PersonneDaoImpl"> <property name="sessionFactory"> <ref local="sessionFactory" /> </property> </bean> <!-- metier --> <bean id="personneMetier" class="metier.PersonneMetierImpl"> <property name="personneDao"> <ref local="personneDao" /> </property> </bean> <!-- les mappings de l'application--> <bean class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping"> <property name="mappings"> <props> <prop key="formulaire.html">FormulaireController</prop> </props> </property> </bean> <!-- les contrôleurs de l'application--> <bean id="FormulaireController" class="controller.FormulaireController"> <property name="personneMetier"> <ref local="personneMetier" /> </property> <property name="sessionForm"> <value>true</value> </property> <property name="commandClass"> <value>vue.Formulaire</value> </property> <property name="commandName"> <value>formulaire</value> </property> <property name="formView"> <value>formulaire</value> </property> <property name="successView"> <value>confirmation</value> </property> </bean> <!-- le résolveur de vues --> <bean class="org.springframework.web.servlet.view.BeanNameViewResolver"/> <bean id="formulaire" class="org.springframework.web.servlet.view.JstlView"> <property name="url"> <value>formulaire.jsp</value> </property> </bean> <bean id="confirmation" class="org.springframework.web.servlet.view.JstlView"> <property name="url"> <value>confirmation.jsp</value> </property> </bean> <bean id="index" class="org.springframework.web.servlet.view.JstlView"> <property name="url"> <value>index.jsp</value> </property> </bean> </beans>
ma classe PersonneDaoImpl:
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 package dao; import modele.Personne; import org.springframework.orm.hibernate3.support.HibernateDaoSupport; import org.hibernate.HibernateException; import org.hibernate.cfg.Configuration; import org.hibernate.classic.Session; import org.hibernate.exception.NestableRuntimeException; public class PersonneDaoImpl extends HibernateDaoSupport implements PersonneDao { @Override public void InsertPersonne(Personne personne) { try { Session session = getHibernateTemplate().getSessionFactory().getCurrentSession(); session.save(personne); session.flush(); session.close(); } catch(HibernateException e1){} catch (NestableRuntimeException e2) {} } }
Partager