Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7889601
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T06:08:27+00:00 2026-06-03T06:08:27+00:00

I have config.properties in my OSGi bundle. but the OSGi bundle can not read

  • 0

I have config.properties in my OSGi bundle. but the OSGi bundle can not read it.

Application context refresh failed (OsgiBundleXmlApplicationContext(bundle=dao, config=osgibundle:/META-INF/spring/*.xml))
org.springframework.beans.factory.BeanInitializationException: Could not load properties; nested exception is java.io.FileNotFoundException

I am using Spring to read the config.properties

<bean id="propertyConfigurer"
    class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
    <property name="location" value="config.properties" />
</bean>

It seems like the OSGi only reads the .xml file.
Does someone has any idea?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T06:08:28+00:00Added an answer on June 3, 2026 at 6:08 am

    You have to specify the correct resource for your value property.
    There are some built in implementations, like:

    • ClassPathResource: value="classpath:/META-INF/config.properties"
    • FileSystemResource: value="file:C:/foobar/config.properties"

    If you want to place the file outside the library you can use a system property (e.g. -DpropertyFile=C:/loremIpsum/config.properties) to specify the path, like

    value="file:${propertyFile}"
    

    since Spring 3.0.? even with default value

    value="file:${propertyFile:C:/foobar/config.properties}"
    

    (Have a look at your OSGi framework on how to set a system property. I am also not sure if the ClassPathResource works well / is recommended in OSGi environments.)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have spring Java config object that loads my properties but does not override
I have an object config which has some properties. I can export this ok,
I have a Java application (non-web) which must read from a properties file. This
I have properties file config.properties where are stored some application wide properties. And I
I have a config file that I read using the RawConfigParser in the standard
I have app.config in m win application, and loggingConfiguration section (enterprise library 4.1). I
I know that you can use java.util.Properties to read Java properties files. See: Java
So, I have springDM managed properties <beans:beans xmlns=http://www.springframework.org/schema/osgi-compendium xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance xmlns:beans=http://www.springframework.org/schema/beans xmlns:osgix=http://www.springframework.org/schema/osgi-compendium xsi:schemaLocation= http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
Say I have a config file in which I have paths to JSON properties.
I have a config.properties file which my JSP page uses to get configurations from.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.