[ 
https://issues.apache.org/jira/browse/ZOOKEEPER-1334?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13173307#comment-13173307
 ] 

Claus Ibsen commented on ZOOKEEPER-1334:
----------------------------------------

Benjamin,

Testing OSGi is not super easy, but there is a OSS project called Pax-Exam that 
has an OSGi based test kit.
We use this for other Apache project such as: Camel, ActiveMQ, etc.

There is a pax exam 2.x release which is even better. We have not yet upgrade 
from 1.x to 2.x in Camel, as its a bit work to do.
The 2.x should be much faster and allows to do in-jvm debugging etc. The 1.x is 
slow and it fork a jvm for testing. And it downloads a lot of JARs etc.
http://team.ops4j.org/wiki/display/paxexam/Pax+Exam

That was the reason we discovered this as we upgraded camel-zookeeper from 
3.3.4 to 3.4.1 and our osgi based test failed.
The regular junit test passed of course.

At Apache Camel we have 2 kind of osgi tests
- karaf feature test [1]
- osgi unit tests [2]

The former is just a test that the camel components can be installed in an osgi 
runtime such as Apache Karaf. This test will frankly bootup Apache Karaf and 
then do an osgi install of the bundles. That way we can often spot 3rd party 
JARs which is not OSGi compliant.

The latter is real full blown osgi unit tests, where we use the components and 
do something.

For a quick test, you may in Zookeeper, have the first kind of test, where you 
will install zookeeper as a bundle in an osgi runtime, such as apache karaf (it 
can test with using felix, equinox as osgi framework). 



1) - https://svn.apache.org/repos/asf/camel/trunk/tests/camel-itest-karaf/
2) - https://svn.apache.org/repos/asf/camel/trunk/tests/camel-itest-osgi/
                
> Zookeeper 3.4.x is not OSGi compliant - MANIFEST.MF is flawed
> -------------------------------------------------------------
>
>                 Key: ZOOKEEPER-1334
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-1334
>             Project: ZooKeeper
>          Issue Type: Bug
>    Affects Versions: 3.4.0
>            Reporter: Claus Ibsen
>
> In Zookeeper 3.3.x you use log4j for logging, and the maven dep is
> eg from 3.3.4
> {code}
>     <dependency>
>       <groupId>log4j</groupId>
>       <artifactId>log4j</artifactId>
>       <version>1.2.15</version>
>       <scope>compile</scope>
>     </dependency>
> {code}
> Now in 3.4.0 or better you changed to use slf4j also/instead. The maven 
> pom.xml now includes:
> {code}
>   <dependency>
>       <groupId>org.slf4j</groupId>
>       <artifactId>slf4j-api</artifactId>
>       <version>1.6.1</version>
>       <scope>compile</scope>
>     </dependency>
>     <dependency>
>       <groupId>org.slf4j</groupId>
>       <artifactId>slf4j-log4j12</artifactId>
>       <version>1.6.1</version>
>       <scope>compile</scope>
>     </dependency>
>     <dependency>
>       <groupId>log4j</groupId>
>       <artifactId>log4j</artifactId>
>       <version>1.2.15</version>
>       <scope>compile</scope>
>     </dependency>
> {code}
> But the META-INF/MANIFEST.MF file in the distribution did not change to 
> reflect this.
> The 3.3.4 MANIFEST.MF, import packages
> {code}
> Import-Package: javax.management,org.apache.log4j,org.osgi.framework;v
>  ersion="[1.4,2.0)",org.osgi.util.tracker;version="[1.1,2.0)"
> {code}
> And the 3.4.1 MANIFEST.MF, import packages:
> {code}
> Import-Package: javax.management,org.apache.log4j,org.osgi.framework;v
>  ersion="[1.4,2.0)",org.osgi.util.tracker;version="[1.1,2.0)"
> {code}
> This makes using zookeeper 3.4.x in OSGi environments not possible, as we get 
> NoClassDefFoundException for slf4j classes.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to