7
ERROR [WRITE-/10.10.35.30] 2013-06-19 23:15:56,907 CassandraDaemon.java (line 175) Exception in thread Thread[WRITE-/10.10.35.30,5,main]
java.lang.NoClassDefFoundError: Could not initialize class org.xerial.snappy.Snappy
    at org.xerial.snappy.SnappyOutputStream.<init>(SnappyOutputStream.java:79)
    at org.xerial.snappy.SnappyOutputStream.<init>(SnappyOutputStream.java:66)
    at org.apache.cassandra.net.OutboundTcpConnection.connect(OutboundTcpConnection.java:341)
    at org.apache.cassandra.net.OutboundTcpConnection.run(OutboundTcpConnection.java:143)

When going through know issues i found this The native library snappy-1.0.4.1-libsnappyjava.so for Snappy compression is included in the snappy-java-1.0.4.1.jar file. When the JVM initializes the JAR, the library is added to the default temp directory. If the default temp directory is mounted with a noexec option, it results in the above exception.

i added JVM_OPTS=-Dorg.xerial.snappy.tempdir=/tmp in cassandra.in.sh and it still didnot work. i also tried specifying the temp directory directly

./bin/cassandra -Dorg.xerial.snappy.tempdir=/tmp

On the same machine cassandra version 1.0.12 works fine.

Any help will be appreciated.

abhi
  • 4,762
  • 4
  • 29
  • 49
sushil
  • 165
  • 1
  • 9
  • 1
    Are you running the thing on single node? If so can go to cassandra.yaml and change internode_compression to none and restart the server – abhi Jun 22 '13 at 04:29
  • I had the same problem on RHEL5.9 when running integration tests with EmbeddedCassandra, but the fix suggested by abhi did the trick. Thanks! – Eemeli Kantola Aug 20 '13 at 05:39

2 Answers2

5

The problem is that there is no FreeBSD library included in the snappy JAR file that comes with Cassandra. Install the archivers/snappy-java port, delete the snappy-java JAR file that came with Cassandra, and copy /usr/local/share/java/classes/snappy-java.jar into Cassandra's lib directory.

jcamins
  • 51
  • 1
  • 2
2

Same problem happened when trying to enable snappy compression for apache kafka 0.8 on FreeBSD but the solution was the same. Just copy /usr/local/share/java/classes/snappy-java.jar to the kafka/src/core/target/scala-2.8.0 directory, restart kafka and enjoy!

John-Paul Bader
  • 321
  • 3
  • 6