You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@felix.apache.org by Sahoo <Sa...@Sun.COM> on 2009/06/09 10:50:56 UTC

Why does webconsole optionally imports org.osgi.service.http?

It is interesting to note that webconsole has an optional dependency on 
org.osgi.service.http. How can is expected to work in the absence of 
this package? The activator of webconsole bundle gets 
NoClassDefFoundError as shown below when there is no such package.

INFO: Caused by: java.lang.NoClassDefFoundError: 
org/osgi/service/http/HttpContext
Jun 9, 2009 1:55:52 PM 
INFO:   at 
org.apache.felix.webconsole.internal.OsgiManagerActivator.start(OsgiManagerActivator.java:35)
Jun 9, 2009 1:55:52 PM 
INFO:   at 
org.apache.felix.framework.util.SecureAction.startActivator(SecureAction.java:589)
Jun 9, 2009 1:55:52 PM 
INFO:   at org.apache.felix.framework.Felix.startBundle(Felix.java:1458)

Thanks,
Sahoo

Re: Why does webconsole optionally imports org.osgi.service.http?

Posted by Felix Meschberger <fm...@gmail.com>.
... and fixed in trunk.

Thanks for pointing out.

Regards
Felix

Stuart McCulloch schrieb:
> 2009/6/9 Sahoo <Sa...@sun.com>
> 
>> It is interesting to note that webconsole has an optional dependency on
>> org.osgi.service.http. How can is expected to work in the absence of this
>> package? The activator of webconsole bundle gets NoClassDefFoundError as
>> shown below when there is no such package.
>>
> 
> the webconsole pom currently sets all OSGi services as optional imports:
> 
>    org.osgi.service.*;resolution:=optional
> 
> because most of the services it uses are in fact optional, so it's probably
> just accidental that the HTTP service gets marked as optional along with
> the rest
> 
> adding an entry for org.osgi.service.http before the wildcard without any
> optional setting seems to solve this:
> 
> Index: pom.xml
> ===================================================================
> --- pom.xml     (revision 782897)
> +++ pom.xml     (working copy)
> @@ -86,6 +86,7 @@
>                              org.apache.felix.webconsole.*,
>                          </Private-Package>
>                          <Import-Package>
> +                            org.osgi.service.http,
>                              org.apache.felix.scr;
>                              org.apache.felix.shell;
>                              org.osgi.service.*;resolution:=optional,
> 
> 
>> INFO: Caused by: java.lang.NoClassDefFoundError:
>> org/osgi/service/http/HttpContext
>> Jun 9, 2009 1:55:52 PM INFO:   at
>> org.apache.felix.webconsole.internal.OsgiManagerActivator.start(OsgiManagerActivator.java:35)
>> Jun 9, 2009 1:55:52 PM INFO:   at
>> org.apache.felix.framework.util.SecureAction.startActivator(SecureAction.java:589)
>> Jun 9, 2009 1:55:52 PM INFO:   at
>> org.apache.felix.framework.Felix.startBundle(Felix.java:1458)
>>
>> Thanks,
>> Sahoo
>>
> 

Re: Why does webconsole optionally imports org.osgi.service.http?

Posted by Stuart McCulloch <mc...@gmail.com>.
2009/6/9 Sahoo <Sa...@sun.com>

> It is interesting to note that webconsole has an optional dependency on
> org.osgi.service.http. How can is expected to work in the absence of this
> package? The activator of webconsole bundle gets NoClassDefFoundError as
> shown below when there is no such package.
>

the webconsole pom currently sets all OSGi services as optional imports:

   org.osgi.service.*;resolution:=optional

because most of the services it uses are in fact optional, so it's probably
just accidental that the HTTP service gets marked as optional along with
the rest

adding an entry for org.osgi.service.http before the wildcard without any
optional setting seems to solve this:

Index: pom.xml
===================================================================
--- pom.xml     (revision 782897)
+++ pom.xml     (working copy)
@@ -86,6 +86,7 @@
                             org.apache.felix.webconsole.*,
                         </Private-Package>
                         <Import-Package>
+                            org.osgi.service.http,
                             org.apache.felix.scr;
                             org.apache.felix.shell;
                             org.osgi.service.*;resolution:=optional,


> INFO: Caused by: java.lang.NoClassDefFoundError:
> org/osgi/service/http/HttpContext
> Jun 9, 2009 1:55:52 PM INFO:   at
> org.apache.felix.webconsole.internal.OsgiManagerActivator.start(OsgiManagerActivator.java:35)
> Jun 9, 2009 1:55:52 PM INFO:   at
> org.apache.felix.framework.util.SecureAction.startActivator(SecureAction.java:589)
> Jun 9, 2009 1:55:52 PM INFO:   at
> org.apache.felix.framework.Felix.startBundle(Felix.java:1458)
>
> Thanks,
> Sahoo
>

-- 
Cheers, Stuart