Java 中的Spring 运行错误
2012-5-913:25:33org.springframework.beans.factory.xml.XmlBeanDefinitionReaderloadBean...
2012-5-9 13:25:33 org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
信息: Loading XML bean definitions from class path resource [SpringHelloWorld.xml]
Exception in thread "main" org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from class path resource [SpringHelloWorld.xml]; nested exception is java.io.FileNotFoundException: class path resource [SpringHelloWorld.xml] cannot be opened because it does not exist
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:341)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:302)
at org.springframework.beans.factory.xml.XmlBeanFactory.<init>(XmlBeanFactory.java:73)
at org.springframework.beans.factory.xml.XmlBeanFactory.<init>(XmlBeanFactory.java:61)
at net.roseindia.Spring3HelloWorldTest.main(Spring3HelloWorldTest.java:10)
Caused by: java.io.FileNotFoundException: class path resource [SpringHelloWorld.xml] cannot be opened because it does not exist
at org.springframework.core.io.ClassPathResource.getInputStream(ClassPathResource.java:141)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:328)
... 4 more 这个问题怎么解决 展开
信息: Loading XML bean definitions from class path resource [SpringHelloWorld.xml]
Exception in thread "main" org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from class path resource [SpringHelloWorld.xml]; nested exception is java.io.FileNotFoundException: class path resource [SpringHelloWorld.xml] cannot be opened because it does not exist
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:341)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:302)
at org.springframework.beans.factory.xml.XmlBeanFactory.<init>(XmlBeanFactory.java:73)
at org.springframework.beans.factory.xml.XmlBeanFactory.<init>(XmlBeanFactory.java:61)
at net.roseindia.Spring3HelloWorldTest.main(Spring3HelloWorldTest.java:10)
Caused by: java.io.FileNotFoundException: class path resource [SpringHelloWorld.xml] cannot be opened because it does not exist
at org.springframework.core.io.ClassPathResource.getInputStream(ClassPathResource.java:141)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:328)
... 4 more 这个问题怎么解决 展开
4个回答
展开全部
SpringHelloWorld.xml这个文件要放到src目录下(其实放哪里都行,就是在web.xml中配置好就行,不过最好是放在src目录下),<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:Spring*.xml</param-value>
</context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:Spring*.xml</param-value>
</context-param>
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
xml文件位置不对。
你这个需要把xml文件也加到classpath里面
你这个需要把xml文件也加到classpath里面
追问
z这样不对吗
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
放到src目录下面
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
2012-05-09
展开全部
不懂额。。。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询