On 06/25/2012 06:13 PM, Johan Edstrom wrote:
The other missing pieces here probably are :

Starting Cassandra :

  System.setProperty("cassandra.config", 
"file:///Users/joed/opensource/le-esb/esb/target/esb-1.0-SNAPSHOT/etc/cassandra.yaml");
         System.setProperty("cassandra.rpc_port", "9160");
         System.setProperty("cassandra-foreground", "true"); //If this isn't 
true you hose the console on karaf.

         cassandraThread = new Thread(new DataBaseDaemon());
         cassandraThread.setDaemon(true);
         cassandraThread.start();

You probably also need to extend the abstractcassandra daemon / copy it 
over/override

(Which was the reason I shaded I think, I could add/modify/change stuff)

/je


On Jun 25, 2012, at 4:55 PM, David Jencks wrote:

Hi Johan,

I think he'll need the parent pom's maven-bundle-plugin configuration to make 
sense of the properties.

I don't understand the shade plugin very well, are you actually changing 
package names here or just putting a lot of jars together into one?
If the latter, why do you need the shade plugin rather than just using bnd?

hoping to learn :-)

thanks
david jencks

On Jun 25, 2012, at 6:49 PM, Johan Edstrom wrote:

If I remember correctly, that is a split package.
I think I posted a shade earlier, here is a complete bundle

<?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>apache-cassandra</artifactId>
   <version>${cassandra.version}</version>
   <type>pom</type>
</dependency>
<dependency>
   <groupId>org.apache.cassandra</groupId>
   <artifactId>cassandra-all</artifactId>
   <version>${cassandra.version}</version>
   <exclusions>
     <exclusion>
       <groupId>com.googlecode.concurrentlinkedhashmap</groupId>
       <artifactId>concurrentlinkedhashmap-lru</artifactId>
     </exclusion>
   </exclusions>
</dependency>
<dependency>
   <groupId>com.googlecode.concurrentlinkedhashmap</groupId>
   <artifactId>concurrentlinkedhashmap-lru</artifactId>
   <version>1.3</version>
</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>cassandra-all</pkgArtifactId>
<savoirtech.osgi.import>
   !javax.inject,
   !javax.mail.internet,
   !jline,
   !joptsimple,
   !junit.framework,
   !sun.misc,
   com.google.inject.internal*;resolution:=optional,
   com.sun.jna ;resolution:=optional,
   com.thoughtworks.paranamer;resolution:=optional,
   edu.emory.mathcs.backport.java.util;resolution:=optional,
   javax.servlet*;resolution:=optional,
   kaffe*;resolution:=optional,
   org.apache.commons.httpclient*;resolution:=optional,
   org.apache.commons.jxpath*;resolution:=optional,
   org.apache.env*;resolution:=optional,
   org.apache.hadoop*;resolution:=optional,
   org.apache.http*;resolution:=optional,
   org.apache.log*;resolution:=optional,
   org.apache.pig*;resolution:=optional,
   org.apache.tools.ant*;resolution:=optional,,
   org.jboss.netty*;resolution:=optional,
   org.mortbay*;resolution:=optional,
   *
</savoirtech.osgi.import>
<savoirtech.osgi.export>
   org.apache.cassandra*;version=1.1.1,
   org.apache.thrift*;-split-package:=merge-first,
</savoirtech.osgi.export>
<savoirtech.osgi.private.pkg>
   antlr*,
   com.google.inject.internal*,
   com.ning.compress.lzf,
   com.sun.jna,
   org.yaml*,
   org.cliffc.high_scale_lib*,
   com.google*,
   com.googlecode*,
   com.googlecode.concurrentlinkedhashmap,
   edu.stanford.ppl.concurrent*,
   org.apache.avro*,
   org.codehaus.jackson*,
   org.antlr*,
   org.apache.commons*;-split-package:=merge-first,
   org.github*,
   org.xerial*,
   com.yammer*
</savoirtech.osgi.private.pkg>
<savoirtech.osgi.embed>concurrentlinkedhashmap-lru,cassandra-all</savoirtech.osgi.embed>
<pkgGroupId>cassandra-all</pkgGroupId>
</properties>
</project>


On Jun 25, 2012, at 3:16 PM, ramesh chandra wrote:

I am getting this error

Caused by: java.lang.NoClassDefFoundError: 
org/apache/thrift/transport/TTransportException
........

Caused by: java.lang.ClassNotFoundException: 
org.apache.thrift.transport.TTransportException not found by 
me.prettyprint.hector [193]

I have provided all the required dependencies, but for some reason , there is 
one 'libthrift' that can not be found by the server during runtime.

I am not sure if what I attempted below is right and please correct me if there 
is a right way.

in the config.properties file , I added
org.osgi.framework.system.packages.extra=libthrift-0.6.1; version="0.6.1"

also I copied the jar in apache-karaf-2.2.7/lib folder

this did not help, but I am not sure what is the right way to make karaf aware 
of libthrift.

I also tried to install it as a bundle, but it did not help.

What I am trying to accomplish is to add org.apache.thrift / libthrift

to this list  on System.getProperty("java.class.path")


/home/ramesh/Documents/osgiFramework/apache-karaf-2.2.7/lib/karaf-jaas-boot.jar:/home/ramesh/Documents/osgiFramework/apache-karaf-2.2.7/lib/karaf.jar





Any help would be appreciated

regards,
Ramesh


Solution:

Just in case if you happen to user Hector for your OSGI bundle and you are getting classnotfound error messages,

there are the artifacts that you would need to pass as a bundle (tested only with Karaf)

 hector-core (1.0.0.5)
org.apache.thrift_libthrift_0.6.1 (0)
org.apache.httpcomponents_httpclient_4.2 (0)
org.apache.httpcomponents_httpcore_4.2 (0)
org.apache.avro_avro_1.6.3 (0)
Commons CLI (1.2)
org.apache.cassandra_cassandra-thrift_1.0.9 (0)
org.apache.cassandra_cassandra-clientutil_1.0.9 (0)


How to bundle ?
Wrapping up external artifact/library as an OSGI bundle for Karaf install

osgi:install wrap:mvn:Group/Artifact/version
example: osgi:install wrap:mvn:me.prettyprint/hector-core/1.0-5

Hope this will help someone

best regards
Ramesh

Reply via email to