Bonjour,
j'utilise Spring 3.0.0, JPA 2 avec un serveur Tomcat 6.0.18 et j'ai paramétré mon fichier /WEB-INF/applicationContext.xml afin que Spring utilise les annotations et injecte l'entityManager.
Mais lorsque je deploie mon application en utilisant Maven la console m'affiche :

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
 
31 mars 2010 17:04:23 org.apache.jk.common.ChannelSocket init
INFO: JK: ajp13 listening on /0.0.0.0:8009
31 mars 2010 17:04:23 org.apache.jk.server.JkMain start
INFO: Jk running ID=0 time=0/31  config=null
31 mars 2010 17:04:23 org.apache.catalina.startup.Catalina start
INFO: Server startup in 4759 ms
31 mars 2010 17:04:44 org.apache.catalina.startup.HostConfig deployWAR
INFO: D�ploiement de l'archive reservationhotelliere.war de l'application web
31 mars 2010 17:04:50 com.sun.faces.config.ConfigureListener contextInitialized
INFO: Initializing Mojarra (1.2_12-b01-FCS) for context '/reservationhotelliere'
log4j:WARN No appenders could be found for logger (org.ajax4jsf.renderkit.ChameleonRenderKitFactory).
log4j:WARN Please initialize the log4j system properly.
31 mars 2010 17:04:54 org.apache.catalina.core.ApplicationContext log
INFO: Initializing Spring root WebApplicationContext
voilà mon applicationContext.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
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
 
<?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:context="http://www.springframework.org/schema/context"
	xmlns:tx="http://www.springframework.org/schema/tx"
	xmlns:p="http://www.springframework.org/schema/p"
	xmlns:aop="http://www.springframework.org/schema/aop"
	xsi:schemaLocation="http://www.springframework.org/schema/beans
						http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
						http://www.springframework.org/schema/context
						http://www.springframework.org/schema/context/spring-context-3.0.xsd
						http://www.springframework.org/schema/tx
						http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
						http://www.springframework.org/schema/aop
						http://www.springframework.org/schema/aop/spring-aop-3.0.xsd">
 
	<!-- holding properties for database connectivity /-->
	<context:component-scan base-package="com.bgi" />
	<context:property-placeholder location="classpath:jdbc.properties"/>
 
	<!-- enabling annotation driven configuration /-->
	<context:annotation-config />
 
	<tx:annotation-driven transaction-manager="transactionManager" />
 
	<bean
		class="org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor" />
 
	<bean id="entityManagerFactory"
		class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean"
		p:dataSource-ref="dataSource"
		p:jpaVendorAdapter-ref="jpaAdapter">
		<property name="loadTimeWeaver">
			<bean
				class="org.springframework.instrument.classloading.InstrumentationLoadTimeWeaver" />
		</property>
		<property name="persistenceUnitName" value="reservationPU"></property>
	</bean>
 
	<bean id="dataSource"
		class="org.springframework.jdbc.datasource.DriverManagerDataSource"
		p:driverClassName="oracle.jdbc.driver.OracleDriver"
		p:url="jdbc:oracle:thin:@192.168.1.87:1521:BGIBD"
		p:username="resrevation"
		p:password="resrevation" />
 
	<bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager"
		p:entityManagerFactory-ref="entityManagerFactory" />
 
	<bean id="jpaAdapter"
		class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter"
		p:database="ORACLE"
		p:databasePlatform="org.hibernate.dialect.OracleDialect"
		p:generateDdl="true"
		p:showSql="true" />
</beans>
j'ai pas compris pourquoi ça ne fonctionne pas !
Merci de votre Aide.