问题
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.
回答1:
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.
回答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!
来源:https://stackoverflow.com/questions/17206891/cassandra-1-2-fails-to-init-snappy-in-freebsd