Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cannot access org.elasticsearch.action.admin.indices.mapping.put.PutMappingResponse #27

Open
ganil89 opened this issue Jan 17, 2019 · 11 comments
Labels

Comments

@ganil89
Copy link

ganil89 commented Jan 17, 2019

Hi,

I am using elastic search 6.5.4 and added below dependency in pom.xml

org.codelibs
elasticsearch-cluster-runner
5.5.2.0

As mentioned, I tried using the runner for my test cases. My Test case class has compile time error.
cannot access org.elasticsearch.action.admin.indices.mapping.put.PutMappingResponse.

Please let me know the solution.

@marevol
Copy link
Contributor

marevol commented Jan 17, 2019

Try version 6.5.4.0.

@ganil89
Copy link
Author

ganil89 commented Jan 17, 2019

you mean elastic search or codelibs version

@marevol
Copy link
Contributor

marevol commented Jan 17, 2019

elasticsearch-cluster-runner 6.5.4.0 is for elasticsearch 6.5.4.

@ganil89
Copy link
Author

ganil89 commented Jan 17, 2019

Thank you,

I have an other issue with this

2019-01-17 11:39:14,059 main ERROR LogManager returned an instance of org.apache.logging.slf4j.SLF4JLoggerContextFactory which does not implement org.apache.logging.log4j.core.impl.Log4jContextFactory. Unable to initialize Log4j.

Caused by: java.lang.ClassCastException: org.apache.logging.slf4j.SLF4JLoggerContext cannot be cast to org.apache.logging.log4j.core.LoggerContext
at org.elasticsearch.common.logging.LogConfigurator.configure(LogConfigurator.java:142)
at org.elasticsearch.common.logging.LogConfigurator.configure(LogConfigurator.java:119)
at org.codelibs.elasticsearch.runner.ElasticsearchClusterRunner.buildNodeSettings(ElasticsearchClusterRunner.java:496)
at org.codelibs.elasticsearch.runner.ElasticsearchClusterRunner.build(ElasticsearchClusterRunner.java:384)
... 15 more

Is there any work around for this issue, please let me know

@marevol
Copy link
Contributor

marevol commented Jan 17, 2019

You can check dependencies for this project in pom.xml.
It's better to check your dependencies in your project.

@ganil89
Copy link
Author

ganil89 commented Jan 17, 2019

I have taken all the dependencies from this project pom.xml, but still I am getting this error

@marevol
Copy link
Contributor

marevol commented Jan 17, 2019

I could not reproduce it. Could you provide steps or all code to reproduce it.

@wallner
Copy link

wallner commented Jan 13, 2020

I had the same problem too. I am using Spring Data Elasticsearch. In a Spring Boot project. The problem is that spring-boot-starter pulls in spring-boot-starter-logging. If you exclude it, it works. This is the relevant part of my pom.xml:

    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-test</artifactId>
      <scope>test</scope>
      <exclusions>
        <exclusion>
          <groupId>org.junit.vintage</groupId>
          <artifactId>junit-vintage-engine</artifactId>
        </exclusion>
      </exclusions>
    </dependency>
    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter</artifactId>
      <scope>test</scope>
      <exclusions>
        <exclusion>
          <groupId>org.springframework.boot</groupId>
          <artifactId>spring-boot-starter-logging</artifactId>
        </exclusion>
      </exclusions>
    </dependency>
    <dependency>
      <groupId>org.codelibs</groupId>
      <artifactId>elasticsearch-cluster-runner</artifactId>
      <version>6.8.4.0</version>
      <scope>test</scope>
    </dependency>

An interesting observation: The spring-data-elasticsearch release train working with the current spring boot version (2.2) pulls in Elasticsearch 6.8.5 but there is no corresponding elasticsearch-cluster-runner version.

Thank You for your Work!

@foal
Copy link

foal commented Oct 16, 2020

@wallner - it is easy. Elasticsearch-cluster-runner works only with log4j. It depends on log4j-core and uses the log4j core classes in runtime. Spring boot starter logger add to the classpath SLF4j bridge that causes exception above

@jlfeld1
Copy link

jlfeld1 commented Oct 30, 2020

We shouldn't have to change our applications logging implementation in order to use this library.

@foal
Copy link

foal commented May 19, 2021

It will be great if Elasticsearch-cluster-runner will not depend on log4j implementation. Only on log4j interfaces. It will allow to use it without patching sources each time than I need to run integration tests in spring boot application.

See https://stackoverflow.com/questions/54036773/unable-to-initialize-log4j-slf4jloggercontextfactory for example

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants