Log4J issue with using Elastic 5.0 with Storm server 1.02

We are using elastic client in our Storm bolt. Recently we upgraded to elastic 5.0. Elastic 5.0 started having a direct dependency with log4j 2.6.2. Storm server does not work with this version of log4j and expects this log4j dependency to be removed. Without this dependency, elastic is not working. Has anyone run in to this? Is there a solution for this?

Thanks
Gopal

I don't now storm bolt but have you tried something like this?

Thanks for your suggestion. We did try this. Storm requires a specific version of SLF4J as well. My question really is, why does the elastic client force a specific version of log4J? Normally a server is expected to do this. A client always works under the context of the application it works under.

The transport client is the same code as the Elasticsearch server. It isn't a proper client, just a convenient thing to use as a client. It was so convenient we used it as the Java client for forever. But it has problems like this. We're working on writing an actual client with more normal dependencies.

Thanks for your feedback. Is there any solution for the time being? Do you have any rough idea when the new client will be available?

You can reorder the classpath, put your log4j2 api and log4j2 core before elasticsearch 5 jar to override the weird elasticsearch static dependency on log4j 2.6.2.

I found a solution for this and it is working now. Here is what i did,

  1. Storm loads the log4j files using a python script from a specified folder under /lib. The latest version of storm uses log4j 2.1
  2. I copied the log4j 2.6.2 files in to that folder.
  3. Now when I deployed my toplogy, storm started using the log4j2.6.2 in the CLASSPATH.
  4. Elastic client got what it needed and it started working.

Thanks everyone for you suggestions. Until the light weight Elastic Client is release we will continue to use this workaround.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.