问题
The Datastax Java driver supports client-node connection compression using snappy and LZ4. When starting the Java driver it states
WARN [2015-04-28 16:13:59,906] com.datastax.driver.core.FrameCompressor: Cannot find LZ4 class, you should make sure the LZ4 library is in the classpath if you intend to use it. LZ4 compression will not be available for the protocol.
Two questions:
- Which "LZ4 library" is the driver referring to in the above log message? Is there a Maven repo for it perhaps?
- I notice that the driver
pom.xml
doesn't have any dependency on any snappy library. Is this compiled into the library? Or is there an external library needed to be available in the class loader?
回答1:
The compression libraries are defined in the driver-core POM.
Note that they are optional. The idea is that users who don't need compression don't have to drag extra dependencies. If you use LZ4 or Snappy, you need to declare an explicit dependency on the relevant library in your own POM (or equivalent).
The warn message simply states that the LZ4 library is not in the classpath, which is perfectly fine if you're not going to use LZ4. In fact this warning is a bit premature and we should only check for the presence of the libraries when someone tries to use compression, and that's exactly what JAVA-697 was created for. It will be available in the next release of the driver.
来源:https://stackoverflow.com/questions/29939540/which-additional-libraries-are-required-for-client-compression