QueryDslPredicateExecutor working with spring boot version 1.4.2.RELEASE but not working with spring boot version 2.2.6.RELEASE - spring

When I try to migrate my Spring Boot application from version 1.4.2.RELEASE to version 2.2.6.RELEASE I found that org.springframework.data.querydsl.QueryDslPredicateExecutor not found
Cannot resolve symbol QueryDslPredicateExecutor
i should add spring-data-commons version 1.12.8.RELEASE
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-commons</artifactId>
<version>1.12.8.RELEASE</version>
</dependency>
and then i found another probleme
GitHub repo: https://github.com/dali05/SpringBootMultipleMavenModules
thnaks

Please note that the name of the class over time has been changed, in that one 'D' has changed from its uppercase to a lowercase 'd', ie: QueryDslPredicateExecutor is now QuerydslPredicateExecutor. Probably this caused some headache for you as it did for me too.
Refer to the class in your source code as QuerydslPredicateExecutor and your source code will build again.

Related

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

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

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>

spring-boot-security 2.2.5 - java.lang.NoClassDefFoundError:org/bouncycastle/crypto/params/Argon2Parameters

I am using spring boot security version 2.2.5.RELEASE in that , I am creating a custom password encoder with Argon2PasswordEncoder as my password encoder.
In this when i run, can see following error in the Argon2PasswordEncoder.java where i can see these two imports are missing,
import org.bouncycastle.crypto.generators.Argon2BytesGenerator;
import org.bouncycastle.crypto.params.Argon2Parameters;
Error:
java.lang.NoClassDefFoundError: org/bouncycastle/crypto/params/Argon2Parameters$Builder
at org.springframework.security.crypto.argon2.Argon2PasswordEncoder.encode(Argon2PasswordEncoder.java:78) ~[spring-security-core-5.2.2.RELEASE.jar:5.2.2.RELEASE]
at com.custom.CustomPasswordEncoder.encode(CustomPasswordEncoder.java:11)
Please suggest me want to do, am I missing some dependency or its the spring boot version issue. And also how to overcome.
Many thanks.
I got the issue. for the version 2.2.5 springboot we need to explicitly add the dependency for Argon2BytesGenerator, Argon2Parameters nt found issue, since its not included in this version.
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcprov-jdk15on</artifactId>
<version>1.64</version>
</dependency>

Moving from Spring Boot 2.0.0.M6 to 2.0.0.M7 - dependencies.dependency.version' for org.springframework.social:spring-social-security:jar is missing

I'm trying to upgrade my application from Spring Boot 2.0.0.M6 to 2.0.0.M7
After upgrading my Maven application I ran into the following errors:
For example the following dependency
<dependency>
<groupId>org.springframework.social</groupId>
<artifactId>spring-social-security</artifactId>
</dependency>
shows the following error:
Project build error: 'dependencies.dependency.version' for org.springframework.social:spring-social-security:jar is missing.
What am I doing wrong and how to fix it?
Dependency management and auto-configuration for Spring Social was removed from Spring Boot in 2.0 M7. The longer-term plan is for it to move into Spring Social itself but that has yet to happen.

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