Probleme Spring Hibernate
Salut,
Aprés avoir ajouter les fichiers de configuration de hibernate j'arrive plus a éxécuter mon formulaire depuis mon navigateur. Et comme je suis débutant j'arrive vraiment pas à trouver ou sa cloche.
voici l'erreur que je trouve ds le fichier log de tomcat
Code:
1 2 3 4
| ERROR [http-8081-Processor25] - 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.BeanCreationException: Error creating bean with name 'sessionFactory' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.FatalBeanException: Could not instantiate class [org.springframework.orm.hibernate3.LocalSessionFactoryBean]; constructor threw exception; nested exception is java.lang.NoClassDefFoundError: org.hibernate.cfg.Configuration
org.springframework.beans.FatalBeanException: Could not instantiate class [org.springframework.orm.hibernate3.LocalSessionFactoryBean]; constructor threw exception; nested exception is java.lang.NoClassDefFoundError: org.hibernate.cfg.Configuration
java.lang.NoClassDefFoundError: org.hibernate.cfg.Configuration |
Mes fichiers XML sont ci dessous
applicationContext.xml
Code:
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
| <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN"
"http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
<bean id="dataSource"
class="org.apache.commons.dbcp.BasicDataSource">
<property name="driverClassName">
<value>com.mysql.jdbc.Driver</value>
</property>
<property name="url">
<value>jdbc:mysql://localhost/dbpersonnes</value>
</property>
<property name="username"><value>root</value></property>
<property name="password"><value></value></property>
</bean>
<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource">
<ref local="dataSource"/>
</property>
<property name="mappingResources">
<list>
<value>org/ultimania/model/Personne.hbm.xml</value>
</list>
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">
org.hibernate.dialect.MySQLDialect
</prop>
<prop key="hibernate.show_sql">true</prop>
<prop key="hibernate.cglib.use_reflection_optimizer">false</prop>
</props>
</property>
</bean>
<bean id="myTransactionManager"
class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory">
<ref local="sessionFactory"/>
</property>
</bean>
<bean id="hibernateInterceptor" class="org.springframework.orm.hibernate3.HibernateInterceptor">
<property name="sessionFactory">
<ref bean="sessionFactory"/>
</property>
</bean>
<bean id="personneDao" class="istia.st.springmvc.personnes.dao.DaoImplCommon">
<property name="sessionFactory"><ref local="sessionFactory"/></property>
</bean>
</beans> |
le fichier qui gére la servlet
personnes-servlet.xml
Code:
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
|
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
<!-- les mappings de l'application-->
<bean class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
<property name="mappings">
<props>
<prop key="/list.html">Personnes.ListController</prop>
<prop key="/delete.html">Personnes.DeleteController</prop>
<prop key="/edit.html">Personnes.EditController</prop>
</props>
</property>
</bean>
<!-- LES CONTROLEURS -->
<bean id="Personnes.ListController"
class="istia.st.springmvc.personnes.web.ListPersonnes">
<property name="service">
<ref bean="service"/>
</property>
</bean>
<bean id="Personnes.DeleteController"
class="istia.st.springmvc.personnes.web.DeletePersonne">
<property name="service">
<ref bean="service"/>
</property>
</bean>
<bean id="Personnes.EditController"
class="istia.st.springmvc.personnes.web.EditPersonne">
<property name="sessionForm">
<value>true</value>
</property>
<property name="commandName">
<value>personne</value>
</property>
<property name="validator">
<ref bean="Personnes.Validator"/>
</property>
<property name="formView">
<value>edit</value>
</property>
<property name="service">
<ref bean="service"/>
</property>
</bean>
<!-- le validateur -->
<bean id="Personnes.Validator"
class="istia.st.springmvc.personnes.web.ValidatePersonne"/>
<!-- le résolveur de vues -->
<bean class="org.springframework.web.servlet.view.ResourceBundleViewResolver">
<property name="basename">
<value>vues</value>
</property>
</bean>
<!-- le gestionnaire d'exceptions -->
<bean
class="org.springframework.web.servlet.handler.SimpleMappingExceptionResolver">
<property name="exceptionAttribute">
<value>exception</value>
</property>
<property name="defaultStatusCode">
<value>200</value>
</property>
<property name="defaultErrorView">
<value>exception</value>
</property>
</bean>
<!-- le fichier des messages -->
<bean id="messageSource" class="org.springframework.context.support.ResourceBundleMessageSource">
<property name="basename">
<value>messages</value>
</property>
</bean>
</beans> |
Alors je tiens à préciser que tous se code je l'ai pris par ci par là, donc je connais pas exactement à koi correspond chaque ligne du code (Pourtant j'ai fait le tuto de serge tahé les 5 parties qui d'ailleurs tres bien).
Ce que jej veux faire : je veux éxécuter le formulaire list.html qui contient une table remplie depuis la BD
Merci de votre aide