Spring FileNotFoundException issue when file DOES exist.

I am going crazy trying to understand why, now that I converted to EAP 10 that IDEA cannot find my spring context

spring-config-services.xml is in src/main/resources but running my unit test, keeps failing:


C:\usr\bin\Java\jdk1.6.0_19\bin\java -DconfigLocation=test -Didea.launcher.port=7532 -Didea.launcher.bin.path=C:\usr\bin\ideaIU-98.486\bin -Dfile.encoding=windows-1252 -classpath "C:\usr\bin\ideaIU-98.486\lib\idea_rt.jar;C:\usr\bin\ideaIU-98.486\plugins\junit\lib\junit-rt.jar;C:\usr\svn_workspaces\xIVR\agent-ivr\target\test-classes;C:\usr\svn_workspaces\xIVR\agent-ivr\target\classes;C:\usr\bin\Java\jdk1.6.0_19\jre\lib\alt-rt.jar;C:\usr\bin\Java\jdk1.6.0_19\jre\lib\charsets.jar;C:\usr\bin\Java\jdk1.6.0_19\jre\lib\deploy.jar;C:\usr\bin\Java\jdk1.6.0_19\jre\lib\javaws.jar;C:\usr\bin\Java\jdk1.6.0_19\jre\lib\jce.jar;C:\usr\bin\Java\jdk1.6.0_19\jre\lib\jsse.jar;C:\usr\bin\Java\jdk1.6.0_19\jre\lib\management-agent.jar;C:\usr\bin\Java\jdk1.6.0_19\jre\lib\plugin.jar;C:\usr\bin\Java\jdk1.6.0_19\jre\lib\resources.jar;C:\usr\bin\Java\jdk1.6.0_19\jre\lib\rt.jar;C:\usr\bin\Java\jdk1.6.0_19\jre\lib\ext\dnsns.jar;C:\usr\bin\Java\jdk1.6.0_19\jre\lib\ext\localedata.jar;C:\usr\bin\Java\jdk1.6.0_19\jre\lib\ext\sunjce_provider.jar;C:\usr\bin\Java\jdk1.6.0_19\jre\lib\ext\sunmscapi.jar;C:\usr\bin\Java\jdk1.6.0_19\jre\lib\ext\sunpkcs11.jar;C:\Documents and Settings\MKnuts6173c\.m2\repository\org\mockito\mockito-all\1.8.5\mockito-all-1.8.5.jar;C:\Documents and Settings\MKnuts6173c\.m2\repository\org\springframework\spring-test\3.0.5.RELEASE\spring-test-3.0.5.RELEASE.jar;C:\Documents and Settings\MKnuts6173c\.m2\repository\javax\activation\activation\1.1\activation-1.1.jar;C:\Documents and Settings\MKnuts6173c\.m2\repository\javax\el\el-api\1.0\el-api-1.0.jar;C:\Documents and Settings\MKnuts6173c\.m2\repository\javax\persistence\persistence-api\1.0\persistence-api-1.0.jar;C:\Documents and Settings\MKnuts6173c\.m2\repository\javax\portlet\portlet-api\2.0\portlet-api-2.0.jar;C:\Documents and Settings\MKnuts6173c\.m2\repository\javax\servlet\servlet-api\2.5\servlet-api-2.5.jar;C:\Documents and Settings\MKnuts6173c\.m2\repository\javax\servlet\jsp\jsp-api\2.1\jsp-api-2.1.jar;C:\Documents and Settings\MKnuts6173c\.m2\repository\org\apache\geronimo\specs\geronimo-jta_1.1_spec\1.1\geronimo-jta_1.1_spec-1.1.jar;C:\Documents and Settings\MKnuts6173c\.m2\repository\org\hamcrest\hamcrest-all\1.1\hamcrest-all-1.1.jar;C:\Documents and Settings\MKnuts6173c\.m2\repository\org\springframework\spring-core\3.0.5.RELEASE\spring-core-3.0.5.RELEASE.jar;C:\Documents and Settings\MKnuts6173c\.m2\repository\org\springframework\spring-expression\3.0.5.RELEASE\spring-expression-3.0.5.RELEASE.jar;C:\Documents and Settings\MKnuts6173c\.m2\repository\org\springframework\spring-beans\3.0.5.RELEASE\spring-beans-3.0.5.RELEASE.jar;C:\Documents and Settings\MKnuts6173c\.m2\repository\org\springframework\spring-context\3.0.5.RELEASE\spring-context-3.0.5.RELEASE.jar;C:\Documents and Settings\MKnuts6173c\.m2\repository\org\springframework\spring-context-support\3.0.5.RELEASE\spring-context-support-3.0.5.RELEASE.jar;C:\Documents and Settings\MKnuts6173c\.m2\repository\org\springframework\spring-aop\3.0.5.RELEASE\spring-aop-3.0.5.RELEASE.jar;C:\Documents and Settings\MKnuts6173c\.m2\repository\aopalliance\aopalliance\1.0\aopalliance-1.0.jar;C:\Documents and Settings\MKnuts6173c\.m2\repository\org\springframework\spring-asm\3.0.5.RELEASE\spring-asm-3.0.5.RELEASE.jar;C:\Documents and Settings\MKnuts6173c\.m2\repository\commons-logging\commons-logging\1.1.1\commons-logging-1.1.1.jar;C:\Documents and Settings\MKnuts6173c\.m2\repository\org\springframework\spring-web\3.0.5.RELEASE\spring-web-3.0.5.RELEASE.jar;C:\Documents and Settings\MKnuts6173c\.m2\repository\org\springframework\spring-webmvc\3.0.5.RELEASE\spring-webmvc-3.0.5.RELEASE.jar;C:\Documents and Settings\MKnuts6173c\.m2\repository\org\springframework\ws\spring-ws\1.5.9\spring-ws-1.5.9-all.jar;C:\Documents and Settings\MKnuts6173c\.m2\repository\org\springframework\security\spring-security-core\3.0.4.RELEASE\spring-security-core-3.0.4.RELEASE.jar;C:\Documents and Settings\MKnuts6173c\.m2\repository\org\springframework\security\spring-security-config\3.0.4.RELEASE\spring-security-config-3.0.4.RELEASE.jar;C:\Documents and Settings\MKnuts6173c\.m2\repository\org\springframework\security\spring-security-web\3.0.4.RELEASE\spring-security-web-3.0.4.RELEASE.jar;C:\Documents and Settings\MKnuts6173c\.m2\repository\org\aspectj\aspectjweaver\1.5.4\aspectjweaver-1.5.4.jar;C:\Documents and Settings\MKnuts6173c\.m2\repository\com\comcast\ivr\das\activation-service\1.0.7-SNAPSHOT\activation-service-1.0.7-SNAPSHOT.jar;C:\Documents and Settings\MKnuts6173c\.m2\repository\com\comcast\ivr\das\configuration-service\1.0.7-SNAPSHOT\configuration-service-1.0.7-SNAPSHOT.jar;C:\Documents and Settings\MKnuts6173c\.m2\repository\com\comcast\ivr\das\identify-service\1.0.7-SNAPSHOT\identify-service-1.0.7-SNAPSHOT.jar;C:\Documents and Settings\MKnuts6173c\.m2\repository\com\comcast\ivr\das\order-management-service\1.0.7-SNAPSHOT\order-management-service-1.0.7-SNAPSHOT.jar;C:\Documents and Settings\MKnuts6173c\.m2\repository\com\comcast\ivr\das\routing-lookup-service\1.0.7-SNAPSHOT\routing-lookup-service-1.0.7-SNAPSHOT.jar;C:\Documents and Settings\MKnuts6173c\.m2\repository\com\comcast\ivr\das\customer-service\1.0.7-SNAPSHOT\customer-service-1.0.7-SNAPSHOT.jar;C:\Documents and Settings\MKnuts6173c\.m2\repository\com\comcast\ivr\das\appointment-service\1.0.7-SNAPSHOT\appointment-service-1.0.7-SNAPSHOT.jar;C:\Documents and Settings\MKnuts6173c\.m2\repository\com\comcast\ivr\das\payment-service\1.0.7-SNAPSHOT\payment-service-1.0.7-SNAPSHOT.jar;C:\Documents and Settings\MKnuts6173c\.m2\repository\com\comcast\ivr\das\notification-service\1.0.7-SNAPSHOT\notification-service-1.0.7-SNAPSHOT.jar;C:\Documents and Settings\MKnuts6173c\.m2\repository\com\comcast\ivr\das\network-service\1.0.7-SNAPSHOT\network-service-1.0.7-SNAPSHOT.jar;C:\Documents and Settings\MKnuts6173c\.m2\repository\org\apache\velocity\velocity\1.7-beta1\velocity-1.7-beta1.jar;C:\Documents and Settings\MKnuts6173c\.m2\repository\org\apache\velocity\velocity-tools\2.0\velocity-tools-2.0.jar;C:\Documents and Settings\MKnuts6173c\.m2\repository\log4j\log4j\1.2.15\log4j-1.2.15.jar;C:\Documents and Settings\MKnuts6173c\.m2\repository\log4j\apache-log4j-extras\1.0\apache-log4j-extras-1.0.jar;C:\Documents and Settings\MKnuts6173c\.m2\repository\org\slf4j\slf4j-api\1.5.8\slf4j-api-1.5.8.jar;C:\Documents and Settings\MKnuts6173c\.m2\repository\org\slf4j\log4j-over-slf4j\1.5.8\log4j-over-slf4j-1.5.8.jar;C:\Documents and Settings\MKnuts6173c\.m2\repository\org\slf4j\slf4j-log4j12\1.5.8\slf4j-log4j12-1.5.8.jar;C:\Documents and Settings\MKnuts6173c\.m2\repository\commons-httpclient\commons-httpclient\3.1\commons-httpclient-3.1.jar;C:\Documents and Settings\MKnuts6173c\.m2\repository\commons-codec\commons-codec\1.4\commons-codec-1.4.jar;C:\Documents and Settings\MKnuts6173c\.m2\repository\commons-collections\commons-collections\3.2\commons-collections-3.2.jar;C:\Documents and Settings\MKnuts6173c\.m2\repository\commons-lang\commons-lang\2.5\commons-lang-2.5.jar;C:\Documents and Settings\MKnuts6173c\.m2\repository\commons-digester\commons-digester\2.0\commons-digester-2.0.jar;C:\Documents and Settings\MKnuts6173c\.m2\repository\commons-validator\commons-validator\1.3.1\commons-validator-1.3.1.jar;C:\Documents and Settings\MKnuts6173c\.m2\repository\commons-configuration\commons-configuration\1.6\commons-configuration-1.6.jar;C:\Documents and Settings\MKnuts6173c\.m2\repository\cglib\cglib-nodep\2.2\cglib-nodep-2.2.jar;C:\Documents and Settings\MKnuts6173c\.m2\repository\com\sun\xml\ws\jaxws-rt\2.1.5\jaxws-rt-2.1.5.jar;C:\Documents and Settings\MKnuts6173c\.m2\repository\javax\xml\ws\jaxws-api\2.1\jaxws-api-2.1.jar;C:\Documents and Settings\MKnuts6173c\.m2\repository\javax\xml\bind\jaxb-api\2.1\jaxb-api-2.1.jar;C:\Documents and Settings\MKnuts6173c\.m2\repository\javax\xml\stream\stax-api\1.0-2\stax-api-1.0-2.jar;C:\Documents and Settings\MKnuts6173c\.m2\repository\com\sun\xml\bind\jaxb-impl\2.1.9\jaxb-impl-2.1.9.jar;C:\Documents and Settings\MKnuts6173c\.m2\repository\com\sun\xml\messaging\saaj\saaj-impl\1.3.2\saaj-impl-1.3.2.jar;C:\Documents and Settings\MKnuts6173c\.m2\repository\javax\xml\soap\saaj-api\1.3\saaj-api-1.3.jar;C:\Documents and Settings\MKnuts6173c\.m2\repository\activation\activation\1.0.2\activation-1.0.2.jar;C:\Documents and Settings\MKnuts6173c\.m2\repository\com\sun\xml\stream\buffer\streambuffer\0.8\streambuffer-0.8.jar;C:\Documents and Settings\MKnuts6173c\.m2\repository\org\jvnet\staxex\stax-ex\1.2\stax-ex-1.2.jar;C:\Documents and Settings\MKnuts6173c\.m2\repository\javax\xml\stream\stax-api\1.0\stax-api-1.0.jar;C:\Documents and Settings\MKnuts6173c\.m2\repository\junit\junit\3.8\junit-3.8.jar;C:\Documents and Settings\MKnuts6173c\.m2\repository\woodstox\wstx-asl\3.2.3\wstx-asl-3.2.3.jar;C:\Documents and Settings\MKnuts6173c\.m2\repository\com\sun\org\apache\xml\internal\resolver\20050927\resolver-20050927.jar;C:\Documents and Settings\MKnuts6173c\.m2\repository\org\jvnet\mimepull\1.3\mimepull-1.3.jar;C:\Documents and Settings\MKnuts6173c\.m2\repository\javax\xml\ws\jaxws-api\2.1-1-ComcastFixed\jaxws-api-2.1-1-ComcastFixed.jar;C:\Documents and Settings\MKnuts6173c\.m2\repository\javax\annotation\jsr250-api\1.0\jsr250-api-1.0.jar;C:\Documents and Settings\MKnuts6173c\.m2\repository\org\apache\geronimo\specs\geronimo-ws-metadata_2.0_spec\1.1.1\geronimo-ws-metadata_2.0_spec-1.1.1.jar;C:\Documents and Settings\MKnuts6173c\.m2\repository\org\apache\xmlbeans\xmlbeans\2.3.0\xmlbeans-2.3.0.jar;C:\Documents and Settings\MKnuts6173c\.m2\repository\org\apache\xmlbeans\xmlbeans-xpath\2.3.0\xmlbeans-xpath-2.3.0.jar;C:\Documents and Settings\MKnuts6173c\.m2\repository\commons-fileupload\commons-fileupload\1.2\commons-fileupload-1.2.jar;C:\Documents and Settings\MKnuts6173c\.m2\repository\commons-io\commons-io\2.0\commons-io-2.0.jar;C:\Documents and Settings\MKnuts6173c\.m2\repository\commons-beanutils\commons-beanutils\1.8.2\commons-beanutils-1.8.2.jar;C:\Documents and Settings\MKnuts6173c\.m2\repository\commons-beanutils\commons-beanutils-bean-collections\1.8.2\commons-beanutils-bean-collections-1.8.2.jar;C:\Documents and Settings\MKnuts6173c\.m2\repository\javax\servlet\servlet-api\2.4\servlet-api-2.4.jar;C:\Documents and Settings\MKnuts6173c\.m2\repository\dom4j\dom4j\1.6.1\dom4j-1.6.1.jar;C:\Documents and Settings\MKnuts6173c\.m2\repository\joda-time\joda-time\1.6.2\joda-time-1.6.2.jar;C:\Documents and Settings\MKnuts6173c\.m2\repository\com\google\guava\guava\r06\guava-r06.jar;C:\Documents and Settings\MKnuts6173c\.m2\repository\com\comcast\das\clients\das-clients\1.0.2-SNAPSHOT\das-clients-1.0.2-SNAPSHOT.jar;C:\Documents and Settings\MKnuts6173c\.m2\repository\junit\junit\4.7\junit-4.7.jar;C:\Documents and Settings\MKnuts6173c\.m2\repository\org\jmock\jmock\2.5.1\jmock-2.5.1.jar;C:\Documents and Settings\MKnuts6173c\.m2\repository\org\jmock\jmock-junit4\2.5.1\jmock-junit4-2.5.1.jar;C:\Documents and Settings\MKnuts6173c\.m2\repository\org\hamcrest\hamcrest-core\1.1\hamcrest-core-1.1.jar;C:\Documents and Settings\MKnuts6173c\.m2\repository\org\hamcrest\hamcrest-library\1.1\hamcrest-library-1.1.jar;C:\Documents and Settings\MKnuts6173c\.m2\repository\emma\emma_ant\2.0.5312\emma_ant-2.0.5312.jar;C:\Documents and Settings\MKnuts6173c\.m2\repository\emma\emma\2.0.5312\emma-2.0.5312.jar" com.intellij.rt.execution.application.AppMain com.intellij.rt.execution.junit.JUnitStarter -ideVersion5 -junit4 com.comcast.ivr.agent.configuration.PropertyOverrideConfigurationTest

