SSH Integrated Org.springframework.beans.factory.BeanDefinitionStoreException:IOException

Source: Internet
Author: User

system Environment: jdk8+eclipse4.4+tomcat7.x+spring4.1.3+hibernate4.3.7+struts2.3.20, my configuration files are stored in the SRC directory. First, the spring default profile is Applicationcontext.xml, and if you do not call this name, you need to specify it, by adding it in the Web. xml file:<param-name>contextConfigLocation</param-name> and <param-value>classpath:beans.xml, Classpath:action-beans.xml</param-value> Unfortunately, Tomcat starts off with an error similar to the following:
< Span style= "Background-color:inherit" > org.springframework.beans.factory.beandefin Itionstoreexception:ioexception parsing XML document from ServletContext resource [/web-inf/beans.xml]; Nested exception is java.io.FileNotFoundException:Could not open ServletContext resource [/web-inf/beans.xml] & nbsp;
caused by:java.io.FileNotFoundException:Could not open ServletContext resource [/ web-inf/beans.xml] 
Finally, after constant testing and adjustment, the following conclusions are obtained, for reference only:
<!--needed for Contextloaderlistener --<!--Specify the location of the spring configuration file--<context-param><param-name>contextConfigLocation</param-name><!--can successfully load the configuration file --<!--<param-value>/WEB-INF/classes/beans.xml,/WEB-INF/classes/action-beans.xml</param-value> -<!--The configuration file cannot be loaded successfully --<!--<param-value>/WEB-INF/beans.xml,/WEB-INF/action-beans.xml</param-value> --<!--can successfully load the configuration file --<!--<param-value>classpath:*beans.xml</param-value> --<!--The configuration file cannot be loaded successfully --<!--<param-value>classpath:beans.xml,action-beans.xml</param-value> --<!--can successfully load the configuration file --<param-value>classpath:beans.xml,classpath:action-beans.xml</param-value></context-param><!--bootstraps the root Web application context before servlet initialization --<listener><listener-class>org.springframework.web.context.ContextLoaderListener</listener-class></listener>
In fact, I do not know much, but I believe StackOverflow, I believe that foreigners ah, see here is a word, so to speakHttp://stackoverflow.com/questions/6035464/could-not-open-servletcontext-resource
Do not use Classpath. This could cause problems with different classloaders (container vs. application). Web-inf is always the better choice.
do not use classpath, it is recommended to use Web-inf when the loader of the class may be different. the best configuration is to create a new source folder in the same directory as the SRC, then include all the configuration files, and then in Web. XML, use the web-inf/classes/ Beans.xml is configured, and multiple files are separated by commas.
finally:

SSH Integrated Org.springframework.beans.factory.BeanDefinitionStoreException:IOException

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.