hel*_*_me 4 java java-api elasticsearch
我使用Elasticsearch Java API创建了一个Java文件.在NetBeans中,一切正常.
但是,我开始收到以下错误:
org/elasticsearch/plugins/PluginsService.java:342:in `loadBundles': java.lang.IllegalStateException: failed to load bundle [file:/D:/ELK-2.0/elasticsearch-2.0.0/plugins/license/license-2.0.0.jar, file:/D:/ELK-2.0/elasticsearch-2.0.0/plugins/license/license-core-2.0.0.jar, file:/D:/ELK-2.0/elasticsearch-2.0.0/plugins/license/license-plugin-api-2.0.0.jar, file:/D:/ELK-2.0/elasticsearch-2.0.0/plugins/marvel-agent/marvel-agent-2.0.0.jar] due to jar hell
from org/elasticsearch/plugins/PluginsService.java:113:in `<init>'
from org/elasticsearch/node/Node.java:144:in `<init>'
from org/elasticsearch/node/NodeBuilder.java:145:in `build'
from spamdetection/SpamDetection.java:63:in `client'
from spamdetection/SpamDetection.java:30:in `SpammerDetector'
from java/lang/reflect/Method.java:497:in `invoke'
from spam.rb:53:in `(root)'
from spam.rb:53:in `(root)'
Caused by:
JarHell.java:120:in `parseClassPath': java.lang.IllegalStateException: Classpath should not contain empty elements! (outdated shell script from a previous version?) classpath=''
from JarHell.java:95:in `parseClassPath'
from PluginsService.java:338:in `loadBundles'
from PluginsService.java:113:in `<init>'
from Node.java:144:in `<init>'
from NodeBuilder.java:145:in `build'
from SpamDetection.java:63:in `client'
from SpamDetection.java:30:in `SpammerDetector'
from NativeMethodAccessorImpl.java:-2:in `invoke0'
from NativeMethodAccessorImpl.java:62:in `invoke'
from DelegatingMethodAccessorImpl.java:43:in `invoke'
from Method.java:497:in `invoke'
from JavaMethod.java:451:in `invokeDirectWithExceptionHandling'
from JavaMethod.java:312:in `invokeDirect'
from InstanceMethodInvoker.java:45:in `call'
from CachingCallSite.java:326:in `cacheAndCall'
from CachingCallSite.java:170:in `call'
from spam.rb:53:in `__file__'
from spam.rb:-1:in `load'
from Ruby.java:857:in `runScript'
from Ruby.java:850:in `runScript'
from Ruby.java:729:in `runNormally'
from Ruby.java:578:in `runFromMain'
from Main.java:395:in `doRunFromMain'
from Main.java:290:in `internalRun'
from Main.java:217:in `run'
from Main.java:197:in `main'
Run Code Online (Sandbox Code Playgroud)
尝试从JRuby调用我的Java JAR文件时.是什么导致了这个错误?
Ant*_*łka 15
您可以创建一个以org.elasticsearch.bootstrap您的名字命名的包src/test/java,并将此类放在其中:
package org.elasticsearch.bootstrap;
import java.net.URL;
public class JarHell {
private JarHell() {}
public static void checkJarHell() throws Exception {}
public static void checkJarHell(URL urls[]) throws Exception {}
public static void checkVersionFormat(String targetVersion) {}
public static void checkJavaVersion(String resource, String targetVersion) {}
public static URL[] parseClassPath() {return new URL[]{};}
}
Run Code Online (Sandbox Code Playgroud)
这样做的好处是,使用节点构建器初始化节点的生产代码可以保持清除任何黑客,仅在单元测试中禁用jar地狱检查.
| 归档时间: |
|
| 查看次数: |
6639 次 |
| 最近记录: |