You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@felix.apache.org by "John E. Conlon" <jc...@verticon.com> on 2007/02/01 00:41:16 UTC
Re: Require-Bundle testing
Tried again after today's commit. Good news is the I am resolving.
But not starting my activator. NoClassDefFoundError:
org/osgi/framework/BundleContext??
Welcome to Felix.
=================
DEBUG: WIRE: 1.0 -> org.osgi.service.packageadmin -> 0
DEBUG: WIRE: 1.0 -> org.osgi.service.startlevel -> 0
DEBUG: WIRE: 1.0 -> org.ungoverned.osgi.service.shell -> 1.0
DEBUG: WIRE: 1.0 -> org.osgi.framework -> 0
DEBUG: WIRE: 1.0 -> org.apache.felix.shell -> 1.0
DEBUG: WIRE: 2.0 -> org.osgi.framework -> 0
DEBUG: WIRE: 2.0 -> org.apache.felix.shell -> 1.0
DEBUG: WIRE: 4.0 -> org.slf4j.spi -> 3.0
DEBUG: WIRE: 4.0 ->
module;bundle-symbolic-name="slf4j.api";bundle-version="1.3.0.SNAPSHOT"
-> 3.0
DEBUG: WIRE: 5.0 -> org.slf4j -> 4.0
DEBUG: WIRE: 5.0 -> org.slf4j.impl -> 4.0
ERROR: Error starting
file:/home/jconlon/.m2/repository/org/slf4j/slf4j-osgi-test/1.3-SNAPSHOT/slf4j-osgi-test-1.3-SNAPSHOT.jar
(org.osgi.framework.BundleException: Activator start error.)
java.lang.NoClassDefFoundError: org/osgi/framework/BundleContext
at org.slf4j.osgi.test.Activator.start(Activator.java:48)
at
org.apache.felix.framework.util.SecureAction.startActivator(SecureAction.java:509)
at org.apache.felix.framework.Felix._startBundle(Felix.java:1298)
at org.apache.felix.framework.Felix.startBundle(Felix.java:1239)
at
org.apache.felix.framework.Felix.setFrameworkStartLevel(Felix.java:834)
at
org.apache.felix.framework.StartLevelImpl.run(StartLevelImpl.java:256)
at java.lang.Thread.run(Thread.java:595)
-> ps
START LEVEL 2
ID State Level Name
[ 0] [Active ] [ 0] System Bundle (0.9.0.incubator-SNAPSHOT)
[ 1] [Active ] [ 1] Apache Felix Shell Service
(0.9.0.incubator-SNAPSHOT)
[ 2] [Active ] [ 1] Apache Felix Shell TUI
(0.9.0.incubator-SNAPSHOT)
[ 3] [Active ] [ 2] slf4j-api (1.3.0.SNAPSHOT)
[ 4] [Active ] [ 2] slf4j-nop (1.3.0.SNAPSHOT)
[ 5] [Resolved ] [ 2] slf4j-osgi-test (1.3.0.SNAPSHOT)
-> John
John E. Conlon wrote:
> Hi Chris and Richard,
>
> Thanks for the update. Will await your commit.
>
> cheers,
> John
>
>
> Richard S. Hall wrote:
>> Chris is correct, it is not committed yet, only the generic resolver
>> code is committed.
>>
>> From what I can see, I am really close to committing an initial
>> "loose" implementation of require-bundle. I have been running my
>> workspace code against the TCK and we are passing some of the
>> require-bundle test cases and not breaking existing test suites.
>>
>> I am definitely not waiting until everything is completely done
>> before I check stuff in; however, there are a few issues I would like
>> to resolve before I check in what I have.
>>
>> I am hoping to have this initial commit by the end of the week. Keep
>> your fingers crossed.
>>
>> -> richard
>>
>> On Jan 30, 2007, at 6:14 PM, Chris Custine wrote:
>>
>>> Your headers look perfectly fine to me, but the Require-Bundle code
>>> hasn't
>>> been checked in yet. I chatted with Richard yesterday and he was about
>>> finished so it shouldn't be too much longer.
>>>
>>> Chris
>>>
>>> On 1/30/07, John E. Conlon <jc...@verticon.com> wrote:
>>>>
>>>> Hi Richard,
>>>>
>>>> The slf4j logging framework is now being offered as OSGi bundles, but
>>>> the caveat is that slf4j is using 'Split Packages' and uses
>>>> Require-Bundles. Tried the latest build to test these bundles but
>>>> can't
>>>> see all classes in the split packages. I know you were working on
>>>> Required-Bundle - Is Require-Bundle operational in the framework yet?
>>>>
>>>> Here is what the two sl4fj bundles look like:
>>>>
>>>> Bundle (3.0) - slf4j-api:
>>>> Export-Package: org.slf4j.spi,
>>>> org.slf4j;partial=true;mandatory:=partial,
>>>> org.slf4j.impl;partial=true;mandatory:=partial
>>>>
>>>> Bundle (4.0) - slf4j-nop:
>>>> Require-Bundle: slf4j.api;visibility:=reexport
>>>> Export-Package: org.slf4j, org.slf4j.impl
>>>> Import-Package: org.slf4j.spi
>>>> (Note:
>>>> - contains classes on split packages org.slf4j and org.slf4j.impl.
>>>> - uses classes on org.slf4j, org.slf4j.impl, org.slf4j.spi)
>>>>
>>>> As I understand Require-Bundle; a client bundle (5.0 in the runtime)
>>>> that imports org.sl4fj and org.slf4j.impl packages will get them from
>>>> the slf4j-nop Bundle (4.0) which will have gotten them from bundle
>>>> (3.0). Since the packages are both split-packages they contain a
>>>> superset of classes that are contained in both the sl4j-api (3.0) and
>>>> slf4j-nop (4.0) bundles. As a separate import the org.slf4j.spi
>>>> should
>>>> be imported by the slf4j-nop bundle (4.0) from bundle(3.0).
>>>>
>>>> When I start the runtime here is what happens...
>>>>
>>>> Wiring looks good: (I think?)
>>>> DEBUG: WIRE: 1.0 -> org.osgi.service.packageadmin -> 0
>>>> DEBUG: WIRE: 1.0 -> org.osgi.service.startlevel -> 0
>>>> DEBUG: WIRE: 1.0 -> org.ungoverned.osgi.service.shell -> 1.0
>>>> DEBUG: WIRE: 1.0 -> org.osgi.framework -> 0
>>>> DEBUG: WIRE: 1.0 -> org.apache.felix.shell -> 1.0
>>>> DEBUG: WIRE: 2.0 -> org.osgi.framework -> 0
>>>> DEBUG: WIRE: 2.0 -> org.apache.felix.shell -> 1.0
>>>> DEBUG: WIRE: 4.0 -> org.slf4j.spi -> 3.0
>>>> DEBUG: WIRE: 5.0 -> org.slf4j -> 4.0
>>>> DEBUG: WIRE: 5.0 -> org.slf4j.impl -> 4.0
>>>>
>>>> But when my slf4j-osgi-test bundle (5.0) starts and the activator is
>>>> called I get:
>>>> java.lang.NoClassDefFoundError: org/slf4j/ILoggerFactory
>>>> at org.slf4j.LoggerFactory.<clinit>(LoggerFactory.java:65)
>>>> at org.slf4j.osgi.test.Activator.<init>(Activator.java:36)
>>>> at
>>>> sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
>>>> Method)
>>>> at
>>>> sun.reflect.NativeConstructorAccessorImpl.newInstance(
>>>> NativeConstructorAccessorImpl.java:39)
>>>> at
>>>> sun.reflect.DelegatingConstructorAccessorImpl.newInstance(
>>>> DelegatingConstructorAccessorImpl.java:27)
>>>> at
>>>> java.lang.reflect.Constructor.newInstance(Constructor.java:494)
>>>> at java.lang.Class.newInstance0(Class.java:350)
>>>> at java.lang.Class.newInstance(Class.java:303)
>>>> at
>>>> org.apache.felix.framework.Felix.createBundleActivator(Felix.java:2914)
>>>>
>>>> at
>>>> org.apache.felix.framework.Felix._startBundle(Felix.java:1293)
>>>> at
>>>> org.apache.felix.framework.Felix.startBundle(Felix.java:1239)
>>>> at
>>>> org.apache.felix.framework.Felix.setFrameworkStartLevel(Felix.java:834)
>>>>
>>>> at
>>>> org.apache.felix.framework.StartLevelImpl.run(StartLevelImpl.java:256)
>>>> at java.lang.Thread.run(Thread.java:595)
>>>>
>>>> Note: That class is in the slf4j-nop bundle (4.0).
>>>> -> ps
>>>> START LEVEL 2
>>>> ID State Level Name
>>>> [ 0] [Active ] [ 0] System Bundle (0.9.0.incubator-SNAPSHOT)
>>>> [ 1] [Active ] [ 1] Apache Felix Shell Service
>>>> (0.9.0.incubator-SNAPSHOT)
>>>> [ 2] [Active ] [ 1] Apache Felix Shell TUI
>>>> (0.9.0.incubator-SNAPSHOT)
>>>> [ 3] [Active ] [ 2] slf4j-api (1.3.0.SNAPSHOT)
>>>> [ 4] [Active ] [ 2] slf4j-nop (1.3.0.SNAPSHOT)
>>>> [ 5] [Resolved ] [ 2] slf4j-osgi-test (1.3.0.SNAPSHOT)
>>>>
>>>> It appears that all classes in package org.slf4j of slf4j-nop bundle
>>>> (4.0) are being shadowed by org.slf4j in sl4j-api (3.0).
>>>>
>>>> Are these bundles specifying the Required bundles and Import/Exports
>>>> correctly?
>>>>
>>>> thanks for any insight,
>>>> John
>>>>
>>>>
>>>>
>>>>
>>>>
>>
>>
>>
>
>
>
Re: Require-Bundle testing
Posted by "Richard S. Hall" <he...@ungoverned.org>.
John,
By looking at your debug wiring output, it doesn't appear that bundle 5
imports org.osgi.framework, because there is no wiring being created
for it. Double check bundle 5's manifest to make sure it is importing
it.
If it is, please send me (privately) the three bundles and I will take
a look at it.
-> richard
On Jan 31, 2007, at 6:41 PM, John E. Conlon wrote:
> Tried again after today's commit. Good news is the I am resolving.
> But not starting my activator. NoClassDefFoundError:
> org/osgi/framework/BundleContext??
>
> Welcome to Felix.
> =================
>
> DEBUG: WIRE: 1.0 -> org.osgi.service.packageadmin -> 0
> DEBUG: WIRE: 1.0 -> org.osgi.service.startlevel -> 0
> DEBUG: WIRE: 1.0 -> org.ungoverned.osgi.service.shell -> 1.0
> DEBUG: WIRE: 1.0 -> org.osgi.framework -> 0
> DEBUG: WIRE: 1.0 -> org.apache.felix.shell -> 1.0
> DEBUG: WIRE: 2.0 -> org.osgi.framework -> 0
> DEBUG: WIRE: 2.0 -> org.apache.felix.shell -> 1.0
> DEBUG: WIRE: 4.0 -> org.slf4j.spi -> 3.0
> DEBUG: WIRE: 4.0 ->
> module;bundle-symbolic-name="slf4j.api";bundle-
> version="1.3.0.SNAPSHOT" -> 3.0
> DEBUG: WIRE: 5.0 -> org.slf4j -> 4.0
> DEBUG: WIRE: 5.0 -> org.slf4j.impl -> 4.0
> ERROR: Error starting
> file:/home/jconlon/.m2/repository/org/slf4j/slf4j-osgi-test/1.3-
> SNAPSHOT/slf4j-osgi-test-1.3-SNAPSHOT.jar
> (org.osgi.framework.BundleException: Activator start error.)
> java.lang.NoClassDefFoundError: org/osgi/framework/BundleContext
> at org.slf4j.osgi.test.Activator.start(Activator.java:48)
> at
> org.apache.felix.framework.util.SecureAction.startActivator(SecureActio
> n.java:509)
> at
> org.apache.felix.framework.Felix._startBundle(Felix.java:1298)
> at org.apache.felix.framework.Felix.startBundle(Felix.java:1239)
> at
> org.apache.felix.framework.Felix.setFrameworkStartLevel(Felix.java:
> 834)
> at
> org.apache.felix.framework.StartLevelImpl.run(StartLevelImpl.java:256)
> at java.lang.Thread.run(Thread.java:595)
> -> ps
> START LEVEL 2
> ID State Level Name
> [ 0] [Active ] [ 0] System Bundle (0.9.0.incubator-SNAPSHOT)
> [ 1] [Active ] [ 1] Apache Felix Shell Service
> (0.9.0.incubator-SNAPSHOT)
> [ 2] [Active ] [ 1] Apache Felix Shell TUI
> (0.9.0.incubator-SNAPSHOT)
> [ 3] [Active ] [ 2] slf4j-api (1.3.0.SNAPSHOT)
> [ 4] [Active ] [ 2] slf4j-nop (1.3.0.SNAPSHOT)
> [ 5] [Resolved ] [ 2] slf4j-osgi-test (1.3.0.SNAPSHOT)
>
>
> -> John
>
>
> John E. Conlon wrote:
>> Hi Chris and Richard,
>>
>> Thanks for the update. Will await your commit.
>>
>> cheers,
>> John
>>
>>
>> Richard S. Hall wrote:
>>> Chris is correct, it is not committed yet, only the generic resolver
>>> code is committed.
>>>
>>> From what I can see, I am really close to committing an initial
>>> "loose" implementation of require-bundle. I have been running my
>>> workspace code against the TCK and we are passing some of the
>>> require-bundle test cases and not breaking existing test suites.
>>>
>>> I am definitely not waiting until everything is completely done
>>> before I check stuff in; however, there are a few issues I would
>>> like to resolve before I check in what I have.
>>>
>>> I am hoping to have this initial commit by the end of the week. Keep
>>> your fingers crossed.
>>>
>>> -> richard
>>>
>>> On Jan 30, 2007, at 6:14 PM, Chris Custine wrote:
>>>
>>>> Your headers look perfectly fine to me, but the Require-Bundle code
>>>> hasn't
>>>> been checked in yet. I chatted with Richard yesterday and he was
>>>> about
>>>> finished so it shouldn't be too much longer.
>>>>
>>>> Chris
>>>>
>>>> On 1/30/07, John E. Conlon <jc...@verticon.com> wrote:
>>>>>
>>>>> Hi Richard,
>>>>>
>>>>> The slf4j logging framework is now being offered as OSGi bundles,
>>>>> but
>>>>> the caveat is that slf4j is using 'Split Packages' and uses
>>>>> Require-Bundles. Tried the latest build to test these bundles but
>>>>> can't
>>>>> see all classes in the split packages. I know you were working on
>>>>> Required-Bundle - Is Require-Bundle operational in the framework
>>>>> yet?
>>>>>
>>>>> Here is what the two sl4fj bundles look like:
>>>>>
>>>>> Bundle (3.0) - slf4j-api:
>>>>> Export-Package: org.slf4j.spi,
>>>>> org.slf4j;partial=true;mandatory:=partial,
>>>>> org.slf4j.impl;partial=true;mandatory:=partial
>>>>>
>>>>> Bundle (4.0) - slf4j-nop:
>>>>> Require-Bundle: slf4j.api;visibility:=reexport
>>>>> Export-Package: org.slf4j, org.slf4j.impl
>>>>> Import-Package: org.slf4j.spi
>>>>> (Note:
>>>>> - contains classes on split packages org.slf4j and org.slf4j.impl.
>>>>> - uses classes on org.slf4j, org.slf4j.impl, org.slf4j.spi)
>>>>>
>>>>> As I understand Require-Bundle; a client bundle (5.0 in the
>>>>> runtime)
>>>>> that imports org.sl4fj and org.slf4j.impl packages will get them
>>>>> from
>>>>> the slf4j-nop Bundle (4.0) which will have gotten them from bundle
>>>>> (3.0). Since the packages are both split-packages they contain a
>>>>> superset of classes that are contained in both the sl4j-api (3.0)
>>>>> and
>>>>> slf4j-nop (4.0) bundles. As a separate import the org.slf4j.spi
>>>>> should
>>>>> be imported by the slf4j-nop bundle (4.0) from bundle(3.0).
>>>>>
>>>>> When I start the runtime here is what happens...
>>>>>
>>>>> Wiring looks good: (I think?)
>>>>> DEBUG: WIRE: 1.0 -> org.osgi.service.packageadmin -> 0
>>>>> DEBUG: WIRE: 1.0 -> org.osgi.service.startlevel -> 0
>>>>> DEBUG: WIRE: 1.0 -> org.ungoverned.osgi.service.shell -> 1.0
>>>>> DEBUG: WIRE: 1.0 -> org.osgi.framework -> 0
>>>>> DEBUG: WIRE: 1.0 -> org.apache.felix.shell -> 1.0
>>>>> DEBUG: WIRE: 2.0 -> org.osgi.framework -> 0
>>>>> DEBUG: WIRE: 2.0 -> org.apache.felix.shell -> 1.0
>>>>> DEBUG: WIRE: 4.0 -> org.slf4j.spi -> 3.0
>>>>> DEBUG: WIRE: 5.0 -> org.slf4j -> 4.0
>>>>> DEBUG: WIRE: 5.0 -> org.slf4j.impl -> 4.0
>>>>>
>>>>> But when my slf4j-osgi-test bundle (5.0) starts and the activator
>>>>> is
>>>>> called I get:
>>>>> java.lang.NoClassDefFoundError: org/slf4j/ILoggerFactory
>>>>> at org.slf4j.LoggerFactory.<clinit>(LoggerFactory.java:65)
>>>>> at org.slf4j.osgi.test.Activator.<init>(Activator.java:36)
>>>>> at
>>>>> sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
>>>>> Method)
>>>>> at
>>>>> sun.reflect.NativeConstructorAccessorImpl.newInstance(
>>>>> NativeConstructorAccessorImpl.java:39)
>>>>> at
>>>>> sun.reflect.DelegatingConstructorAccessorImpl.newInstance(
>>>>> DelegatingConstructorAccessorImpl.java:27)
>>>>> at
>>>>> java.lang.reflect.Constructor.newInstance(Constructor.java:494)
>>>>> at java.lang.Class.newInstance0(Class.java:350)
>>>>> at java.lang.Class.newInstance(Class.java:303)
>>>>> at
>>>>> org.apache.felix.framework.Felix.createBundleActivator(Felix.java:
>>>>> 2914)
>>>>> at
>>>>> org.apache.felix.framework.Felix._startBundle(Felix.java:1293)
>>>>> at
>>>>> org.apache.felix.framework.Felix.startBundle(Felix.java:1239)
>>>>> at
>>>>> org.apache.felix.framework.Felix.setFrameworkStartLevel(Felix.java:
>>>>> 834)
>>>>> at
>>>>> org.apache.felix.framework.StartLevelImpl.run(StartLevelImpl.java:
>>>>> 256)
>>>>> at java.lang.Thread.run(Thread.java:595)
>>>>>
>>>>> Note: That class is in the slf4j-nop bundle (4.0).
>>>>> -> ps
>>>>> START LEVEL 2
>>>>> ID State Level Name
>>>>> [ 0] [Active ] [ 0] System Bundle
>>>>> (0.9.0.incubator-SNAPSHOT)
>>>>> [ 1] [Active ] [ 1] Apache Felix Shell Service
>>>>> (0.9.0.incubator-SNAPSHOT)
>>>>> [ 2] [Active ] [ 1] Apache Felix Shell TUI
>>>>> (0.9.0.incubator-SNAPSHOT)
>>>>> [ 3] [Active ] [ 2] slf4j-api (1.3.0.SNAPSHOT)
>>>>> [ 4] [Active ] [ 2] slf4j-nop (1.3.0.SNAPSHOT)
>>>>> [ 5] [Resolved ] [ 2] slf4j-osgi-test (1.3.0.SNAPSHOT)
>>>>>
>>>>> It appears that all classes in package org.slf4j of slf4j-nop
>>>>> bundle
>>>>> (4.0) are being shadowed by org.slf4j in sl4j-api (3.0).
>>>>>
>>>>> Are these bundles specifying the Required bundles and
>>>>> Import/Exports
>>>>> correctly?
>>>>>
>>>>> thanks for any insight,
>>>>> John
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>
>>>
>>>
>>
>>
>>
>
Re: Require-Bundle testing
Posted by "John E. Conlon" <jc...@verticon.com>.
Taking a look at my slf4j-osgi-test bundle it did have a problem. It
was not importing the framework!
So require bundle is working for me after all.
thanks,
John
John E. Conlon wrote:
> Tried again after today's commit. Good news is the I am resolving.
> But not starting my activator. NoClassDefFoundError:
> org/osgi/framework/BundleContext??
>
> Welcome to Felix.
> =================
>
> DEBUG: WIRE: 1.0 -> org.osgi.service.packageadmin -> 0
> DEBUG: WIRE: 1.0 -> org.osgi.service.startlevel -> 0
> DEBUG: WIRE: 1.0 -> org.ungoverned.osgi.service.shell -> 1.0
> DEBUG: WIRE: 1.0 -> org.osgi.framework -> 0
> DEBUG: WIRE: 1.0 -> org.apache.felix.shell -> 1.0
> DEBUG: WIRE: 2.0 -> org.osgi.framework -> 0
> DEBUG: WIRE: 2.0 -> org.apache.felix.shell -> 1.0
> DEBUG: WIRE: 4.0 -> org.slf4j.spi -> 3.0
> DEBUG: WIRE: 4.0 ->
> module;bundle-symbolic-name="slf4j.api";bundle-version="1.3.0.SNAPSHOT"
> -> 3.0
> DEBUG: WIRE: 5.0 -> org.slf4j -> 4.0
> DEBUG: WIRE: 5.0 -> org.slf4j.impl -> 4.0
> ERROR: Error starting
> file:/home/jconlon/.m2/repository/org/slf4j/slf4j-osgi-test/1.3-SNAPSHOT/slf4j-osgi-test-1.3-SNAPSHOT.jar
> (org.osgi.framework.BundleException: Activator start error.)
> java.lang.NoClassDefFoundError: org/osgi/framework/BundleContext
> at org.slf4j.osgi.test.Activator.start(Activator.java:48)
> at
> org.apache.felix.framework.util.SecureAction.startActivator(SecureAction.java:509)
>
> at org.apache.felix.framework.Felix._startBundle(Felix.java:1298)
> at org.apache.felix.framework.Felix.startBundle(Felix.java:1239)
> at
> org.apache.felix.framework.Felix.setFrameworkStartLevel(Felix.java:834)
> at
> org.apache.felix.framework.StartLevelImpl.run(StartLevelImpl.java:256)
> at java.lang.Thread.run(Thread.java:595)
> -> ps
> START LEVEL 2
> ID State Level Name
> [ 0] [Active ] [ 0] System Bundle (0.9.0.incubator-SNAPSHOT)
> [ 1] [Active ] [ 1] Apache Felix Shell Service
> (0.9.0.incubator-SNAPSHOT)
> [ 2] [Active ] [ 1] Apache Felix Shell TUI
> (0.9.0.incubator-SNAPSHOT)
> [ 3] [Active ] [ 2] slf4j-api (1.3.0.SNAPSHOT)
> [ 4] [Active ] [ 2] slf4j-nop (1.3.0.SNAPSHOT)
> [ 5] [Resolved ] [ 2] slf4j-osgi-test (1.3.0.SNAPSHOT)
>
>
> -> John
>
>
> John E. Conlon wrote:
>> Hi Chris and Richard,
>>
>> Thanks for the update. Will await your commit.
>>
>> cheers,
>> John
>>
>>
>> Richard S. Hall wrote:
>>> Chris is correct, it is not committed yet, only the generic resolver
>>> code is committed.
>>>
>>> From what I can see, I am really close to committing an initial
>>> "loose" implementation of require-bundle. I have been running my
>>> workspace code against the TCK and we are passing some of the
>>> require-bundle test cases and not breaking existing test suites.
>>>
>>> I am definitely not waiting until everything is completely done
>>> before I check stuff in; however, there are a few issues I would
>>> like to resolve before I check in what I have.
>>>
>>> I am hoping to have this initial commit by the end of the week. Keep
>>> your fingers crossed.
>>>
>>> -> richard
>>>
>>> On Jan 30, 2007, at 6:14 PM, Chris Custine wrote:
>>>
>>>> Your headers look perfectly fine to me, but the Require-Bundle code
>>>> hasn't
>>>> been checked in yet. I chatted with Richard yesterday and he was
>>>> about
>>>> finished so it shouldn't be too much longer.
>>>>
>>>> Chris
>>>>
>>>> On 1/30/07, John E. Conlon <jc...@verticon.com> wrote:
>>>>>
>>>>> Hi Richard,
>>>>>
>>>>> The slf4j logging framework is now being offered as OSGi bundles, but
>>>>> the caveat is that slf4j is using 'Split Packages' and uses
>>>>> Require-Bundles. Tried the latest build to test these bundles but
>>>>> can't
>>>>> see all classes in the split packages. I know you were working on
>>>>> Required-Bundle - Is Require-Bundle operational in the framework yet?
>>>>>
>>>>> Here is what the two sl4fj bundles look like:
>>>>>
>>>>> Bundle (3.0) - slf4j-api:
>>>>> Export-Package: org.slf4j.spi,
>>>>> org.slf4j;partial=true;mandatory:=partial,
>>>>> org.slf4j.impl;partial=true;mandatory:=partial
>>>>>
>>>>> Bundle (4.0) - slf4j-nop:
>>>>> Require-Bundle: slf4j.api;visibility:=reexport
>>>>> Export-Package: org.slf4j, org.slf4j.impl
>>>>> Import-Package: org.slf4j.spi
>>>>> (Note:
>>>>> - contains classes on split packages org.slf4j and org.slf4j.impl.
>>>>> - uses classes on org.slf4j, org.slf4j.impl, org.slf4j.spi)
>>>>>
>>>>> As I understand Require-Bundle; a client bundle (5.0 in the runtime)
>>>>> that imports org.sl4fj and org.slf4j.impl packages will get them from
>>>>> the slf4j-nop Bundle (4.0) which will have gotten them from bundle
>>>>> (3.0). Since the packages are both split-packages they contain a
>>>>> superset of classes that are contained in both the sl4j-api (3.0) and
>>>>> slf4j-nop (4.0) bundles. As a separate import the org.slf4j.spi
>>>>> should
>>>>> be imported by the slf4j-nop bundle (4.0) from bundle(3.0).
>>>>>
>>>>> When I start the runtime here is what happens...
>>>>>
>>>>> Wiring looks good: (I think?)
>>>>> DEBUG: WIRE: 1.0 -> org.osgi.service.packageadmin -> 0
>>>>> DEBUG: WIRE: 1.0 -> org.osgi.service.startlevel -> 0
>>>>> DEBUG: WIRE: 1.0 -> org.ungoverned.osgi.service.shell -> 1.0
>>>>> DEBUG: WIRE: 1.0 -> org.osgi.framework -> 0
>>>>> DEBUG: WIRE: 1.0 -> org.apache.felix.shell -> 1.0
>>>>> DEBUG: WIRE: 2.0 -> org.osgi.framework -> 0
>>>>> DEBUG: WIRE: 2.0 -> org.apache.felix.shell -> 1.0
>>>>> DEBUG: WIRE: 4.0 -> org.slf4j.spi -> 3.0
>>>>> DEBUG: WIRE: 5.0 -> org.slf4j -> 4.0
>>>>> DEBUG: WIRE: 5.0 -> org.slf4j.impl -> 4.0
>>>>>
>>>>> But when my slf4j-osgi-test bundle (5.0) starts and the activator is
>>>>> called I get:
>>>>> java.lang.NoClassDefFoundError: org/slf4j/ILoggerFactory
>>>>> at org.slf4j.LoggerFactory.<clinit>(LoggerFactory.java:65)
>>>>> at org.slf4j.osgi.test.Activator.<init>(Activator.java:36)
>>>>> at
>>>>> sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
>>>>> Method)
>>>>> at
>>>>> sun.reflect.NativeConstructorAccessorImpl.newInstance(
>>>>> NativeConstructorAccessorImpl.java:39)
>>>>> at
>>>>> sun.reflect.DelegatingConstructorAccessorImpl.newInstance(
>>>>> DelegatingConstructorAccessorImpl.java:27)
>>>>> at
>>>>> java.lang.reflect.Constructor.newInstance(Constructor.java:494)
>>>>> at java.lang.Class.newInstance0(Class.java:350)
>>>>> at java.lang.Class.newInstance(Class.java:303)
>>>>> at
>>>>> org.apache.felix.framework.Felix.createBundleActivator(Felix.java:2914)
>>>>>
>>>>> at
>>>>> org.apache.felix.framework.Felix._startBundle(Felix.java:1293)
>>>>> at
>>>>> org.apache.felix.framework.Felix.startBundle(Felix.java:1239)
>>>>> at
>>>>> org.apache.felix.framework.Felix.setFrameworkStartLevel(Felix.java:834)
>>>>>
>>>>> at
>>>>> org.apache.felix.framework.StartLevelImpl.run(StartLevelImpl.java:256)
>>>>>
>>>>> at java.lang.Thread.run(Thread.java:595)
>>>>>
>>>>> Note: That class is in the slf4j-nop bundle (4.0).
>>>>> -> ps
>>>>> START LEVEL 2
>>>>> ID State Level Name
>>>>> [ 0] [Active ] [ 0] System Bundle (0.9.0.incubator-SNAPSHOT)
>>>>> [ 1] [Active ] [ 1] Apache Felix Shell Service
>>>>> (0.9.0.incubator-SNAPSHOT)
>>>>> [ 2] [Active ] [ 1] Apache Felix Shell TUI
>>>>> (0.9.0.incubator-SNAPSHOT)
>>>>> [ 3] [Active ] [ 2] slf4j-api (1.3.0.SNAPSHOT)
>>>>> [ 4] [Active ] [ 2] slf4j-nop (1.3.0.SNAPSHOT)
>>>>> [ 5] [Resolved ] [ 2] slf4j-osgi-test (1.3.0.SNAPSHOT)
>>>>>
>>>>> It appears that all classes in package org.slf4j of slf4j-nop bundle
>>>>> (4.0) are being shadowed by org.slf4j in sl4j-api (3.0).
>>>>>
>>>>> Are these bundles specifying the Required bundles and Import/Exports
>>>>> correctly?
>>>>>
>>>>> thanks for any insight,
>>>>> John
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>
>>>
>>>
>>
>>
>>
>
>
>