error while loading properties file in applicationcontext

Posted on 2013-12-13
Last Modified: 2013-12-16

In the application context file  below am setting an properties file, getting an error as

<!-- set application properties -->
  <property name="locations" value="classpath:src//config//" />
  <property name="systemPropertiesModeName" value="SYSTEM_PROPERTIES_MODE_OVERRIDE" />
  <property name="ignoreUnresolvablePlaceholders" value="true" />
  <property name="order" value="1" />

getting error as
Exception in thread "main" org.springframework.beans.factory.BeanInitializationException: Could not load properties; nested exception is class path resource [src/config/] cannot be opened because it does not exist
 at org.springframework.beans.factory.config.PropertyResourceConfigurer.postProcessBeanFactory(
Caused by: class path resource [src/config/] cannot be opened because it does not exist
 at org.springframework.beans.factory.config.PropertyResourceConfigurer.postProcessBeanFactory(

Open in new window

Question by:roy_sanu
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
LVL 86

Expert Comment

ID: 39717387
Caused by: class path resource [src/config/] cannot be opened because it does not exist

Open in new window

Are you saying Spring is wrong about that?

Author Comment

ID: 39718856
No, i have properties file at the right path, but is it gives me the above error, what might be
the reason. Any other way  it can be set on spring applicationcontext
LVL 35

Expert Comment

ID: 39719856
No, i have properties file at the right path
It sounds unlikely that you would have a folder called "src" on your classpath. Can you post a directory structure of your project? If you are using Eclipse (or other IDE) posting a screenshot of the project layout/structure would help!
LVL 86

Accepted Solution

CEHJ earned 500 total points
ID: 39719867
It sounds unlikely that you would have a folder called "src" on your classpath.
Yes, although the word should probably be 'should' rather than 'would'. Spring seems to be saying that you DO have that as a classloading (resource) path. I'd look for that properties file in part of the binaries (class files/jars) tree and use that path instead

I don't do Spring so don't know how it does its builds, but the generic way with resources is often to take resource files from source locations and see that they end up in 'binary locations' by copying. Perhaps that is not getting done owing to some configuration error

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
ejb stateless example 2 42
Chrome and Firefox Java 5 67
What browser will run Java? 7 125
Github api to fetch the number of collaborators in a git repo 1 29
Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…

749 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question