Hi Christian, The problem seems to be solved, after I placed the bundle properties into the system.properties file. However, the /data folder needs to be removed before starting karaf. This could be why it didn't work the first time I tried to use system.properties file.
Anyway, thanks a lot for your suggestion. Best, Sam On Tue, Aug 7, 2012 at 4:14 PM, Christian Schneider <[email protected] > wrote: > Hi Sam, > > how did you read the config.ini? Did you directly open a File using the > relative path configuration/config.ini? This could also work in Karaf but > is not really recommended as you should not assume where the current > directory is. So using the config admin service would be the recommended > way to do configurations in OSGi. On the other hand I am not sure plain > Equinox already has a working config admin service implementation. > So you may have to install the felix config admin service impl and felix > file install to get the same functionality. > > Christian > > > Am 07.08.2012 20:31, schrieb Sam Liu: > > Thank you, Christian. I am aware of your tutorial, and have been trying to > follow that. > > Just wanted to make it clear, please allow me to describe my problem > again: > > I have two OSGi bundles which were running under Equinox OSGi framework. > The two bundles would read some properties/parameters when they started, > e.g., host ip address, port, container name, etc., from the > configuration/config.ini file under the Equinox framework. > > Now when I deploy the two bundles into karaf /deploy folder, the two > bundles would try to start when karaf starts, but they quickly failed since > they are not able to read the properties/parameters, no matter where I put > these properties, in the etc/config.properties or system.properties or > my.bundle.name.cfg files. > > So back to what you have suggested, a fundamental question I have is do > I need to recreate my bundle using config admin service? > > Thanks! > > Sam > > > On Tue, Aug 7, 2012 at 1:52 PM, Christian Schneider < > [email protected]> wrote: > >> Hi Sam, >> >> If you are talking about configuration properties for your bundles then >> you should consider using the config admin service. >> See: >> http://www.liquid-reality.de/display/liquid/2011/09/23/Karaf+Tutorial+Part+2+-+Using+the+Configuration+Admin+Service >> >> Karaf also allows to access the properties from etc/system.properties as >> System.getProperty("...") >> >> Christian >> >> Am 07.08.2012 17:20, schrieb Sam Liu: >> >> Hi guys, >>> >>> I have a few OSGi bundles written using Equinox, and they were deployed >>> under the Equinox framework. Now I am trying to deploy them under Karaf. >>> However, I have some properties that these bundles would read from the >>> /configuration/config.ini file under the Equinox framework before the >>> bundles start. Under Karaf, I am having troubles to find the place/file to >>> store those bundle properties. >>> >>> I tried to follow some online posts, and but they seem to be a bit >>> complicated than how Equinox framework handles this. Is there a particular >>> file that I can just put these bundle properties in? I also tried to create >>> a mybundlename.cfg file in the /etc folder. However, it didn't work. Could >>> anyone please tell me what I should do? >>> >>> Many thanks! >>> >>> Sam >>> >> >> >> -- >> Christian Schneider >> http://www.liquid-reality.de >> >> Open Source Architect >> Talend Application Integration Division http://www.talend.com >> >> > > > -- > > Christian Schneiderhttp://www.liquid-reality.de > > Open Source Architect > Talend Application Integration Division http://www.talend.com > >
