codelibs / elasticsearch-cluster-runner

Elasticsearch Cluster Launcher on One JVM Instance
Other
66 stars 17 forks source link

NPE when running the container with 'disableESLogger()' config #51

Open cristibozga opened 1 year ago

cristibozga commented 1 year ago

Hello. I'm using the following config:

 ElasticsearchClusterRunner.Configs configs = ElasticsearchClusterRunner.newConfigs()
                .clusterName("es-test")
                .numOfNode(1)
                .disableESLogger()
                .printOnFailure();

but when I start the runner I get a NPE:

Caused by: java.lang.NullPointerException: Cannot invoke "org.elasticsearch.logging.internal.spi.LoggerFactory.getLogger(java.lang.Class)" because the return value of "org.elasticsearch.logging.internal.spi.LoggerFactory.provider()" is null
    at org.elasticsearch.logging.LogManager.getLogger(LogManager.java:35)
    at org.elasticsearch.plugins.scanners.ExtensibleFileReader.<clinit>(ExtensibleFileReader.java:24)

I see that in the class ElsticsearchClusterRunner al the line 465 we skip the config of the logger, so LoggerFactory.provider() will return null.

I use Elasictsearch 8.7.1 and elasticsearch-cluster-runner 8.7.1.0

Thanks in advance

marevol commented 1 year ago

Do you use log4j 2.19.0? Elasticsearch depends on it.

cristibozga commented 1 year ago

yes, I use exactly that version of log4j. but as I explained in my comment LoggerFactory.provider() will return null as the init of the logger is skipped