You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@felix.apache.org by erwo <er...@softwaremind.pl> on 2008/08/26 14:18:04 UTC

problem with apache felix

I’ve got two simple bundles. One of them register simple function that other
bundles can use. This function uses libraries from log4j. The second bundle
is responsible for testing the first bundle by callings its method.
When I run Apache Felix I enter a profile on which I haven’t started any
service before. Then I run the first service (the one using log4j library) –
it registers with no problems. After that I run the second service (which is
supposed to use the first one). The second service finds the first one and
use its function. This can be seen on picture nr 1
http://www.nabble.com/file/p19160847/pic1.gif 
After uninstalling the first and second service I try to run both of them
the second time in the same order. When I start the first service there is
no problems. Unfortunately after running the second one I get an exception.
This can be seen under picture nr 2.
http://www.nabble.com/file/p19160847/pic2.gif 
The question is why after running those two services for the first time I’m
not getting any exceptions, but when trying to run them the second time
(even though they were uninstalled before) I get an exception ?
-- 
View this message in context: http://www.nabble.com/problem-with-apache-felix-tp19160847p19160847.html
Sent from the Apache Felix - Users mailing list archive at Nabble.com.


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


Re: problem with apache felix

Posted by Karl Pauls <ka...@gmail.com>.
Try to refresh after you uninstalled. Then it should work.

If that is the case then the  exception you see is because you don't
check whether you actually got a service reference from
context.getServiceReference for your service before calling
context.getService.

The reason is that  the packages of the old bundle revision are still
around and the new revision of the bundle is wired to them.
Subsequently, the new service is filtered out of the result of
context.getServiceReference because it uses a different revision of
the package. Have a look at the FAQ:
http://felix.apache.org/site/apache-felix-osgi-faq.html

To fix this situation you should make your bundle import what it exports i.e.,

Export-Package: pl.softwaremind
Import-Package: org.osgi.framework, pl.softwaremind

Hope this helps?

regards,

Karl

On Tue, Aug 26, 2008 at 2:18 PM, erwo <er...@softwaremind.pl> wrote:
>
> I've got two simple bundles. One of them register simple function that other
> bundles can use. This function uses libraries from log4j. The second bundle
> is responsible for testing the first bundle by callings its method.
> When I run Apache Felix I enter a profile on which I haven't started any
> service before. Then I run the first service (the one using log4j library) –
> it registers with no problems. After that I run the second service (which is
> supposed to use the first one). The second service finds the first one and
> use its function. This can be seen on picture nr 1
> http://www.nabble.com/file/p19160847/pic1.gif
> After uninstalling the first and second service I try to run both of them
> the second time in the same order. When I start the first service there is
> no problems. Unfortunately after running the second one I get an exception.
> This can be seen under picture nr 2.
> http://www.nabble.com/file/p19160847/pic2.gif
> The question is why after running those two services for the first time I'm
> not getting any exceptions, but when trying to run them the second time
> (even though they were uninstalled before) I get an exception ?
> --
> View this message in context: http://www.nabble.com/problem-with-apache-felix-tp19160847p19160847.html
> Sent from the Apache Felix - Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
>
>



-- 
Karl Pauls
karlpauls@gmail.com

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