Thanks, both hints are very useful. I ended up putting this into a custom library bundle along with some other non-osgi jars. (I'm looking at integrating Parquet and it has 10+ other dependencies including avro and some hadoop libs - it seemed overkill to wrap each in a bundle).
I didn't do it but for the sake of completeness: I found you could use the following when provisioning an p2 site via p2-maven-plugin (https://github.com/reficio/p2-maven-plugin) > <artifact> > <id>org.apache.avro:avro:1.7.7</id> > <source>true</source> > <override>true</override> > <instructions> > <Import-Package>!sun.misc,*;resolution:=optional</Import-Package> > </instructions> > <Bundle-SymbolicName>org.apache.avro</Bundle-SymbolicName> > </artifact> Thanks again. On 01/24/2016 05:56 PM, Fady wrote: > On 22/01/2016 17:15, Bernd Wiswedel wrote: >> Has anyone successfully run Avro in an OSGi environment? There was an >> issue fixed for release 1.7.6 [1] and I also see the 'correct' >> MANIFEST.MF in the build. This is what it looks like (from [2]): >> >>> 29 Implementation-Title: Apache Avro >>> 30 Implementation-Version: 1.7.7 >>> 31 Built-By: cutting >>> 32 Specification-Vendor: The Apache Software Foundation >>> 33 Tool: Bnd-0.0.357 >>> 34 Bundle-Name: Apache Avro >>> 35 Created-By: Apache Maven Bundle Plugin >>> 36 Implementation-Vendor: The Apache Software Foundation >>> 37 Bundle-Vendor: The Apache Software Foundation >>> 38 Implementation-Vendor-Id: org.apache.avro >>> 39 Bundle-Version: 1.7.7 >>> 40 Build-Jdk: 1.7.0_45 >>> 41 Bnd-LastModified: 1405714122455 >>> 42 Bundle-ManifestVersion: 2 >>> 43 Specification-Title: Apache Avro >>> 44 Bundle-Description: Avro core components >>> 45 Bundle-License: http://www.apache.org/licenses/LICENSE-2.0.txt >>> 46 Bundle-DocURL: http://www.apache.org/ >>> 47 Import-Package: >>> com.thoughtworks.paranamer,org.apache.commons.compress >>> 48 >>> .compressors.bzip2;version="1.4",org.apache.commons.compress.compress >>> 49 >>> ors.xz;version="1.4",org.apache.commons.compress.utils;version="1.4", >>> 50 >>> org.codehaus.jackson;version="1.9",org.codehaus.jackson.io;version="1 >>> 51 >>> .9",org.codehaus.jackson.map;version="1.9",org.codehaus.jackson.node; >>> 52 >>> version="1.9",org.codehaus.jackson.util;version="1.9",org.slf4j;versi >>> 53 >>> on="1.6",org.xerial.snappy;resolution:=optional;version="1.0",sun.mis >>> 54 c >>> 55 Bundle-SymbolicName: avro >>> 56 Specification-Version: 1.7.7 >> But then in line 53 it imports a package 'sun.misc', which is part of >> the java environment (and therefore not provided by any other standard >> bundle). Package not available = bundle will not start. I know how to >> work around it but shouldn't that be excluded? >> >> Thanks! >> >> [1] https://issues.apache.org/jira/browse/AVRO-987 >> [2] >> http://search.maven.org/remotecontent?filepath=org/apache/avro/avro/1.7.7/avro-1.7.7.jar >> >> >> > I managed to use avro-1.7.7 in an OSGi environment. You can either use > it directly and get the sun.misc OSGified version here: > > <dependency> > <groupId>com.github.livesense</groupId> > <artifactId>org.liveSense.fragment.sun.misc</artifactId> > <version>1.0.5</version> > </dependency> > > Or use the servicemix rebundling of avro which has less mandatory > dependencies: > > <dependency> > <groupId>org.apache.servicemix.bundles</groupId> > <artifactId>org.apache.servicemix.bundles.avro</artifactId> > <version>1.7.7_1</version> > </dependency> >