ES启动失败;java.lang.IllegalStateException: No factory method found for class org.apache.logging.log4j.c
https://blog.csdn.net/qq_41725214/article/details/95904502?utm_medium=distribute.pc_relevant.none-task-blog-searchFromBaidu-1.control&depth_1-utm_source=distribute.pc_relevant.none-task-blog-searchFromBaidu-1.control
今天启动Elasticsearch的时候,报了 如下错误(非root用户启动):
2019-07-14 05:40:06,326 main ERROR Unable to invoke factory method in class org.apache.logging.log4j.core.appender.RollingFileAppender for element RollingFile: java.lang.IllegalStateException: No factory method found for class org.apache.logging.log4j.core.appender.RollingFileAppender java.lang.IllegalStateException: No factory method found for class org.apache.logging.log4j.core.appender.RollingFileAppender
at org.apache.logging.log4j.core.config.plugins.util.PluginBuilder.findFactoryMethod(PluginBuilder.java:229)
at org.apache.logging.log4j.core.config.plugins.util.PluginBuilder.build(PluginBuilder.java:134)
at org.apache.logging.log4j.core.config.AbstractConfiguration.createPluginObject(AbstractConfiguration.java:958)
at org.apache.logging.log4j.core.config.AbstractConfiguration.createConfiguration(AbstractConfiguration.java:898)
at org.apache.logging.log4j.core.config.AbstractConfiguration.createConfiguration(AbstractConfiguration.java:890)
at org.apache.logging.log4j.core.config.AbstractConfiguration.doConfigure(AbstractConfiguration.java:513)
at org.apache.logging.log4j.core.config.AbstractConfiguration.initialize(AbstractConfiguration.java:237)
at org.apache.logging.log4j.core.config.AbstractConfiguration.start(AbstractConfiguration.java:249)
at org.apache.logging.log4j.core.LoggerContext.setConfiguration(LoggerContext.java:545)
at org.apache.logging.log4j.core.LoggerContext.start(LoggerContext.java:261)
at org.elasticsearch.common.logging.LogConfigurator.configure(LogConfigurator.java:166)
at org.elasticsearch.common.logging.LogConfigurator.configure(LogConfigurator.java:122)
at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:307)
at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:132)
at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:123)
at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:67)
at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:134)
at org.elasticsearch.cli.Command.main(Command.java:90)
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:91)
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:84)
2019-07-14 05:40:06,445 main ERROR Null object returned for RollingFile in Appenders.
2019-07-14 05:40:06,445 main ERROR Unable to locate appender "rolling" for logger config "root"
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
首先想到的是,es要在在非root用户状态下启动,但是我已经是在非root用户状态下了,检查/logs/es-cluster.log的日志文件,发现都是以前的日志,没有今天启动的日志,然后查看logs目录下的文件属性,如下图所示:
这个es-cluster.log文件是属于root的呀,怪不得非root用户查看没有今天的启动日志。再回去看报错信息,最后两行说明报错就是因为es-cluster.log文件的属主为root引起的。
在root用户下把es-cluster.log文件的属主改为你要启动es的用户:
chown ywq es-cluster.log
- 1
这时即可正常启动es。
至于es-cluster.log为什么会变成root用户下的,网上说是用root用户登录启动es之后查看日志,导致elasticsearch.log的属主变成了root。
解决方案:
root用户
chown elk:elk elk目录 -R