1 pièce(s) jointe(s)
[Tutoriel Serge Tahé] Problème avec le spring-config.xml
Bonjour,
je suis en train de suivre l'excellent tuto de Serge Tahé "Persistance Java 5 par la pratique".
J'ai pu suivre les premières parties sur les entités JPA sans trop de problème et j'en suis à ce qui m'intéresse réellement : l'utilisation de JPA dans une architecture multicouche.
Mon problème arrive à la configuration des couches, notamment avec le fichier spring-config.xml suivant :
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
| <?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"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd">
<!-- Couches applicatives -->
<bean id="dao" class="dao.Dao"/>
<bean id="service" class="service.Service">
<property name="dao" ref="dao" />
</bean>
<!-- Couche de persistance JPA -->
<bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalEntityManagerFactoryBean">
<property name="dataSource" ref="dataSource" />
<property name="jpaVendorAdaptater">
<bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
<!--
<property name="showSql" value="true"/>
-->
<property name="databasePlatform" value="org.hibernate.dialect.MySQL5InnoDBDialect"/>
<property name="generateDdl" value="true"/>
</bean>
</property>
<property name="loadTimeWeaver">
<bean class="org.springframework.instrument.classloading.InstrumentationLoadTimeWeaver"/>
</property>
</bean>
<!-- la source de données DBCP -->
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
<property name="driverClassName" value="com.mysql.jdbc.Driver"/>
<property name="url" value="jdbc:mysql://localhost:3306/jpa" />
<property name="username" value="jpa" />
<property name="password" value="jpa" />
</bean>
<!-- Le gestionnaire de transaction -->
<tx:annotation-driven transaction-manager="txManager"/>
<bean id="txManager" class="org.springframework.orm.jpa.JpaTransactionManager">
<property name="entityManagerFactory" ref="entityManagerFactory"/>
</bean>
<!-- Traduction des exceptions -->
<bean class="org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor" />
<!-- annotations de persistance -->
<bean class="org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor"/>
</beans> |
J'ai vérifié plusieurs fois, bien que retapé à la main pour bien comprendre l'ensemble, ce fichier correspond bien à celui du tuto.
Sauf que ce fichier génère trois erreurs :
Code:
1 2 3
| No setter found for property 'dataSource' in class 'org.springframework.orm.jpa.LocalEntityManagerFactoryBean' spring-config.xml /tuto_JPA-spring1/src line 17 Spring Beans Problem
No setter found for property 'jpaVendorAdaptater' in class 'org.springframework.orm.jpa.LocalEntityManagerFactoryBean' spring-config.xml /tuto_JPA-spring1/src line 18 Spring Beans Problem
No setter found for property 'loadTimeWeaver' in class 'org.springframework.orm.jpa.LocalEntityManagerFactoryBean' spring-config.xml /tuto_JPA-spring1/src line 27 Spring Beans Problem |
Mes recherches sur le web n'ont pas été franchement fructueuses : j'ai trouvé quelques problèmes similaires mais sans trouver de solution...
voici l'arborescence du projet :
http://www.developpez.net/forums/att...to_spring.png/
manque-t-il un jar pour que tout marche bien? j'ai bien ceux correspondants au tuto de serge Tahé, mais avec les nouvelles version peut-être me manque-t-il une dépendance?
Toute aide serait la bienvenue, merci d'avance :mrgreen:
probleme de configuration web.xml
je suis en train de suivre l'excellent tuto de dghais jihed intitulé "Développement des applications Web avec Spring, hibernate et Richfaces". (http://dghaies-jihed.developpez.com/javaee/spring/)mais malheuresement aprés avoire effectué les configurations de base dans le fichier " applicationContext.xml" j'ai pas pu déclarer les configurations liées à l'utilisation de spring dans le descripteur de déploiement web.xml.
j'ai remarqué que dés que je met:
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
le serveur ne peut pas deployer l'application et de plus, quand je crée un faces-config l'application ne sera pas deployé aussi.
svp j'ai besoin d'aide car je suis entrain de préparer mon pfe et merci d'avance