java - Resource not found(404) when adding ContextLoaderListener and RequestContextListener in web.xml -
when adding contextloaderlistener
web.xml
got message of resource not found(404). when remove listener class web.xml
index.php
running adding
<listener> <listener-class>org.springframework.web.context.contextloaderlistener</listener-class> </listener> <listener> <listener-class>org.springframework.web.context.request.requestcontextlistener</listener-class> </listener>
- this 2 lines give me resource not found error eclipse kepler version.when adding these 2 lines in
web.xml
, prepare code heading error:
java.lang.illegalstateexception: no webapplicationcontext found: no contextloaderlistener registered?
i tried hard , new spring framework. can tell me setup needed listener or else?
error in console:
* jan 27, 2016 12:47:24 pm org.apache.catalina.core.standardcontext listenerstart severe: exception sending context initialized event listener instance of class org.springframework.web.context.contextloaderlistener org.springframework.beans.factory.beandefinitionstoreexception: parser configuration exception parsing xml servletcontext resource [/web-inf/applicationcontext.xml]; nested exception javax.xml.parsers.parserconfigurationexception: unable validate using xsd: jaxp provider [org.apache.crimson.jaxp.documentbuilderfactoryimpl@1cefe08] not support xml schema. running on java 1.4 or below apache crimson? upgrade apache xerces (or java 1.5) full xsd support.
*
web.xml file:
<?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>futurekid</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> <listener> <listener-class>org.springframework.web.context.contextloaderlistener</listener-class> </listener> <listener> <listener-class>org.springframework.web.context.request.requestcontextlistener</listener-class> </listener> <servlet> <description></description> <display-name>inputformservlet</display-name> <servlet-name>inputformservlet</servlet-name> <servlet-class>com.webapp.inputformservlet</servlet-class> </servlet> <servlet-mapping> <servlet-name>inputformservlet</servlet-name> <url-pattern>/input-form</url-pattern> </servlet-mapping> <servlet> <description></description> <display-name>customerservlet</display-name> <servlet-name>customerservlet</servlet-name> <servlet-class>com.webapp.customerservlet</servlet-class> </servlet> <servlet-mapping> <servlet-name>customerservlet</servlet-name> <url-pattern>/get-customer</url-pattern> </servlet-mapping> </web-app>
just adding contextloaderlistener
not enougth, need configure beans loaded contextloaderlistener
. tyicaly configure name of spring xml file contextloaderlistener
(via context-param contextconfiglocation
) , add spring configuration file.
you should read "contextloaderlistener or not?" question , answers, give brife understanding of 2 spring contexts. contains example configuration of web.xml
Comments
Post a Comment