gpt4 book ai didi

java - 启动 Elasticsearch 时无法加载 xerial snappy-java

转载 作者:塔克拉玛干 更新时间:2023-11-02 08:18:42 25 4
gpt4 key购买 nike

我在启动 Elasticsearch 时遇到异常。

java.lang.NoClassDefFoundError: org/xerial/snappy/Snappy
at org.elasticsearch.common.compress.snappy.xerial.XerialSnappy.<clinit>(XerialSnappy.java:42) ~[elasticsearch-0.20.6.jar:na]
at org.elasticsearch.common.compress.CompressorFactory.<clinit>(CompressorFactory.java:58) ~[elasticsearch-0.20.6.jar:na]
at org.elasticsearch.client.transport.TransportClient.<init>(TransportClient.java:161) [elasticsearch-0.20.6.jar:na]
at org.elasticsearch.client.transport.TransportClient.<init>(TransportClient.java:109) [elasticsearch-0.20.6.jar:na]
at no.breakpoint.service.search.SearchClientFactory.getClient(SearchClientFactory.java:17) [classes/:na]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.7.0]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) ~[na:1.7.0]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.7.0]
at java.lang.reflect.Method.invoke(Method.java:601) ~[na:1.7.0]
//....
Caused by: java.lang.ClassNotFoundException: org.xerial.snappy.Snappy
at java.net.URLClassLoader$1.run(URLClassLoader.java:366) ~[na:1.7.0]
at java.net.URLClassLoader$1.run(URLClassLoader.java:355) ~[na:1.7.0]
at java.security.AccessController.doPrivileged(Native Method) ~[na:1.7.0]
at java.net.URLClassLoader.findClass(URLClassLoader.java:354) ~[na:1.7.0]
at java.lang.ClassLoader.loadClass(ClassLoader.java:423) ~[na:1.7.0]
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) ~[na:1.7.0]
at java.lang.ClassLoader.loadClass(ClassLoader.java:356) ~[na:1.7.0]

POM 中的依赖:

    <dependency>
<groupId>org.elasticsearch</groupId>
<artifactId>elasticsearch</artifactId>
<version>0.20.6</version>
</dependency>

如果我在 POM 中添加此依赖项,异常就会消失。但是,这是什么原因(或者,我知道这通常意味着在类路径中找不到库并添加依赖项修复了它,但是 Elasticsearch 的传递依赖项有问题吗)?

    <dependency>
<groupId>org.xerial.snappy</groupId>
<artifactId>snappy-java</artifactId>
<version>1.0.4.1</version>
</dependency>

最佳答案

之前遇到过。我能够通过使用 1.0.5-M1 版本而不是 1.0.4.1 来解决它

希望对您有所帮助!

关于java - 启动 Elasticsearch 时无法加载 xerial snappy-java,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15724496/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com