我使用弹性搜索1.1.0。
在尝试关闭弹性搜索时,我得到了NoClassDefFoundError。用于关闭和堆栈跟踪的代码如下所示。
的Maven:
<dependency>
<groupId>org.elasticsearch</groupId>
<artifactId>elasticsearch</artifactId>
<version>1.1.0</version>
</dependency>
代码:node.client().admin().cluster().prepareNodesShutdown().execute().get();
2015-08-05 21:45:11,113 [Thread-15] INFO org.elasticsearch.action.admin.cluster.node.shutdown internalInfo - [Captain Ultra] [cluster_shutdown]: done shutting down all nodes except master, proceeding to master
INFO: Illegal access: this web application instance has been stopped already. Could not load org.elasticsearch.action.admin.cluster.node.shutdown.TransportNodesShutdownAction$1$2. The eventual following stack trace is caused by an error thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access, and has no functional impact.
java.lang.IllegalStateException
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1600)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1559)
at org.elasticsearch.action.admin.cluster.node.shutdown.TransportNodesShutdownAction$1.run(TransportNodesShutdownAction.java:153)
at java.lang.Thread.run(Unknown Source)
Exception in thread "Thread-15" java.lang.NoClassDefFoundError: org/elasticsearch/action/admin/cluster/node/shutdown/TransportNodesShutdownAction$1$2
at org.elasticsearch.action.admin.cluster.node.shutdown.TransportNodesShutdownAction$1.run(TransportNodesShutdownAction.java:153)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.ClassNotFoundException: org.elasticsearch.action.admin.cluster.node.shutdown.TransportNodesShutdownAction$1$2
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1714)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1559)
... 2 more
此问题不允许弹性搜索正常关闭。 Tomcat正在等待某段时间(超时),然后强行杀死所有这些线程。 如何解决这个问题?
1.0.0也会出现同样的问题。
答案 0 :(得分:0)
最后我得到了解决方案。弹性搜索试图在单独的线程中关闭。当弹性搜索尝试访问TransportNodesShutdownAction时,tomcat将从其类加载器中卸载弹性jar。因此,添加一些sleep语句或将弹性及其依赖jar添加到tomcat / lib将解决问题。