felix-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Felix Meschberger <fmesc...@adobe.com>
Subject Re: Using bundle update method
Date Tue, 15 May 2012 11:43:43 GMT

Am 14.05.2012 um 14:54 schrieb Thierry Templier:

> Hello Felix,
> Thanks very much for your answer. I just read the javadoc of the 
> PackageAdmin and it seems that it only applies when the bundle exports 
> packages and it's not the case... Nevertheless I tried to call the 
> refreshPackages method for the updated bundle and I have the same behavior.
> I think I precisely identify where the problem occurs in the code. In 
> fact we have three main bundles:
> - the first one A is the server.
> - the second one B is the application that need to be deployed on the 
> server. The application (and some other hints) are provided through an 
> OSGi service.
> - the third one C is the deployment manager that implement the 
> whiteboard pattern.
> The application registers all resources that it will provide. Something 
> like that:
> register("/path", MyResource.class);
> This is done with the application class within bundle C. Both 
> application and resource are in the same bundle so there is no loading 
> problem.
> When the request is executed for the path, the server tries to determine 
> which is the appropriate method of the resource for the call. It calls 
> using reflection the getDeclaredMethods for the resource class. This 
> class is gotten using the registered application. In this case, I have 
> an class not found exception for a class that corresponds to the return 
> type of a method. This exception only occurs when updating bundle B...
> Hope I'm clear with my explanations...

Not really ...

Bundle C is the manager. But is it really C providing the application classes ?

Me thinks, C registers classes from B. When B is updated the old registered classes must first
be removed and registered again after the update. You can do this either in the BundleActivator.stop
method of B (better) or when receiving the STOPPING event in C.


> Thierry
>> Hi
>> Once you updated the bundle other bundles may still be using the old bundle version.
You have to refresh the bundle wirings for them to be wired to the new bundle.
>> Traditionally this has been done with a call to PackageAdmin.refreshBundles(Bundle[])
(There is now new API to do this, but I do not know it off-hand; but the old is still avaliable).
>> Regards
>> Felix
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org

To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org

View raw message