If you actually want to shade cassandra the following works. You just need to add the maven bundle plugin to this, you'll have a complete cassandra bundle that contains all the necessary bits and pieces.
<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <parent> <artifactId>bundles</artifactId> <groupId>com.savoirtech</groupId> <version>1.0-SNAPSHOT</version> </parent> <modelVersion>4.0.0</modelVersion> <artifactId>cassandra-all</artifactId> <packaging>bundle</packaging> <dependencies> <dependency> <groupId>org.apache.cassandra</groupId> <artifactId>cassandra-all</artifactId> </dependency> </dependencies> <build> <plugins> <plugin> <artifactId>maven-shade-plugin</artifactId> <executions> <execution> <phase>package</phase> <goals> <goal>shade</goal> </goals> <configuration> <artifactSet> <includes> <include>${pkgGroupId}:${pkgArtifactId}</include> </includes> </artifactSet> <filters> <filter> <artifact>${pkgGroupId}:${pkgArtifactId}</artifact> <excludes> <exclude>**</exclude> </excludes> </filter> </filters> <promoteTransitiveDependencies>true</promoteTransitiveDependencies> <createDependencyReducedPom>false</createDependencyReducedPom> <keepDependenciesWithProvidedScope>true</keepDependenciesWithProvidedScope> </configuration> </execution> </executions> </plugin> </plugins> </build> <properties> <pkgVersion>${cassandra.version}</pkgVersion> <pkgArtifactId>commons-codec</pkgArtifactId> <savoirtech.osgi.export.pkg>org.apache.cassandra.*;version=${cassandra.version}, org.apache.thrift.*;version=${cassandra.version} </savoirtech.osgi.export.pkg> <pkgGroupId>cassandra-all</pkgGroupId> </properties> </project> On Jun 22, 2012, at 9:17 PM, Chris Geer wrote: > > On Fri, Jun 22, 2012 at 7:46 PM, ramesh chandra <[email protected]> wrote: > On 06/22/2012 09:08 PM, Chris Geer wrote: >> On Fri, Jun 22, 2012 at 5:12 PM, ramesh chandra <[email protected]> wrote: >> I have wrapped an external library ( Cassandra - Hector Client ) as a bundle >> , but I am constantly getting a ClassNotFoundException. So , I tried passing >> the missing (Thrift Library) after wrapping as a bundle, but it does not >> help either. >> >> How did you go about making it a bundle? >> >> Is there any other way I can explicitly make one bundle aware of other ? >> >> You need to make sure two things happen. Your Cassandra bundle exports the >> correct packages and your other bundle imports the correct packages. >> >> Just in case if anyone has see it , this is the error >> >> Caused by: java.lang. ClassNotFoundException: org.apache.thrift.transport. >> TTransportException not found by me.prettyprint.hector [169] >> >> at org.apache.felix.framework. ModuleImpl. findClassOrResourceByDelegatio >> n(ModuleImpl.java:787) >> at org.apache.felix.framework. ModuleImpl.access$400( ModuleImpl.java:71) >> at org.apache.felix.framework. ModuleImpl$ModuleClassLoader. >> loadClass(ModuleImpl.java: 1768) >> at java.lang.ClassLoader. loadClass(ClassLoader.java: 247)[:1.6.0_26] >> >> ... 41 more >> >> appreciate any help >> >> kind regards, >> Ramesh >> > Hi Chris, > > Thanks for the input. Karaf has a beautiful wrapper for external library > osgi:install wrap:mvn:Group/Artifact/version does a quick and easy install. > > Have you checked the imports/exports of your bundles? From the Karaf console > "headers <bundle-id>". > > regards, > Ramesh >
