Elasticsearch org.apache.logging.log4j.core.impl.ThrowableProxy

Hi,

I use Elastic 5.0.2 (via maven) in a web app (running on Tomcat 8.5).
Also I use Log4J 2.7.

I use the java client
new PreBuiltTransportClient(settings).addTransportAddress(inetSocketTransportAddress);

If the connection fail, I get this error
java.lang.NoSuchMethodError: org.apache.logging.log4j.core.util.Loader.loadClass(Ljava/lang/String;)Ljava/lang/Class;
at org.apache.logging.log4j.core.impl.ThrowableProxy.loadClass(ThrowableProxy.java:497)

The ThrowableProxy copy from Elastic is not the same as the one provided by Log4J 2.7

I also noticed taht in Elastic github repo ThrowableProxy is not present.
Only in the maven distribution.

Is there a workaround ?
Did I made a mistake ?

Thanks for your help
Francois

You need to use a previous version of log4j as explained at https://www.elastic.co/guide/en/elasticsearch/client/java-api/current/_log4j_2_logger.html

Thank for your response but I am not able to modify the version 2.7 of log4J, which is used in other products we use.

When do you think it will be fixed ?

In 5.1 for sure: https://www.elastic.co/guide/en/elasticsearch/client/java-api/5.1/_log4j_2_logger.html

It will be released really soon I think.

super !

BTW, It's a very bad practice to maintain in Elastic source code a copy of the Log4J ThrowableProxy class.
I know that some improvements have been done concerning the logging in Elastic.
I hope ThrowableProxy will soon disappear !

Thank David.

Yes. It's gone when you upgrade to 2.7 (so in ES 5.1). Basically we had to workaround https://issues.apache.org/jira/browse/LOG4J2-1560 in the meantime.

Thanks David

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