Parsing XML Document From Servletcontext Resource Solved
parsing xml document from servletcontext resource getting a few errors in the console which I will post below. I am using eclipse and cleaned the project, refreshed the target, cleaned the tomcat server so chasing or anything of that nature is not the issue.
if you want to just load the files using ContextLoaderListener, remove the dispatcher servlet and that should work fine or use the below method to load the final.
Issue
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
id="WebApp_ID" version="3.0">
<display-name>Spring_Project</display-name>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
<welcome-file>default.html</welcome-file>
<welcome-file>default.htm</welcome-file>
<welcome-file>default.jsp</welcome-file>
</welcome-file-list>
<servlet>
<description>offers</description>
<display-name>offers</display-name>
<servlet-name>offers</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>offers</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
<description>Database</description>
<resource-ref>
<description>DB Connection</description>
<res-ref-name>jdbc/Spring_Tutorial</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<context-param>
<param-name>ContextConfigLocation</param-name>
<param-value>
classpath:com/learnspring/config/daoContext.xml
classpath:com/learnspring/config/offersService.xml
</param-value>
</context-param>
</web-app>
Solution
if you want to just load the files using ContextLoaderListener, remove the dispatcher servlet and that should work fine or use the below method to load the final.
<servlet>
<servlet-name>offers</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value> classpath:com/learnspring/config/daoContext.xml
classpath:com/learnspring/config/offersService.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
0 comments:
Post a Comment