加载spring时applicationContext.xml文件出错
来源:互联网 发布:威士忌用什么杯子 知乎 编辑:程序博客网 时间:2024/04/19 14:17
今天联系Spring+Hibernate基础,没办法,SSH配置一直一直在出问题,只能一点一点的调了~
首先在新建工程的时候就出现了问题,用MyEclipse加入Spring支持的时候就出现了错误提示,T_T~~~~我明明嘛都米开始干呢。。。。。
applicationContext.xml头出现了问题,MyEclipse提示如下错误:
Referenced file contains errors(http://www.springframework.org/schema/beans/spring-beans-2.0.xsd).For more information,right click on the message and select "Show Details"
这个问题经过上网搜索查询反复的改正,终于解决。
原因如下:
原头信息:
<?xml version="1.0" encoding="UTF-8"?>
<beans
xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beanshttp://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
配置bean
</beans>
问题原因:我也不是特别清楚,估计是链接外网时出现问题,链接外网文件无法得到。
修改方法:
将头文件改为:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN"
"http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
配置bean
</beans>
问题解决。
解决了配置问题,进行了简单测试又出现了一个小问题,运行时
出现如下错误:
Exception in thread "main" org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from class path resource [../applicationContext.xml]; nested exception is java.io.FileNotFoundException: class path resource [../applicationContext.xml] cannot be opened because it does not exist
Caused by: java.io.FileNotFoundException: class path resource [../applicationContext.xml] cannot be opened because it does not exist
阅读错误代码很容易发现,
程序无法加载applicationContext.xml文件,
仔细检查
ClassPathXmlApplicationContext ctc=new ClassPathXmlApplicationContext("/applicationContext.xml");
对路径进行复查,修改路径,问题解决~lucky~~~
- 加载spring时applicationContext.xml文件出错
- 加载spring时applicationContext.xml文件出错
- Tomcat启动时,spring加载配置文件applicationContext.xml出错,抛出nested exception is og.xml.sax.SAXParseException
- spring 如何加载applicationContext.xml
- Spring中加载ApplicationContext.xml文件的方式
- Spring中加载ApplicationContext.xml文件的方式
- Spring中加载ApplicationContext.xml文件的方式【转】
- spring 的启动 之加载文件 applicationContext.xml
- Spring中加载ApplicationContext.xml文件的方式
- Spring中加载ApplicationContext.xml文件的方式
- Spring中加载ApplicationContext.xml文件的方式
- Spring中加载ApplicationContext.xml文件的方式
- Spring中加载ApplicationContext.xml文件的方式
- Spring中加载ApplicationContext.xml文件的方式
- Spring的applicationContext.xml文件
- Spring的applicationContext.xml文件
- Spring的applicationContext.xml文件
- Spring的applicationContext.xml文件
- 面试困惑问与答(4)——最后该问什么?
- Asp实例:ASP备份SqlServer数据库
- Web服务器如何防CC攻击?
- 复制遇到8630错误
- 解决word2007不能同时打开两个文档
- 加载spring时applicationContext.xml文件出错
- 蓝海豚团购系统上传.包含.读取文件漏洞
- 变量替换
- jbpm4.4与spring整合及我自己遇到的问题
- MOCK object-第7章
- 艺术,多少罪恶将假汝之名
- ssh整合时各个配置文件需要修改添加的代码
- 简单例子教你理解AJAX执行步骤
- Dawei 团购 变量未初值化