0

I am just trying to learn Java programming (doing VC# actually). Downloaded source from https://github.com/ykameshrao/spring-hibernate-springdata-springmvc-maven-project-framework Installed JDK7 and tried with JDK8 also. Tomcat 6.0, 7.0, 8.0 also. Thinking that may be there is a library issue. But I am still getting following error: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dbProps': Invocation of init method failed; nested exception is java.io.FileNotFoundException: \config\props\database.properties (The system cannot find the path specified)

I understand it must be configured somewhere, as the code is working on authors, what am i missing? Here is a applicationContext-properties.xml:

http://www.springframework.org/schema/beans/spring-beans-3.1.xsd http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.1.xsd">

<!--<util:properties id="mdbProps" location="file:#{systemProperties['conf.path']}/config/props/mongodb.properties"

/>-->

<bean id="httpError" class="com.yourpackagename.yourwebproject.api.common.HttpError" />
<bean id="key" class="com.yourpackagename.yourwebproject.common.Key" />
<bean id="props" class="com.yourpackagename.yourwebproject.common.Props" />
<bean id="msg" class="com.yourpackagename.yourwebproject.common.Message" /> </beans>
ADO_kg
  • 65
  • 2
  • 13

1 Answers1

0

It's either you don't have system property 'conf.path' set in your system, or you don't have files placed under your 'conf.path' path.

Have a look at setting-system-properties for setting system properties.

If you don't want to set system property 'conf.path', you could change the location of your file.

To make changes in properties easy, it is desirable that all properties file be kept in a location, which in not part of your web container. Storing properties in 'user.home' is wise idea.

eg:

<util:properties id="mdbProps" location="file:#{systemProperties['user.home']}/.projectname/conf/mongodb.properties">

With this configuration, you will be copying all your 'properties' file in 'user.home'/.projectname/conf/ directory. Where 'user.home' is your hone directory, oftenly C://users//username// in windows and /home/username/ in linux.

Community
  • 1
  • 1
Sudarshan_SMD
  • 2,549
  • 33
  • 23