Upgrading Spring boot version to version 3. Problem with javax.cache library - spring-boot

I'm trying to upgrade spring boot from 2.7.x to 3.0.1. The last thing I have left to upgrade is the library.
<dependency>
<groupId>javax.cache</groupId>
<artifactId>cache-api</artifactId>
<version>1.1.1</version>
</dependency>
Have any of you had a similar problem? I didn't see any information on how to do this in the guide.

Remove this dependency and use from spring boot starters.
This is already having Vulnerabilities from dependencies:CVE-2020-15250.MVN REPO CACHE 1.1.1

Related

How to change the micrometer's version of Spring-boot-actuator 2.3.0

In our project, we use spring-boot 2.3.0.RELEASE.
Default, spring-boot-actuator is the 2.3.0 and it uses the 1.5.1 micrometer-core.
However, I want it use the 1.9.0 micrometer because I want to use the 1.9.0 micrometer-registry-influx.
I loaded the 1.9.0 micrometer-core in maven ,but it makes no sense.
<dependency>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-core</artifactId>
<version>1.9.0</version>
</dependency>
Our spring-boot version is not to be allowed to change, so I want to change the micrometer's version in 2.3.0.RELEASE spring-boot-actuator.What should I do next?
You should upgrade Boot so that it will bring in the latest Micrometer.
You can force your build system to resolve 1.9.x but you might need to do it for multiple dependencies (e.g.: micrometer-core, xyz-registry, etc.)

Spring Kafka error after upgrading spring boot to 2.6.6

I am facing runtime error after I have upgraded spring boot version from 2.4.0 to 2.6.6 (and spring cloud version 2021.0.2). My application consumes messages from a kafka topic and produces it to another kafka topic after some transformation. I am getting below error as soon as the message is consumed.
ERROR ERROR - - - - applog.cls=org.springframework.core.log.LogAccessor,applog.mthd=error,applog.line=149,applog.msg=Stopping container due to an Error,exc.stack=java.lang.NoSuchFieldError: LIFTER\n\tat org.springframework.cloud.sleuth.instrument.reactor.ReactorHooksHelper.getLifterName(ReactorHooksHelper.java:171)\n\tat org.springframework.cloud.sleuth.instrument.reactor.ReactorHooksHelper.isTraceContextPropagator(ReactorHooksHelper.java:175)\n\tat org.springframework.cloud.sleuth.instrument.reactor.ReactorHooksHelper.shouldDecorate(ReactorHooksHelper.java:121)\n\tat reactor.core.publisher.Operators$LiftFunction.apply(Operators.java:2488)\n\tat reactor.core.publisher.Operators$LiftFunction.apply(Operators.java:2449)\n\tat reactor.core.publisher.Flux.onAssembly(Flux.java:9692)\n\tat reactor.core.publisher.Flux.fromIterable(Flux.java:1118)\n\tat com.org.listener.MyListener.listen(MyListener.java:32)\n\tat sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)\n\tat sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)\n\tat sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)\n\tat java.lang.reflect.Method.invoke(Method.java:498)\n\tat org.springframework.messaging.handler.invocation.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:169)\n\tat org.springframework.messaging.handler.invocation.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:119)\n\tat org.springframework.kafka.listener.adapter.HandlerAdapter.invoke(HandlerAdapter.java:56)\n\tat org.springframework.kafka.listener.adapter.MessagingMessageListenerAdapter.invokeHandler(MessagingMessageListenerAdapter.java:339)\n\tat org.springframework.kafka.listener.adapter.BatchMessagingMessageListenerAdapter.invoke(BatchMessagingMessageListenerAdapter.java:180)\n\tat org.springframework.kafka.listener.adapter.BatchMessagingMessageListenerAdapter.onMessage(BatchMessagingMessageListenerAdapter.java:172)\n\tat org.springframework.kafka.listener.adapter.BatchMessagingMessageListenerAdapter.onMessage(BatchMessagingMessageListenerAdapter.java:61)\n\tat org.springframework.kafka.listener.KafkaMessageListenerContainer$ListenerConsumer.doInvokeBatchOnMessage(KafkaMessageListenerContainer.java:2268)\n\tat org.springframework.kafka.listener.KafkaMessageListenerContainer$ListenerConsumer.invokeBatchOnMessageWithRecordsOrList(KafkaMessageListenerContainer.java:2258)\n\tat org.springframework.kafka.listener.KafkaMessageListenerContainer$ListenerConsumer.invokeBatchOnMessage(KafkaMessageListenerContainer.java:2204)\n\tat org.springframework.kafka.listener.KafkaMessageListenerContainer$ListenerConsumer.doInvokeBatchListener(KafkaMessageListenerContainer.java:2114)\n\tat org.springframework.kafka.listener.KafkaMessageListenerContainer$ListenerConsumer.invokeBatchListener(KafkaMessageListenerContainer.java:1997)\n\tat org.springframework.kafka.listener.KafkaMessageListenerContainer$ListenerConsumer.invokeListener(KafkaMessageListenerContainer.java:1976)\n\tat org.springframework.kafka.listener.KafkaMessageListenerContainer$ListenerConsumer.invokeIfHaveRecords(KafkaMessageListenerContainer.java:1364)\n\tat org.springframework.kafka.listener.KafkaMessageListenerContainer$ListenerConsumer.pollAndInvoke(KafkaMessageListenerContainer.java:1355)\n\tat org.springframework.kafka.listener.KafkaMessageListenerContainer$ListenerConsumer.run(KafkaMessageListenerContainer.java:1247)\n\tat java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)\n\tat java.util.concurrent.FutureTask.run$$$capture(FutureTask.java:266)\n\tat java.util.concurrent.FutureTask.run(FutureTask.java)\n\tat java.lang.Thread.run(Thread.java:748)\n
I tried checking the reactor-core ReactorHooksHelper.java file, but field LIFTER seems to be present there. Need help to understand why service is giving this error.
Looks like issue with reactor. Which version of reactor-core are you having? For spring-boot version 2.6.6 try using reactor-core version 3.4.16
<dependency>
<groupId>io.projectreactor</groupId>
<artifactId>reactor-core</artifactId>
<version>3.4.16</version>
</dependency>
You shouldn't specify a version for reactor-core. Spring-boot-dependencies takes care of that for you and would automatically use 3.4.16 of reactor-core. That's the beauty of using Spring Boot.
Check out this POM file
https://search.maven.org/artifact/org.springframework.boot/spring-boot-dependencies/2.6.6/pom
and search for <reactor-bom.version> and notice that the version is 2020.0.17.
After that, find the equivalent reactor-bom file
https://search.maven.org/artifact/io.projectreactor/reactor-bom/2020.0.17/pom
and notice that the version for reactor-core is 3.4.16
<dependency>
<groupId>io.projectreactor</groupId>
<artifactId>reactor-core</artifactId>
<version>3.4.16</version>
</dependency>

