Hello,
I want to execute a C++ lib on Storm and to implement this native lib in a bolt
thought Swig. It doesn't work : I have a problem to submit a storm topology to
my storm cluster.
First, I generated a c++ library. I want to use it in Java with Swig (an
evolved wrapper based on JNI). The swig wrapper generate a java library (.jar)
and a shared library (.so).
Then, I create the jar of the Storm application with Maven. This jar file
contain : my java classes, my swig jar and my shared library (.so).
I include the Swig jar library in the pom.xml with theses following lines :
<dependency>
<groupId>com.example</groupId>
<artifactId>JavaEncoder</artifactId>
<scope>system</scope>
<version>1.0</version>
<systemPath>${project}/src/main/resources/JavaNativeEncoder.jar</systemPath>
</dependency>
I enable the jar generation plug-in in the pom.xml with these following lines :
<build>
<plugins>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<archive>
<manifest>
<mainClass>com.example.JavaEncoder.PerfTopology</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
</plugins>
</build>
When I submit my topology to my cluster, I have the following Error :
Exception in thread "main" java.lang.NoClassDefFoundError:
com/example/JavaEncoder/NativeEncoder
at com.example.JavaEncoder.PerfTopology.main(PerfTopology.java:59)
Caused by: java.lang.ClassNotFoundException:
com.example.JavaEncoder.NativeEncoder
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
I checked that if I unzipped the generated file, the swig class and the .so
file is well contained in the Storm jar file.
To conclude, I don't understand why that does not works if someone have an
idea, i would appreciate it.
Thanks in advance,
Charlie QUILLARD