Wednesday, December 17, 2014

Error "no snappyjava in java.library.path" when running WSO2 Message Broker 2.2.0 in MAC OS X

The Problem.

When running WSO2 Message Broker 2.2.0 in MAC OS X, you might face the following error on the console.

java.lang.reflect.InvocationTargetException
  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  at java.lang.reflect.Method.invoke(Method.java:606)
  at org.xerial.snappy.SnappyLoader.loadNativeLibrary(SnappyLoader.java:317)
  at org.xerial.snappy.SnappyLoader.load(SnappyLoader.java:219)
  at org.xerial.snappy.Snappy.<clinit>(Snappy.java:44)
  at org.apache.cassandra.io.compress.SnappyCompressor.create(SnappyCompressor.java:45)
  at org.apache.cassandra.io.compress.SnappyCompressor.isAvailable(SnappyCompressor.java:55)
  at org.apache.cassandra.io.compress.SnappyCompressor.<clinit>(SnappyCompressor.java:37)
  at org.apache.cassandra.config.CFMetaData.<clinit>(CFMetaData.java:82)
  at org.apache.cassandra.config.KSMetaData.systemKeyspace(KSMetaData.java:81)
  at org.apache.cassandra.config.DatabaseDescriptor.loadYaml(DatabaseDescriptor.java:491)
  at org.apache.cassandra.config.DatabaseDescriptor.<clinit>(DatabaseDescriptor.java:132)
  at org.apache.cassandra.service.CassandraDaemon.setup(CassandraDaemon.java:216)
  at org.apache.cassandra.service.CassandraDaemon.activate(CassandraDaemon.java:447)
  at org.wso2.carbon.cassandra.server.CassandraServerController$1.run(CassandraServerController.java:67)
  at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.UnsatisfiedLinkError: no snappyjava in java.library.path
  at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1886)
  at java.lang.Runtime.loadLibrary0(Runtime.java:849)
  at java.lang.System.loadLibrary(System.java:1088)
  at org.xerial.snappy.SnappyNativeLoader.loadLibrary(SnappyNativeLoader.java:52)
... 18 more

How to fix the issue.

1. Go to https://github.com/xerial/snappy-java and clone the git to your mac.
2. Once cloned, check the directory. If there are any files inside "target" folder, delete them. Else continue to next step.
3. Open the terminal to the cloned directory and run the "make" command. It might take some time to build.
4. Once the build is completed, go to the following folder - "target/snappy-1.1.1-Mac-x86_64".
5. There you will see a file with name "libsnappyjava.jnilib".
6. Copy this file to WSO2 MB home directory.
7. Now run "./wso2server.sh" in the bin folder.


Hope that fixed your issue !.


2 comments:

  1. Here is a built libsnappyjava.jnilib file.
    https://svn.wso2.org/repos/wso2/scratch/hemikak/libsnappyjava.jnilib

    Note: built on yosemite, did not check with other versions of mac.

    ReplyDelete