log4j:WARN No appenders could be found for logger (org.springframework.web.context.support.AnnotationConfigWebApplicationContext).

log4j:WARN Please initialize the log4j system properly.


org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from class path resource [spring-config-services.xml]; nested exception is java.io.FileNotFoundException: class path resource [spring-config-services.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.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitionsFromImportedResources(ConfigurationClassBeanDefinitionReader.java:276)

at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitionsForConfigurationClass(ConfigurationClassBeanDefinitionReader.java:124)

at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitions(ConfigurationClassBeanDefinitionReader.java:111)

at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:203)

at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:142)

at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:599)

at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:407)

at com.comcast.ivr.agent.configuration.PropertyOverrideConfigurationTest.init(PropertyOverrideConfigurationTest.java:28)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)

at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)

at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)

at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:27)

at org.junit.runners.ParentRunner.run(ParentRunner.java:236)

at org.junit.runner.JUnitCore.run(JUnitCore.java:157)

at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:94)

at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:196)

at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:65)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

at com.intellij.rt.execution.application.AppMain.main(AppMain.java:115)

Caused by: java.io.FileNotFoundException: class path resource [spring-config-services.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)

... 30 more



Process finished with exit code -1




I can run this from the commandline just fine
3 comments
Comment actions Permalink

Hi Mick,

Please check if target config ('spring-config-services.xml') is actually located at the output directory ('C:\usr\svn_workspaces\xIVR\agent-ivr\target\classes'). Clear output directory and make the module if the file is not there.

Regards, Denis

1
Comment actions Permalink

Thanks so much! It worked!

0
Comment actions Permalink

Thanks a lot! This just helped me, 8 years later. :) I was getting problems with one of my test resource files not being able to be loaded by a test, and clearing the out/ folder fixed it. :)

0

Please sign in to leave a comment.