if you depend on opensearch-java but exclude the opensearch-rest-client (RHEC) then it fails in the runtime with the following error:
java.lang.NoClassDefFoundError: Could not initialize class org.opensearch.client.transport.httpclient5.ApacheHttpClient5Transport
at org.opensearch.client.transport.httpclient5.ApacheHttpClient5TransportBuilder.build(ApacheHttpClient5TransportBuilder.java:279)
at liquibase.ext.opensearch.database.OpenSearchConnection.connect(OpenSearchConnection.java:146)
at liquibase.ext.opensearch.database.OpenSearchConnection.open(OpenSearchConnection.java:64)
at liquibase.database.ConnectionServiceFactory.create(ConnectionServiceFactory.java:32)
at liquibase.database.DatabaseFactory.openConnection(DatabaseFactory.java:238)
at liquibase.database.DatabaseFactory.openConnection(DatabaseFactory.java:188)
at liquibase.database.DatabaseFactory.openDatabase(DatabaseFactory.java:153)
at liquibase.database.DatabaseFactory.openDatabase(DatabaseFactory.java:142)
at liquibase.ext.opensearch.AbstractOpenSearchLiquibaseIT.beforeEach(AbstractOpenSearchLiquibaseIT.java:42)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
Caused by: java.lang.ExceptionInInitializerError: Exception java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory [in thread "main"]
at org.opensearch.client.transport.httpclient5.ApacheHttpClient5Transport.<clinit>(ApacheHttpClient5Transport.java:98)
... 12 more
What is the bug?
if you depend on
opensearch-java
but exclude theopensearch-rest-client
(RHEC) then it fails in the runtime with the following error:How can one reproduce the bug?
in maven:
as a workaround the following dependency can be added:
What is the expected behavior?
the required dependencies are provided by
opensearch-java
, consumers do not need to know about such internals.What is your host/environment?
tested with
opensearch-java
2.10.3.Do you have any screenshots?
n/a
Do you have any additional context?
@reta is already informed