Skip to content

ES6 client crashes with NoClassDefFoundError: org/apache/logging/log4j/LogManager (log4j fully excluded from the es6 closure) #168

Description

@fupelaqu

Found live by the REPL.4 -all bundle E2E smoke against docker ES 6.8.23.

Symptom: the very first ES operations through softclient4es6-rest-client 0.20.1 fail — CREATE TABLE reports Execution failed: org/apache/logging/log4j/LogManager, and any search/scroll path kills the JVM:

java.lang.NoClassDefFoundError: org/apache/logging/log4j/LogManager
  at org.elasticsearch.search.fetch.subphase.highlight.PlainHighlighter.<clinit>(PlainHighlighter.java:57)
  at org.elasticsearch.search.SearchModule.setupHighlighters(SearchModule.java:627)
  at org.elasticsearch.search.SearchModule.<init>(SearchModule.java:307)
  at app.softnetwork.elastic.client.rest.RestHighLevelClientCompanion.namedXContentRegistry(RestHighLevelClientCompanion.scala:48)

Root cause: the published es6 client closure carries ZERO log4j jars — jacksonExclusions/elasticDependencies exclude org.apache.logging.log4j:* and log4j-api, and unlike ES7 (elastic4sDependencies(7) re-adds log4j-api % 2.17.1 for exactly this reason), the ES6 branch does not. The in-source comment "ES6 RHLC needs no log4j" (project/SoftClient4es.scala) is disproved by the live run — ES 6.8's SearchModule/PlainHighlighter.<clinit> hard-reference LogManager just like ES7's RHLC.

Impact: the published plain softclient4es6-cli 0.20.1 assembly and every consumer of softclient4es6-rest-client hit this on first use (pre-existing, independent of the -all bundles).

Fix: mirror the es7 line in elastic4sDependencies(6): add "org.apache.logging.log4j" % "log4j-api" % Versions.log4j — one line. The softclient4es-repl es6 bundle already carries the explicit dependency as a workaround until an engine release ships this.

Verification: after the fix, the softclient4es-repl e2e-smoke.sh 6 recipe (CREATE ×2, INSERT, JOIN, aggregation, SHOW LICENSE vs docker ES 6.8.23) passes — it failed on 0.20.1 and passed with log4j-api added.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions