Search code examples
log4jclientapache-storm

Elastic 5.0 client issue running on Storm server because of log4j dependency


Recently we upgraded to elastic 5.0. The java client in Elastic 5.0 has a hard dependency on log4j 2.6. Storm server (version 1.0.2) on the other hand uses an older version log4J and both are hard wired dependency. The following is the error we get when trying to deploy to the server and i can see that 'PreBuiltTransportClient' is not able to instantiate.

java.lang.NoSuchMethodError: org.apache.logging.log4j.Logger.info(Ljava/lang/String;Ljava/lang/Object;)V

I have raised the issue with Elastic and they have acknowledged the issue and mentioned that they are working on a true client that has lesser dependencies.

Any workarounds or suggestions to get around this for the timebeing?


Solution

  • 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.

    Until the light weight Elastic Client is released we will continue to use this workaround.