Java.io.FileNotFoundException:Could not open ServletContext resource [/web-inf/classes/applicationc

Source: Internet
Author: User
caused by:java.io.FileNotFoundException:Could not open ServletContext resource [/web-inf/classes/ Applicationcontext.xml] at
	Org.springframework.web.context.support.ServletContextResource.getInputStream ( servletcontextresource.java:140) at
	Org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions (Xmlbeandefinitionreader.java : 328) ...
	More

The cause of the error occurred in the Web.xml configuration issue:

<servlet>
		<servlet-name>springmvc</servlet-name>
		<servlet-class> Org.springframework.web.servlet.dispatcherservlet</servlet-class>
		<load-on-startup>1</ load-on-startup>
	</servlet>

	<servlet-mapping>
		<servlet-name>springmvc</ servlet-name>
		<url-pattern>/</url-pattern>
	</servlet-mapping>

Plus:

<servlet>
		<servlet-name>springmvc</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>springmvc</ servlet-name>
		<url-pattern>/</url-pattern>
	</servlet-mapping>
The problem is that the default profile location that loads spring is typically a applicationcontext.xml file under/web-inf/, and the ApplicationContext file that is automatically generated by the eclipse file is placed in the/web-inf/ Classes/applicationcontext.xml, so the Applicationcontext.xml file cannot be found in the default load and must be added to the configuration above.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.