Solution to Bean. xml file placement errors during spring running

Source: Internet
Author: User

The following error occurs when running spring:

Exception in thread "Main" org. springframework. beans. factory. beandefinitionstoreexception: ioexception parsing XML document from file [F:/dream/workspace/CCH/bean. XML]; Nested exception is Java. io. filenotfoundexception: bean. XML (the system cannot find the specified file .)

At org. springframework. Beans. Factory. xml. xmlbeandefinitionreader. loadbeandefinitions (xmlbeandefinitionreader. Java: 349)
At org. springframework. Beans. Factory. xml. xmlbeandefinitionreader. loadbeandefinitions (xmlbeandefinitionreader. Java: 310)
At org. springframework. Beans. Factory. Support. abstractbeandefinitionreader. loadbeandefinitions (abstractbeandefinitionreader. Java: 143)
At org. springframework. Beans. Factory. Support. abstractbeandefinitionreader. loadbeandefinitions (abstractbeandefinitionreader. Java: 178)
At org. springframework. Beans. Factory. Support. abstractbeandefinitionreader. loadbeandefinitions (abstractbeandefinitionreader. Java: 149)
At org. springframework. Beans. Factory. Support. abstractbeandefinitionreader. loadbeandefinitions (abstractbeandefinitionreader. Java: 212)
At org. springframework. Context. Support. abstractxmlapplicationcontext. loadbeandefinitions (abstractxmlapplicationcontext. Java: 113)
At org. springframework. Context. Support. abstractxmlapplicationcontext. loadbeandefinitions (abstractxmlapplicationcontext. Java: 80)
At org. springframework. Context. Support. abstractrefreshableapplicationcontext. refreshbeanfactory (abstractrefreshableapplicationcontext. Java: 123)
At org. springframework. Context. Support. abstractapplicationcontext. obtainfreshbeanfactory (abstractapplicationcontext. Java: 423)
At org. springframework. Context. Support. abstractapplicationcontext. Refresh (abstractapplicationcontext. Java: 353)
At org. springframework. Context. Support. filesystemxmlapplicationcontext. <init> (filesystemxmlapplicationcontext. Java: 140)
At org. springframework. Context. Support. filesystemxmlapplicationcontext. <init> (filesystemxmlapplicationcontext. Java: 84)
At lei. Deng. Yan. Spring. factorybeen. springtest. Main (springtest. Java: 12)
Caused by: Java. Io. filenotfoundexception: bean. XML (the system cannot find the specified file .)
At java. Io. fileinputstream. Open (native method)
At java. Io. fileinputstream. <init> (fileinputstream. Java: 106)
At org. springframework. Core. Io. filesystemresource. getinputstream (filesystemresource. Java: 108)
At org. springframework. Beans. Factory. xml. xmlbeandefinitionreader. loadbeandefinitions (xmlbeandefinitionreader. Java: 336)
... 13 more

 

Solution:

The cause of the error is Bean. the path where XML is placed is incorrect. The bug prompts that bean is not found in F:/dream/workspace/CCH. XML file, so the bean. put the XML file in the directory F:/dream/workspace/CCH/, that is, put it in the first folder of the project.

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.