Resilience4j version: 1.1.0
Java version: 1.8
Spring boot : 2.2.0
I am trying to configure the Resilience4j with spring boot project but getting below class not found
org.springframework.boot.SpringApplication: Application run failed
java.lang.IllegalArgumentException: Could not find class [org.springframework.boot.actuate.autoconfigure.endpoint.EndpointAutoConfiguration]
at org.springframework.util.ClassUtils.resolveClassName(ClassUtils.java:327)
Java Code as follows :
#RateLimiter(name ="service1",fallbackMethod = "rateLimiterfallback")
#PostMapping(value = "${URL_AUTH}")
public ResponseEntity<AuthRespDTO> fetchToken(#RequestParam("userId") String Id, #RequestParam("password") String pwd, HttpServletRequest httpRequest) {
}
application.yml as below
resilience4j.ratelimiter:
instances:
service1:
limitForPeriod: 1
limitRefreshPeriod: 100000
timeoutDuration: 1000ms
I have below dependencies mentioned in POM.xml .
<dependency>
<groupId>io.github.resilience4j</groupId>
<artifactId>resilience4j-spring-boot2</artifactId>
<version>1.1.0</version>
</dependency>
<dependency>
<groupId>io.github.resilience4j</groupId>
<artifactId>resilience4j-ratelimiter</artifactId>
<version>1.1.0</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-actuator</artifactId>
<version>2.2.0.RELEASE</version>
</dependency>
Please help me in resolving the issue .
For fixing this issue you have to update the POM with the spring-boot-starter-actuator and spring-boot-starter-aop dependencies.
At present you have a dependency of spring-boot-actuator which should be updated to spring-boot-starter-actuator.
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-aop</artifactId>
<version>2.3.0.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
<version>2.3.2.RELEASE</version>
</dependency>
Note : Release version of spring boot depends on your project.
Similar issue reference
Related
I have a java spring boot graphql project.
My dependencies in the pom.xml:
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>com.graphql-java-kickstart</groupId>
<artifactId>graphql-spring-boot-starter</artifactId>
<version>12.0.0</version>
</dependency>
<dependency>
<groupId>com.graphql-java-kickstart</groupId>
<artifactId>playground-spring-boot-starter</artifactId>
<version>5.10.0</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
When i run the application and visit http://localhost:3001/playground i get an empty page saying
"Loading GraphQL Playground"
What may be possibly my problem here.
You can use only this dependency for graphQL playground interfaces and remove the playground-spring-boot-starter:
<dependency>
<groupId>com.graphql-java-kickstart</groupId>
<artifactId>graphql-spring-boot-starter</artifactId>
<version>12.0.0</version>
</dependency>
In your application.yml you need to explicit set the static path for interface files (the path is /vendor/playground/):
static-path:
base: <YOUR-CONTEXT-PATH>/vendor/playground/
Here is a example of some options to enable GraphQL playground, notice that the context-path here is /api:
graphql:
playground:
endpoint: /graphql
subscriptionEndpoint: /subscriptions
enabled: true
pageTitle: Playground
cdn:
enabled: false
version: latest
static-path:
base: /api/vendor/playground/
I had the same issue and the settings above worked for me.
We created a Spring Boot 2.1.7.RELEASE app with an ElasticSearch 7.3.0 client.
When trying to run the Elastic client we get the following error for this line:
SearchResponse searchResponse = client.search(searchRequest, RequestOptions.DEFAULT);
Handler dispatch failed; nested exception is java.lang.NoSuchMethodError: org.elasticsearch.action.support.IndicesOptions.ignoreThrottled()Z] with root cause
java.lang.NoSuchMethodError: org.elasticsearch.action.support.IndicesOptions.ignoreThrottled()Z
at org.elasticsearch.client.RequestConverters$Params.withIndicesOptions(RequestConverters.java:966)
at org.elasticsearch.client.RequestConverters.addSearchRequestParams(RequestConverters.java:417)
at org.elasticsearch.client.RequestConverters.search(RequestConverters.java:404)
at org.elasticsearch.client.RestHighLevelClient.lambda$search$2(RestHighLevelClient.java:932)
at org.elasticsearch.client.RestHighLevelClient.internalPerformRequest(RestHighLevelClient.java:1450)
at org.elasticsearch.client.RestHighLevelClient.performRequest(RestHighLevelClient.java:1424)
at org.elasticsearch.client.RestHighLevelClient.performRequestAndParseEntity(RestHighLevelClient.java:1394)
at org.elasticsearch.client.RestHighLevelClient.search(RestHighLevelClient.java:930)
We are using these dependencies:
<properties>
<spring-boot-version>2.1.7.RELEASE</spring-boot-version>
<elasticsearch.version>7.0.0</elasticsearch.version>
</properties>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<version>${spring-boot-version}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
<version>${spring-boot-version}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<version>${spring-boot-version}</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<version>${spring-boot-version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.elasticsearch.client</groupId>
<artifactId>elasticsearch-rest-high-level-client</artifactId>
<version>7.3.0</version>
</dependency>
We found this post that caused us to add the elasticsearch.version property, but it didn't help.
We also run mvn dependency:tree -Dverbose to see if there is a conjunction of Elastic dependencies, but it seems that only the Elastic Client has Elastic related jar.
UPDATE
Following this post we tried to downgrade the Elastic client version to 7.1.1 but it didn't help
Following this answer here, we discovered that the Elastic server has a 6.5.4 version.
Changing the dependency to
<elasticsearch.version>6.5.4</elasticsearch.version>
Or
<dependency>
<groupId>org.elasticsearch.client</groupId>
<artifactId>elasticsearch-rest-high-level-client</artifactId>
<version>${elasticsearch.version}</version>
</dependency>
Solved the issue.
In my Spring Boot(2.0.5) project I was using Elasticsearch(5.6.9). However, due to some bugs in testing environment we are moving to Spring boot(2.1.0).
When I run the application the following message comes up:
***************************
APPLICATION FAILED TO START
***************************
Description:
An attempt was made to call the method org.elasticsearch.action.admin.indices.mapping.put.PutMappingRequestBuilder.execute()Lorg/elasticsearch/action/ActionFuture; but it does not exist. Its class, org.elasticsearch.action.admin.indices.mapping.put.PutMappingRequestBuilder, is available from the following locations:
jar:file:/C:/Users/User/.m2/repository/org/elasticsearch/elasticsearch/5.6.9/elasticsearch-5.6.9.jar!/org/elasticsearch/action/admin/indices/mapping/put/PutMappingRequestBuilder.class
It was loaded from the following location:
file:/C:/Users/User/.m2/repository/org/elasticsearch/elasticsearch/5.6.9/elasticsearch-5.6.9.jar
Action:
Correct the classpath of your application so that it contains a single, compatible version of org.elasticsearch.action.admin.indices.mapping.put.PutMappingRequestBuilder
Process finished with exit code 0
Current pom.xml file
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.0.RELEASE</version>
<relativePath/>
</parent>
<properties>
<elasticsearch.version>5.6.9</elasticsearch.version>
</properties>
<dependencies>
<!--...others...-->
<!--ELASTICSEARCH-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-elasticsearch</artifactId>
</dependency>
<dependency>
<groupId>org.elasticsearch.client</groupId>
<artifactId>transport</artifactId>
<version>${elasticsearch.version}</version>
</dependency>
<dependency>
<groupId>org.elasticsearch.plugin</groupId>
<artifactId>transport-netty4-client</artifactId>
<version>${elasticsearch.version}</version>
</dependency>
</dependencies>
Previous pom.xml file which worked fine:
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.0.5.RELEASE</version>
<relativePath/>
</parent>
<properties>
<elasticsearch.version>5.6.9</elasticsearch.version>
</properties>
<dependencies>
<!--...others...-->
<!--ELASTICSEARCH-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-elasticsearch</artifactId>
</dependency>
<dependency>
<groupId>org.elasticsearch.client</groupId>
<artifactId>transport</artifactId>
<version>${elasticsearch.version}</version>
</dependency>
<dependency>
<groupId>org.elasticsearch.plugin</groupId>
<artifactId>transport-netty4-client</artifactId>
<version>${elasticsearch.version}</version>
</dependency>
</dependencies>
Can someone tell which version of elasticsearch is compatible with Spring Boot 2.1.0?
I read through similar questions which were outdated.
Compatible versions of Spring boot,elasticsearch and spring data elasticsearch
You can go to Spring Boot project Github repository and check any dependency version:
In Spring Boot 2.0.x Elasticsearch version is defined as 5.6.16 (link)
In Spring Boot 2.1.x Elasticsearch version is defined as 6.4.3
(link)
Not sure if it's still actual, but the first thing you need to try is to add core Elasticsearch library, because REST client depends on it.
<dependency>
<groupId>org.elasticsearch</groupId>
<artifactId>elasticsearch</artifactId>
<version>6.7.0</version>
</dependency>
I am new to spring boot. I am trying to migrate project from old spring boot to the latest version.
I changed the version of spring boot in project. But when i build the project it fails in tests throwing computational failure with error below
package org.springframework.test.annotation does not exist
I have this dependency in my project
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-test</artifactId>
<scope>test</scope>
</dependency>
Not sure what i could be missing?
Change spring-boot-test TO spring-boot-starter-test like below :
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-test</artifactId>
<scope>test</scope>
</dependency>
to
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
Refer http://www.baeldung.com/spring-boot-starters for more info about starters.
I encountered a problem when I tried to migrate from Spring Boot 1.5.10 to 2.0.0.RELEASE.
I have implemented the AuthoritiesExtractor interface and it's working in version 1.5.10, but in version 2.0.0 I got this error
class AuthoritiesExtractor not found in path org.springframework.boot.autoconfigure.security.oauth2.resource
It really can't be found.
The AuthoritiesExtractor interface has been moved from the spring-boot-autoconfigure dependency to the following dependency:
<dependency>
<groupId>org.springframework.security.oauth.boot</groupId>
<artifactId>spring-security-oauth2-autoconfigure</artifactId>
<version>2.0.1.RELEASE</version>
</dependency>
For versions >=2.0.0m5 (2.0.1.RELEASE - 2.1.3.RELEASE)
Import it via:
import org.springframework.boot.autoconfigure.security.oauth2.resource.AuthoritiesExtractor;
Solved
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-autoconfigure</artifactId>
<version>2.0.0.RELEASE</version>
</dependency>