felix-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jan Willem Janssen <janwillem.jans...@luminis.eu>
Subject Re: Accessing bundle configuration
Date Thu, 04 Jun 2015 05:11:32 GMT

> On 03 Jun 2015, at 23:13, ismail berrada <ismaberrada@yahoo.fr> wrote:
> 
> I developed my own bundle and I would like to change configuration of  publisher connectorI
write the following code:
> ServiceReference configurationAdminReference = bundleContext.getServiceReference(ConfigurationAdmin.class.getName());
>     if(configurationAdminReference != null) {
>         //LOGGER
>         ConfigurationAdmin confAdmin = (ConfigurationAdmin) bundleContext.getService(configurationAdminReference);
>         if(confAdmin != null) {
>                     //LOGGER
> 
>             Configuration configConnector = confAdmin.getConfiguration("com.eclipsesource.jaxrs.connector","inputstream:publisher-4.3.jar");
> //…
>             configConnector.update(props);
>             }
>         }
>     }
> 
> But when I went to the configuration page in the web console I have seen the following
error
> Error: the PID "com.eclipsesource.jaxrs.connector" is bound to "file:/c:/Dev/Tools/Apache/Felix/bundle/mybundle-1.0.0.jar"
but the actual managed service is registered from "inputstream:publisher-4.3.jar" bundle
> Any idea of the root cause. It sounds like I don't have the permission to modify configuration
of other bundles ?Right ? any way to do that ?

The 2nd argument you provide to confAdmin.getConfiguration denotes to what bundle this configuration
should be bound, in your case the “inputstream:publisher-4.3.jar”. WebConsole most probably
doesn’t
know about that bundle-location, and tries to set the configuration without one causing the
error.
Either you should use the same bundle-location in WebConsole (not sure that is possible),
or do not
provide a bundle-location by supplying null as 2nd argument to confAdmin.getConfiguration
implying
that the configuration can be bound to any bundle using the managed service PID.

Hope this helps,

--
Met vriendelijke groeten | Kind regards

Jan Willem Janssen | Software Architect
+31 631 765 814

My world is revolving around INAETICS and Amdatu

Luminis Technologies B.V.
Churchillplein 1
7314 BZ   Apeldoorn
+31 88 586 46 00

http://www.luminis-technologies.com
http://www.luminis.eu

KvK (CoC) 09 16 28 93
BTW (VAT) NL8169.78.566.B.01


Mime
View raw message