java - Spring configuration not finding with Configured name -
this question has answer here:
the following configuration file configured
web-inf/classes/applicationcontext.xml searching web-inf/applicationcontext.xml
<?xml version="1.0" encoding="utf-8"?> <web-app id="starter_anil" 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"> <display-name>anil-spring</display-name> <!-- servlets --> <servlet> <servlet-name>mvc-dispatcher</servlet-name> <servlet-class>org.springframework.web.servlet.dispatcherservlet</servlet-class> <init-param> <param-name>contextconfiglocation</param-name> <param-value>web-inf/classes/applicationcontext.xml</param-value> </init-param> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>mvc-dispatcher</servlet-name> <url-pattern>/*</url-pattern> </servlet-mapping> <!-- listeners --> <listener> <listener-class>org.springframework.web.context.contextloaderlistener</listener-class> </listener> </web-app>
i getting following exception
evere: context initialization failed org.springframework.beans.factory.beandefinitionstoreexception: ioexception parsing xml document servletcontext resource [/web-inf/applicationcontext.xml]; nested exception java.io.filenotfoundexception: not open servletcontext resource [/web-inf/applicationcontext.xml]
here applicationcontext
<?xml version="1.0" encoding="utf-8"?> <!doctype beans public "-//spring//dtd bean//en" "http://www.springframework.org/dtd/spring-beans.dtd"> <beans> <import resource="config/controllers.xml" /> <!-- <import resource="conf/spring/services.xml" /> <import resource="conf/spring/persistence.xml" /> <import resource="conf/spring/daos.xml" /> <import resource="conf/spring//interceptors.xml" /> --> </beans>
the solution
<?xml version="1.0" encoding="utf-8"?> <web-app id="starter_anil" 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"> <display-name>anil-spring</display-name> <!-- servlets --> <servlet> <servlet-name>mvc-dispatcher</servlet-name> <servlet-class>org.springframework.web.servlet.dispatcherservlet</servlet-class> <init-param> <param-name>contextconfiglocation</param-name> <param-value>/web-inf/classes/applicationcontext.xml</param-value> </init-param> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>mvc-dispatcher</servlet-name> <url-pattern>/*</url-pattern> </servlet-mapping> <context-param> <param-name>contextconfiglocation</param-name> <param-value>/web-inf/classes/applicationcontext.xml</param-value> </context-param> <!-- listeners --> <listener> <listener-class>org.springframework.web.context.contextloaderlistener</listener-class> </listener> </web-app>
warning: no mapping found http request uri [/anilsspring/web-inf/jsp/hello.jsp] in dispatcherservlet name 'mvc-dispatcher' please guide line me once
why applicationcontext
in classes? move web-inf directory, told in comment. should fix problem.
the /classes directory compiled classes, not configuration files.
Comments
Post a Comment