Bonjour à tous :salut:
Je suis en train de configurer le context de mon application web sur serveur j2EE. J'utilise aussi Maven pour mes builds.
J'ai donc différents projets (service-metier-webapp) et j'ai un souci de context au niveau de ma webapp.
Voici l'erreur (qui semble être basique -_-) (oui je me forme ; ) )
J'ai bien compris l'erreur qui stipule qu'il ne trouve mon bean nomé "contextEchange" !!Citation:
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 return specified BeanFactory instance: factory key [contextEchange], from group with resource name [classpath*:src/main/resources/beanRefContext.xml]; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'contextEchange' is defined
Hors il est bien présent dans mon fichier beanRefContext !
Voici le Web.Xml il est présent dans src/main/webapp/WEB-INF (simple dossier sous-jacent)
et le fichier beanRefContext.xml situé dans src/main/resources/ qui est un folder buildPathCode:
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 <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd"> <web-app> <display-name>WebappEchangeDynamic</display-name> <description>BlazeDS Application</description> <context-param> <param-name>flex.class.path</param-name> <param-value>/WEB-INF/flex/hotfixes,/WEB-INF/flex/jars</param-value> </context-param> <!-- Ajout du context Spring --> <context-param> <param-name>contextConfigLocation</param-name> <param-value>/WEB-INF/applicationContext.xml</param-value> </context-param> <!-- Localisation des fichier de context de l'application --> <context-param> <param-name>locatorFactorySelector</param-name> <param-value>src/main/resources/beanRefContext.xml</param-value> </context-param> <context-param> <param-name>parentContextKey</param-name> <param-value>contextEchange</param-value> </context-param> <filter> <filter-name>encoding-filter</filter-name> <filter-class> org.springframework.web.filter.CharacterEncodingFilter </filter-class> <init-param> <param-name>encoding</param-name> <param-value>UTF-8</param-value> </init-param> </filter> <filter-mapping> <filter-name>encoding-filter</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> <!-- Http Flex Session attribute and binding listener support --> <listener> <listener-class>flex.messaging.HttpFlexSession</listener-class> </listener> <!-- Ajout du listener lier à Spring --> <listener> <listener-class> org.springframework.web.context.ContextLoaderListener </listener-class> </listener> <!-- MessageBroker Servlet --> <!-- à modifier pour faire mapping avec spring --> <servlet> <servlet-name>MessageBrokerServlet</servlet-name> <display-name>MessageBrokerServlet</display-name> <servlet-class>flex.messaging.MessageBrokerServlet</servlet-class> <init-param> <param-name>services.configuration.file</param-name> <!-- <param-value>/WEB-INF/flex/services-config.xml</param-value> --> <param-value>/WEB-INF/flex-servlet-context</param-value> </init-param> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>MessageBrokerServlet</servlet-name> <url-pattern>/messagebroker/*</url-pattern> </servlet-mapping> <welcome-file-list> <welcome-file>index.html</welcome-file> <welcome-file>index.htm</welcome-file> </welcome-file-list> <!-- for WebSphere deployment, please uncomment --> <!-- <resource-ref> <description>Flex Messaging WorkManager</description> <res-ref-name>wm/MessagingWorkManager</res-ref-name> <res-type>com.ibm.websphere.asynchbeans.WorkManager</res-type> <res-auth>Container</res-auth> <res-sharing-scope>Shareable</res-sharing-scope> </resource-ref> --> </web-app>
D'autant plus que, si je modifie :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 <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd"> <beans> <bean name="contextEchange" class="org.springframework.context.support.ClassPathXmlApplicationContext" lazy-init="false" > <constructor-arg> <list> <value>classpath:contextModele.xml</value> <value>classpath:contextService.xml</value> <!-- <value>classpath:contextFacade.xml</value>--> <value>classpath:hibernate.cfg.xml</value> </list> </constructor-arg> </bean> <!-- <bean id="facade" class="com.teamlog.rosebud2.facade.Facade"> <property name="servicePersonne" ref="ServicePersonne"/> </bean> --> </beans>
parCode:<param-value>src/main/resources/beanRefContext.xml</param-value>
J'ai une erreur IO fichier introuvable :s (je pense du coup que cela me générera d'autre erreur ensuite...)Code:<param-value>classpath:beanRefContext.xml</param-value>
classpath de la webapp :
Mon fichier applicationContext est vide !Code:
1
2
3
4
5
6
7
8
9
10
11 <classpath> <classpathentry excluding="**" kind="src" output="target/classes" path="target/generated-resources"/> <classpathentry kind="src" path="src.main.java"/> <classpathentry kind="src" path="src.main.resources"/> <classpathentry kind="src" path="src.mai.t"/> <classpathentry kind="src" path="src.main.ressources"/> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> <classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/> <classpathentry kind="output" path="target/classes"/> </classpath>
Pourquoi donc ce bean n'est reconnu ?