Installing Spring Cloud CLI - which version with Spring boot 2.4.5

I want to install Spring Cloud CLI, but am not clear which version to use.
This Spring cloud page https://spring.io/projects/spring-cloud shows the compatible versions of Spring Cloud with Boot. For example
Release Train
Boot Version
2020.0.x aka Ilford
2.4.x
Hoxton
2.2.x, 2.3.x (Starting with SR5)
I have Spring boot 2.4.5 installed. This implies I should use Spring cloud version 2020.0.x
If I check https://repo.spring.io/release/org/springframework/cloud/spring-cloud/ I do not see a version 2020.0.x
If I use
spring install org.springframework.cloud:spring-cloud-cli:2020.0.1
I get an error "could not find artifact org.springframework.cloud:spring-cloud-cli:jar:2020.0.1 "
If I use
$ spring install org.springframework.cloud:spring-cloud-cli:2.2.0.RELEASE
it appears to install correctly, however I get errors when I try to run commands like
$ spring cloud eureka.
My question is what version of cloud should I install with spring boot v 2.4.5 ?
2020.0.x is the version of the Spring Cloud release train, not of the single modules itself. The release train version can be used, if you use the Spring Cloud BOM to include the dependencies, as described here: https://spring.io/projects/spring-cloud.
This would look similar to this then:
<properties>
<spring.cloud-version>Hoxton.SR8</spring.cloud-version>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>${spring.cloud-version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
If you only want to use single modules, then you need to find out, which versions belong to the release train, by either looking in the respective spring-cloud-dependencies POM (https://repo.spring.io/release/org/springframework/cloud/spring-cloud-dependencies/2020.0.2/), or in the release notes, which also contain the module versions: https://spring.io/blog/2021/03/18/spring-cloud-2020-0-2-aka-ilford-is-available
So in your case, the proper version for spring-cloud-cli would be 3.0.2.

spring framework and webflux versions are incompatible

I have a old version spring-framework project. spring-framework version is 3.1.1.RELEASE. I need import webflux but versions are incompatible, so if i add these code in pom.xml:
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webflux</artifactId>
<version>${spring.version}</version>
</dependency>
not work because spring-webflux:3.1.1.RELEASE is not published in maven repo. How can i solve this problem?
Thanks,
It was added in Spring 5. I am afraid you need to update to Spring 5.

What replaces FacesContextUtils in Spring 3?

We just upgraded from Spring 2.5 to Spring 3.0.7. The class:
org.springframework.web.jsf.FacesContextUtils
doesn't appear exist in 3.0.7. We are trying to call:
FacesContextUtils.getWebApplicationContext(FacesContext.getCurrentInstance()).getBeansOfType(type);
Is there a replacement in Spring 3?
This class also exists in Spring 3.0.7, maybe you missed a jar or downloaded a different release?
You can use the following maven dependency:
<dependency>
<groupId>org.springframework</groupId>
<artifactId>org.springframework.web</artifactId>
<version>3.0.7.RELEASE</version>
</dependency>
You can also get the jar from the spring repo.
If this doesn't help you may update your question with the stacktrace of the error msg.

Resources