0

I want to customize an existing project. I can build and deploy that project without any errors. My problem is if I try to load my BeanLocation.xml

 new ClassPathXmlApplicationContext("file:spring/config/BeanLocations.xml");

it throws the error:

class org.springframework.beans.factory.BeanDefinitionStoreException
IOException parsing XML document from URL [file:resources/spring/config/BeanLocations.xml]; nested exception is java.io.FileNotFoundException: resources/spring/config/BeanLocations.xml (No such file or directory)

if you have a closer look to my classpath:

 C:/Program Files/Java/jdk1.8.0_60/lib/tools.jar;C:/Users/admin/workspace/ssf/samples/customcontroller/../../as-common/classes;C:/Users/admin/workspace/ssf/samples/customcontroller/../../as-shared/classes;C:/Users/admin/workspace/ssf/samples/customcontroller/../../commons-httpclient-contrib/classes;C:/Users/admin/workspace/ssf/samples/customcontroller/../../gwt/classes;C:/Users/admin/workspace/ssf/samples/customcontroller/../../indexer-lucene/classes;C:/Users/admin/workspace/ssf/samples/customcontroller/../../jboss-portal/classes;C:/Users/admin/workspace/ssf/samples/customcontroller/../../liferay/liferay/classes;C:/Users/admin/workspace/ssf/samples/customcontroller/../../liferay-light/classes;C:/Users/admin/workspace/ssf/samples/customcontroller/../../lucene-contrib/classes;C:/Users/admin/workspace/ssf/samples/customcontroller/../../main/classes;C:/Users/admin/workspace/ssf/samples/customcontroller/../../main-minimum/classes;C:/Users/admin/workspace/ssf/samples/customcontroller/../../portal-module/classes;C:/Users/admin/workspace/ssf/samples/customcontroller/../../remoting/classes;C:/Users/admin/workspace/ssf/samples/customcontroller/../../rest-shared/classes;C:/Users/admin/workspace/ssf/samples/customcontroller/../../slide-webdavclient/classes;C:/Users/admin/workspace/ssf/samples/customcontroller/../../ssfs/classes;C:/Users/admin/workspace/ssf/samples/customcontroller/../../taglib/classes;C:/Users/admin/workspace/ssf/samples/customcontroller/../../tools/classes;C:/Users/admin/workspace/ssf/samples/customcontroller/../../util/classes;C:/Users/admin/workspace/ssf/samples/customcontroller/../../util-search/classes;C:/Users/admin/workspace/ssf/samples/customcontroller/../../liferay/teaming/classes;C:/Users/admin/workspace/ssf/samples/customcontroller/src/resources

then You will find C:/Users/admin/workspace/ssf/samples/customcontroller/src/resources which contains the file C:/Users/admin/workspace/ssf/samples/customcontroller/src/resources/spring/config/BeanLocation.xml

StellaMaris
  • 877
  • 2
  • 12
  • 29
  • without using `file:` I got the same error. – StellaMaris Mar 19 '16 at 16:20
  • Possible duplicate of [Spring cannot find bean xml configuration file when it does exist](http://stackoverflow.com/questions/12893760/spring-cannot-find-bean-xml-configuration-file-when-it-does-exist) – Cootri Mar 19 '16 at 17:30

1 Answers1

0

You are using a file uri. This kind of uri doesn't care about the classpath, but read a file relative to the current folder.

Use a classpath uri, or set the file uri with a correct path.

Jérémie B
  • 10,611
  • 1
  • 26
  • 43
  • `classpath*:spring/config/BeanLocations.xml` does work for me but I want to know how to load via the `file:` or without the `file:` prefix. – StellaMaris Mar 19 '16 at 16:23
  • What are you suggest to use instead of "file:spring/config/BeanLocations.xml" I tried many ways but nothing worked. – StellaMaris Mar 19 '16 at 17:02