Currently, I am working on upgrading Java and Spring Boot version for my application from Java 8 to Java 17 and then Spring Boot to 2.7.4.
With this upgrade, application started giving below exception while setting the access token.
I am passing the access token related information to another JAR which then retrieves the token information from token master.
Same configuration file worked with Java 8 and I am sure it is not corrupted. When I debug, I observed that Spring Boot is not able to parse ASCII space which was somehow handled in previous versions. Have anyone faced similar issue?
java.lang.IllegalArgumentException: scope "audience:server:client_id:ADD_00000 AAA:drr:BADAM.SS_" contains invalid characters
at org.springframework.util.Assert.isTrue(Assert.java:121)
at org.springframework.security.oauth2.client.registration.ClientRegistration$Builder.validateScopes(ClientRegistration.java:706)
at org.springframework.security.oauth2.client.registration.ClientRegistration$Builder.build(ClientRegistration.java:625)
at com.restclient.oauth2.SpringSecurityRequestInterceptor.createClientRegistration(SpringSecurityRequestInterceptor.java:165)
at com.restclient.oauth2.SpringSecurityRequestInterceptor.<init>(SpringSecurityRequestInterceptor.java:59)
at com.restclient.oauth2.OAuth2RequestInterceptor.<init>(OAuth2RequestInterceptor.java:38)
at com.restclient.feign.FeignRestClientBuilder.setTokenAuthentication(FeignRestClientBuilder.java:156)
at com.restclient.RestClientHolder.configureBuilder(RestClientHolder.java:275)
at com.restclient.RestClientHolder.getBuilder(RestClientHolder.java:313)
at com.restclient.RestClientHolder.getService(RestClientHolder.java:319)
at com.restclient.RestHelper.getService(RestHelper.java:34)
at com.restclient.RestHelper.getService(RestHelper.java:80)
Related
I'm trying to update my project Spring Boot version from 2.4.13 to 2.6.12
We were using Spring Cloud 2020.0.0-M6 and I also wanted to bump the version to 2021.0.4
Now my application won't load its remote configuration even though I can see in the logs that it finds the service and the configuration!!
In the above picture you can see my app does find the config-service once deployed to our Development environment.
And after that, it throws me an error because it's trying to use its local configuration where I'm using Environment Variables set from my IDE, using the following syntax ${var}, to replace the value depending on the Run/Debug Configuration.
In the meantime, I'm trying to use Spring Boot 2.6.11 with Spring Cloud 2021.0.4. If I can't get it to work I will have to downgrade it to the last working version until I find the problem.
Any help is appreciated!
Thanks
I need to run Spring Boot based app locally. It uses spring-cloud-starter-aws dependency.
The problem is that it tries to connect to EC2 metadata service always. Setting "cloud.aws.*" properties doesn't help.
I expect that default AWS credentials chain will be used, credentials and region will be read from one of AWS preferred way (e.g. ~/.aws/config and ~/.aws/credentials files).
I tried to set cloud.aws.credentials.useDefaultAwsCredentialsChain property but spring-cloud-starter-aws doesn't care
I found examples that use CloudFormation stack for very strange reason to run the app locally.
When I use AWS SDK for Java default AWS chain is used without any issues - I don't need to do anything specific for local running of the application (locally it reads credentials from files and on EC2 it uses instance metadata service). But with Spring Boot it doesn't work out of the box and I need to enable local running somehow.
I use 2.2.2.RELEASE version of Spring Boot and 2.2.1.RELEASE version of Spring Cloud. I have a feeling they introduced regression, because in previous versions it worked without problems.
Any ideas how to run the app locally?
Adding the following lines to configuration helps:
cloud.aws.region.static=my region
cloud.aws.stack.auto=false
spring.autoconfigure.exclude=org.springframework.cloud.aws.autoconfigure.metrics.CloudWatchExportAutoConfiguration
So Spring uses AWS default chain but only for credentials. AWS SDK uses it for region and other configuration parameters too. So this is Spring bug for sure.
It still gives a warning about no connection to instance metadata service once during application start but more or less this solution can be used for local running.
If we don't have the last line with excluding CloudWatchExportAutoConfiguration, there will be many exceptions in stack trace while closing the app. I use CloudWatch metrics in my app.
I guess rationale behind excluding aws auto configuration is that it has conflicts with boot actuator but I'm not sure.
I have the same issue as below. A very simple Hystrix spring boot application failing to load actuator /hystrix.stream.
Application uses Spring boot starter parent 1.5.x and hystrix 1.5.x libs. It worked well with Spring boot 1.3.x. Other actuators are good.
There's seems to be a known problem with 1.4.x and 1.5.x, however I'm looking for some workaround. Please don't suggest solutions for Spring boot 2.0.x.
From the github issue:
https://github.com/Netflix/Hystrix/issues/1566
We are using the Spring boot starter parent 1.5.2.RELEASE and hystrix 1.5.6 dependencies.
Fortunately it works once in hundred tries. We are really puzzled, why it works once and then never. All the services are running on the local machine.
The log details are as below:
Proxy opening connection to: http://localhost:6001/hystrix.stream
2017-05-05 12:29:16.951 INFO 4876 --- [nio-6001-exec-5] ashboardConfiguration$ProxyStreamServlet :
Proxy opening connection to: http://localhost:6001/hystrix.stream
2017-05-05 12:31:36.163 INFO 4876 --- [trap-executor-0] c.n.d.s.r.aws.ConfigClusterResolver : Resolving eureka endpoints via configuration
If we try to curl the end point instead of getting back a snapshot of data, we get
Previous versions of Spring-boot 1.3.x did not have an issue. At first sight, this seems to be an incompatibility with Spring-boot or one of it's dependencies since our team had not had issues until a recent upgrade with Hystrix.
Noteworthy comment is that all other parts of Hystrix are working just fine. RequestLog, and at least Circuit Breaking are working as designed. For some reason the Hystrix Streaming Servlet is no longer functional for us.
The symptoms we receive for this issue are as follows:
Unable to connect to Command Stream (per description of ticket)
Access log receives 503 http status entry for hystrix.stream end point
On my current project we are using Spring 4.2 (core, aop, beans, web , webmvc, etc).
What are the major problems we could encounter when upgrading from Spring 4.2 to Spring 5.0.5? How backward compatible would Spring Security 4.2 be with Spring 5.0.5?
Thank you for your time.
It's hard to tell without knowing which functionalities and features of Spring your project relies on.
I'd suggest to start by reviewing official changelogs and release notes to determine the affected parts of your project.
What's New in Spring Framework 5.x might be a good starting point.
Especially watch out for removed features and APIs.
There also is a Spring Integration 4.3 to 5.0 Migration Guide.
while upgrading to Spring 4.2.7 i faced below two issues
Get and Delete requests containing ";" and "%" character will fail with 500 response because of the HttpFirewall restrictions. You can refer to below link for solution.
Getting 500 response in Spring 5 when url contains semicolon
Spring 5 needs default password encoder otherwise it will throw below exception
java.lang.IllegalArgumentException: There is no PasswordEncoder mapped for the id "null
You can refer to below link for solution.
Spring Security 5 : There is no PasswordEncoder mapped for the id "null"
Is it possible to use elasticsearch server version 5 in combination with spring 4 (spring-data-elasticsearch)?
So far if I use spring-data-elasticsearch 2.x, I can load the app, but get error failed to get local cluster state.
If I include 3.x then I cannot start the app with error Initialization of bean failed; nested exception is java.lang.AbstractMethodError...
I suceeded to connect using spring boot 2.x, but this one uses all spring libraries >5 which is currently not an option for me.
For Elasticsearch 5.x you need to use Spring Data 3.x (Kay). Spring Boot 2.x uses that version, so that should work as you described it.
Taking a look at spring-data-parent there is an explicit dependency on Spring 5.x, so I don't think using Spring 4 will work; at least not without a lot of dependency wrangling. IMO the way forward will be to get to Spring 5 and then use Spring Data 3.