org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing X
Hello,
J ai un petit soucie dans une application de test, je cherche a loadé l'application context mais il ne le trouve pas
voici mon code
Code:
1 2 3 4 5 6 7 8
|
ClassPathXmlApplicationContext appContext = new ClassPathXmlApplicationContext("WEB-INF\\applicationContext.xml");
AccountTypeDbDAO dao = AccountTypeDbDAO.getFromApplicationContext(appContext);
List<AccountTypeFrDb> list = dao.findByExample(null);
for (int i = 0; i < list.size(); i++) {
out.println(list.get(i).getText());
} |
j ai essayé plusieurs path donc juste "applicationContext" mais rien n'y fait
merci
edit également testé WEB-INF/applicationContext.xml marche pas non plus
également testé
Code:
1 2
|
AccountTypeDbDAO dao = (AccountTypeDbDAO) RequestContextUtils.getWebApplicationContext(request).getBean("AccountTypeDbDAO"); |
mais la j obtiens java.lang.IllegalStateException: No WebApplicationContext found: not in a DispatcherServlet request?
mon web.xml contient
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
|
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.4"
xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<!-- Spring -->
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/applicationContext.xml</param-value>
</context-param>
<servlet>
<servlet-name>SpringContextServlet</servlet-name>
<servlet-class>org.springframework.web.context.ContextLoaderServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet>
<description>This is the description of my J2EE component</description>
<display-name>This is the display name of my J2EE component</display-name>
<servlet-name>TestServlet</servlet-name>
<servlet-class>TestServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>TestServlet</servlet-name>
<url-pattern>/servlet/TestServlet</url-pattern>
</servlet-mapping>
</web-app> |