java - spring 练习遇到问题?
ringa_lee
ringa_lee 2017-04-18 10:49:57
0
4
640

log4j:WARN No appenders could be found for logger (org.springframework.context.support.ClassPathXmlApplicationContext).
log4j:WARN Please initialize the log4j system properly.
Exception in thread "main" org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from class path resource [autowire.xml]; nested exception is java.io.FileNotFoundException: class path resource [autowire.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.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:126)
at org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicationContext.java:92)
at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:130)
at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:467)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:397)
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139)
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:83)
at com.Spring.autowire.Main.main(Main.java:8)

Caused by: java.io.FileNotFoundException: class path resource [autowire.xml] cannot be opened because it does not exist

at org.springframework.core.io.ClassPathResource.getInputStream(ClassPathResource.java:158)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:328)
... 13 more


为什么xml文件存在,报错却说文件不存在啊

ringa_lee
ringa_lee

ringa_lee

모든 응답(4)
小葫芦

autowire.xml 경로가 잘못되었습니다. srcapplicationContext.xml과 같은 디렉터리의

아래에 넣어야 합니다.
巴扎黑

autowire.xml 파일을 찾을 수 없습니다. 패키지에 넣으려면 경로가 src, classpath:src/com/Spring/autowire/autowire.xml에서 시작해야 합니다. 그렇지 않으면 src 디렉터리에 넣으세요. . 클래스 경로:autowire.xml

阿神


클래스 경로에서 autowire.xml 파일을 찾을 수 없어 위치가 잘못되었음을 의미합니다. 그냥 applicationContext.xml과 함께 넣어주세요

Peter_Zhu

모든 패키지의 가장 바깥쪽 레이어인 src 안에 넣습니다.

최신 다운로드
더>
웹 효과
웹사이트 소스 코드
웹사이트 자료
프론트엔드 템플릿