Eclipse Maven Project error 3 no configuration file found Spring-servlet-context.xml

Source: Internet
Author: User

One, the specific error as shown

According to the text hints can be seen that this file is not found, but I went to the project directory to find, this file does exist, then what is the problem?

Second, solve the problem

Cause analysis (from online)

The process of compiling a code is a process that automatically generates the corresponding compiled file. In a project where the original file directory is called source folders, the compiled file directory is called output folders, which is what we typically call classpath, which can be passed by right-clicking the project->pripertites-> Java Build Path->source see.
The source folders of my project is Test/src,output folders is test/webroot/web-inf/classes
The fault of the report is that Classpath did not find Bean.xml, that is, the compiled file does not have XML, so first look at the code is how to call Bean.xml, I was through the following way:

new ClassPathXmlApplicationContext("bean.xml");
    • 1

This way will default from the file stored in the code to find the root directory test/src, and I put bean.xml directly under the Test folder, so of course the error. Just place the bean.xml in the Code root directory test/src. As can be seen, should be my spring-servlet-context.xml configuration file is not in the source folders, so compile the time can not find, I went to see, my profile is in Main/resource below, I added Main/java under build path, so I get an error.

Through the above processing, start the service again, error resolution, intentions to solve the problem, all can be solved.

Eclipse Maven Project error 3 no configuration file found Spring-servlet-context.xml

Related Article

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.