Results 1 to 3 of 3

Thread: Problem loading a bean due to a missing xml file in the context

  1. #1
    Join Date
    Jul 2012
    Posts
    24

    Default Problem loading a bean due to a missing xml file in the context

    Hello,

    I need your help to understand why I am not able to load a spring bean because of the following error:

    Caused by: java.io.FileNotFoundException: ServletContext resource [/${config.myfile.location:config:config/myfileConfig.xml}] cannot be resolved to URL because it does not exist


    I don't understand why this happens because I've placed the myfileConfig.xml file into the classpath (within a source folder) and cannot be seen anyway. Note that this is a web application running on tomcat.

    What I guess is that there should be some property placeholder somewhere, but I am not sure and I don't understand the ":" between location and config. I would also say that the myfileConfig.xml file is expected to be located into a directory called "config".

    Can somebody put me on the right path to solve this problem please?

  2. #2
    Join Date
    Jul 2012
    Posts
    4

    Default

    for web application, provide path from WEB-INF folder, i.e /WEB-INF/config/myfileConfig.xml, where file would be in config folder of WEB-INF.

    Hope it will help.

  3. #3
    Join Date
    Jul 2012
    Posts
    24

    Default

    Hi,

    thanks for replying.
    I've tried to put my config files into the /WEB-INF/config folder but it doesn't work. I tink there should be some property placeholder within my config file but I don't know exactly what to do.

    As far as I can see the *.xml files within the /WEB-INF/ directory are going to be seen from the container and the MVC Dispatcher Servlet is loaded.

    I've added the /WEB-INF/config directory and one subdirectory to the Web Deployment assembly in the project properties, but it seems nothing is changed. Note that I am using the workspace metadata as Tomcat directory installation (using the plugin) and not the Tomcat installation directory.
    Last edited by fbcyborg; Jan 19th, 2013 at 05:58 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •