의 클래스 패스 리소스를 찾을 수 없습니다.봄은이 같은 조직 프로젝트가 내부 jar 파일
<param-value>
/WEB-INF/applicationContext.xml
</param-value>
을 그리고 applicationContext.xml
에서 내가 가진 : web.xml
에서
내가 가진
<import resource="classpath:/company/config/spring-config.xml" />
을하지만 실행하면이 오류를 얻을 :
2012-10-04 20:03:39,156 [localhost-startStop-1] springframework.web.context.ContextLoader ERROR: Context initialization failed
org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Failed to import bean definitions from URL location [classpath:/company/config/spring-config.xml]
Offending resource: ServletContext resource [/WEB-INF/applicationContext.xml]; nested exception is org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from class path resource [company/config/spring-config.xml]; nested exception is java.io.FileNotFoundException: class path resource [company/config/spring-config.xml] cannot be opened because it does not exist
at org.springframework.beans.factory.parsing.FailFastProblemReporter.error(FailFastProblemReporter.java:68)
....
Caused by: java.io.FileNotFoundException: class path resource [company/config/spring-config.xml] cannot be opened because it does not exist
at org.springframework.core.io.ClassPathResource.getInputStream(ClassPathResource.java:142)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:336)
... 36 more
spring-config.xml
이에 webapp, 다 잘 작동합니다.
/
이 스택 추적의 일부 오류에서 제거 된 것을 확인했으며 이것이 그와 관련이 있는지 궁금합니다.
또한 (불행히도) 저는 Spring 2.5를 사용하고 있습니다.
/company/config/spring-config.xml에서 제거한 다음 – Satya
@Satya를 확인하십시오. 감사합니다. 시도해 보았습니다. 동일한 결과가 나타납니다. – JBCP
@JBCP - 추가적인 문제가 있기 때문에 선행 슬래시를 제거해도 작동하지 않을 수 있지만 선행 슬래시에서는 작동하지 않습니다. 이 기사를 읽으면 도움이 될 것입니다. http://blog.carbonfive.com/2007/05/17/using-classpath-vs-classpath-when-loading-spring-resources/ – GreyBeardedGeek