Erreur Beans NoClassDefFoundError
Bonjour à tous,
Je débute en spring (important de le noté !) et suis sur un problème depuis un certain moment et n'en comprend celle-ci !!
L'erreur ce situe dans mon fichier context.xml (le context de spring de mon module modele).
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 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 116 117 118 119 120 121 122 123 124
|
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
<!-- Application context DAO layer -->
<beans>
<!-- ***********************
** Beans Service **
************************ -->
<!-- General -->
<bean id="continentDao" class="dao.nasch.ville.impl.ContinentGeonamesHome">
<property name="hibernateTemplate">
<ref bean="hibernateTemplate"/>
</property>
<property name="sessionFactory">
<ref bean="sessionFactory" />
</property>
</bean>
<!-- ***************************
** TransactionManager **
***************************** -->
<!-- Gestions des Transactions BDD -->
<!-- Définition du proxy général abstrait de manière globale à l'application -->
<bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory"/>
</bean>
<!-- ****************************
** TransactionProxy **
***************************** -->
<bean id="transactionProxy" abstract="true"
class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
<property name="transactionManager">
<ref bean="transactionManager"/>
</property>
<property name="transactionAttributes">
<props>
<prop key="insert*">PROPAGATION_REQUIRED</prop>
<prop key="update*">PROPAGATION_REQUIRED</prop>
<prop key="save*">PROPAGATION_REQUIRED</prop>
<prop key="*">PROPAGATION_REQUIRED, readOnly</prop>
</props>
</property>
</bean>
<!-- ***********************
** BDD DataSource **
************************ -->
<bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName">
<value>com.mysql.jdbc.Driver</value>
</property>
<property name="url">
<value>jdbc:mysql://localhost:3306/villesdumonde</value>
</property>
<property name="username">
<value>****</value>
</property>
<property name="password">
<value>****</value>
</property>
</bean>
<!-- ***************
** Connection **
**************** -->
<bean id="myHibernateProperties"
class="org.springframework.beans.factory.config.PropertiesFactoryBean">
<property name="properties">
<props>
<prop key="hibernate.dialect">
org.hibernate.dialect.MySQLDialect
</prop>
<prop key="hibernate.show_sql">true</prop>
<prop key="hibernate.use_outer_join">true</prop>
</props>
</property>
</bean>
<!-- ***********************
** SessionFactory **
************************ -->
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
<property name="hibernateProperties">
<ref bean="myHibernateProperties"/>
</property>
<property name="dataSource">
<ref bean="dataSource"/>
</property>
<!-- <property name="mappingResources">
<list>
<value>Personne.hbm.xml</value>
</list>
</property> -->
</bean>
<!-- ***********************
** JBDC Exception **
************************ -->
<bean id="jdbcExceptionTranslator" class="org.springframework.jdbc.support.SQLExceptionTranslator">
<property name="dataSource">
<ref bean="dataSource"/>
</property>
</bean>
<!-- ****************************
** Hibernate Template **
**************************** -->
<bean
id="hibernateTemplate" class="org.springframework.orm.hibernate3.HibernateTemplate">
<property name="sessionFactory">
<ref bean="sessionFactory"/>
</property>
<property name="jdbcExceptionTranslator">
<ref bean="jdbcExceptionTranslator"/>
</property>
</bean>
</beans> |
Lors de l'initialisation du bean "sessionFactory",celui m'indique l'erreur suivante
Code:
1 2 3 4
|
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.access.BootstrapException: Unable to initialize group definition. Group resource name [classpath*:./lesContexts.xml], factory key [contextEchange]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'contextEchange' defined in URL [file:/C:/Documents%20and%20Settings/cedric/workspaceF3/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/WebappEchangeDynamic/WEB-INF/classes/lesContexts.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.springframework.context.support.ClassPathXmlApplicationContext]: Constructor threw exception; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'continentDao' defined in class path resource [contextModele.xml]: Cannot resolve reference to bean 'hibernateTemplate' while setting bean property 'hibernateTemplate'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'hibernateTemplate' defined in class path resource [contextModele.xml]: Cannot resolve reference to bean 'sessionFactory' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [contextModele.xml]: Initialization of bean failed; nested exception is java.lang.NoClassDefFoundError: org/springframework/jdbc/support/SQLExceptionTranslator
at org.springframework.beans.factory.access.SingletonBeanFactoryLocator.useBeanFactory(SingletonBeanFactoryLocator.java:389) |
Hors, je dispose bien des modules *.jar de spring dont org.springframework.jdbc-3.0.0.RC1.jar , donc pourquoi ne me trouve-t-il pas ma classe SQLExceptionTranslator ?
Je suis preneur de toute idée : ) (ainsi que tout autre subtilité de performance) !
ps : j'aimerais avoir votre avis ! Est il plus judicieux , dans notre beans "jdbcExceptionTranslator" d'utiliser "org.springframework.jdbc.support.SQLExceptionTranslator" ou
org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator ?
De meme pour notre sessionFactory
org.springframework.orm.hibernate3.LocalSessionFactoryBean ou
org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean
J'utilise les annotations jpa/hibernate3 et des ejb3 au dessus.