eclise 连接es5.0.2报错ERROR StatusLogger Could not reconfigure JMX java.lang.NoClassDefFoundError: org/a

经排查是5.0.2版本官网给的pom依赖有问题2.7里面没有DaemonThreadFactory类,且es5.0.2里的server.class和下载后的server.class写的不同,找到类不一致,因此只能更改依赖。

解决方法:

1.pom.xml


UTF-8
1.8
1.8







org.elasticsearch.client
transport
5.1.2


org.apache.logging.log4j
log4j-api
2.7


org.apache.logging.log4j
log4j-core
2.7


第二种方法如下:

pom.xml


UTF-8
1.8
1.8







org.elasticsearch.client
transport
5.0.2


org.apache.logging.log4j
log4j-api
2.6


org.apache.logging.log4j
log4j-core
2.6


第三种方法如下:

pom.xml


UTF-8
1.8
1.8







org.elasticsearch.client
transport
5.0.2


org.apache.logging.log4j
log4j-api
2.7


org.apache.logging.log4j
log4j-core
2.7


org.slf4j
slf4j-log4j12
1.6.4


org.apache.logging.log4j
log4j-to-slf4j
2.7

第四种方法

 代码中加入 System.setProperty("log4j2.disable.jmx", Boolean.TRUE.toString());


ERROR StatusLogger No log4j2 configuration file found. Using default configuration: logging only errors to the console.
ERROR StatusLogger Could not reconfigure JMX
 java.lang.NoClassDefFoundError: org/apache/logging/log4j/core/async/DaemonThreadFactory
at org.apache.logging.log4j.core.jmx.Server.createExecutor(Server.java:81)
at org.apache.logging.log4j.core.jmx.Server.(Server.java:66)
at org.apache.logging.log4j.core.LoggerContext.setConfiguration(LoggerContext.java:541)
at org.apache.logging.log4j.core.LoggerContext.reconfigure(LoggerContext.java:603)
at org.apache.logging.log4j.core.LoggerContext.reconfigure(LoggerContext.java:620)
at org.apache.logging.log4j.core.LoggerContext.start(LoggerContext.java:226)
at org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:152)
at org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:45)
at org.apache.logging.log4j.LogManager.getContext(LogManager.java:194)
at org.apache.logging.log4j.LogManager.getLogger(LogManager.java:551)
at org.elasticsearch.common.logging.ESLoggerFactory.getLogger(ESLoggerFactory.java:49)
at org.elasticsearch.common.logging.Loggers.getLogger(Loggers.java:105)
at org.elasticsearch.common.logging.Loggers.getLogger(Loggers.java:72)
at org.elasticsearch.common.component.AbstractComponent.(AbstractComponent.java:37)
at org.elasticsearch.plugins.PluginsService.(PluginsService.java:110)
at org.elasticsearch.client.transport.TransportClient.newPluginService(TransportClient.java:92)
at org.elasticsearch.client.transport.TransportClient.buildTemplate(TransportClient.java:117)
at org.elasticsearch.client.transport.TransportClient.(TransportClient.java:241)
at org.elasticsearch.transport.client.PreBuiltTransportClient.(PreBuiltTransportClient.java:92)
at org.elasticsearch.transport.client.PreBuiltTransportClient.(PreBuiltTransportClient.java:81)
at org.elasticsearch.transport.client.PreBuiltTransportClient.(PreBuiltTransportClient.java:71)
at com.ecloud.test.main(test.java:17)
Caused by: java.lang.ClassNotFoundException: org.apache.logging.log4j.core.async.DaemonThreadFactory
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 22 more
log4j:WARN No appenders could be found for logger (io.netty.util.internal.logging.InternalLoggerFactory).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
hello
ERROR StatusLogger Unable to unregister MBeans
 java.lang.NoClassDefFoundError: Could not initialize class org.apache.logging.log4j.core.jmx.Server
at org.apache.logging.log4j.core.LoggerContext.stop(LoggerContext.java:317)
at org.apache.logging.log4j.core.AbstractLifeCycle.stop(AbstractLifeCycle.java:127)
at org.apache.logging.log4j.core.LoggerContext$1.run(LoggerContext.java:275)
at org.apache.logging.log4j.core.util.DefaultShutdownCallbackRegistry$RegisteredCancellable.run(DefaultShutdownCallbackRegistry.java:104)
at org.apache.logging.log4j.core.util.DefaultShutdownCallbackRegistry.run(DefaultShutdownCallbackRegistry.java:74)
at java.lang.Thread.run(Thread.java:745)

你可能感兴趣的:(eclise 连接es5.0.2报错ERROR StatusLogger Could not reconfigure JMX java.lang.NoClassDefFoundError: org/a)