Spring boot autoconfigure application start fails - java

I've built my own starter and the autoconfigure step fails with dependency conflict.
These are the spring boot versions both my starter and upstream project are using
'spring-boot-gradle-plugin', version2.1.8.RELEASE
'spring-boot-autoconfigure', version: '2.4.1'
***************************
APPLICATION FAILED TO START
***************************
Description:
An attempt was made to call a method that does not exist. The attempt was made from the following location:
org.springframework.boot.autoconfigure.web.servlet.WebMvcAutoConfiguration$EnableWebMvcConfiguration.lambda$addResourceHandlers$0(W
ebMvcAutoConfiguration.java:411)
The following method did not exist:
'org.springframework.web.servlet.config.annotation.ResourceHandlerRegistration org.springframework.web.servlet.config.annotation.Re
sourceHandlerRegistration.addResourceLocations(org.springframework.core.io.Resource[])'
The method's class, org.springframework.web.servlet.config.annotation.ResourceHandlerRegistration, is available from the following loca
tions:
jar:file:/opt/eureka/app.jar!/BOOT-INF/lib/spring-webmvc-5.3.2.jar!/org/springframework/web/servlet/config/annotation/ResourceHandl
erRegistration.class
The class hierarchy was loaded from the following locations:
org.springframework.web.servlet.config.annotation.ResourceHandlerRegistration: jar:file:/opt/eureka/app.jar!/BOOT-INF/lib/spring-we
bmvc-5.3.2.jar!/
Action:
Correct the classpath of your application so that it contains a single, compatible version of org.springframework.web.servlet.config.an
notation.ResourceHandlerRegistration

From your log I see one of two possible problems:
Somewhere you override spring-webmvc-5.3.2 to a higher or lower version
Problem in your starter code (if it configure your WebMvc)
Try mvn dependency:tree or gradle dependencies to explore dependencies.
Attached your starter code.

I had to use spring boot 2.4.1 to avoid the conflict.

Related

Setting up JNA in Gradle Project

I try to import a custom .dll inside my Gradle project. I add the dependencie inside build.gradle
dependencies {
implementation group: 'net.java.dev.jna', name: 'jna', version: '5.6.0'
}
but when I try to run the gradle build I receive this error
..java:170: error: cannot find symbol
CustomLibrary INSTANCE = (CustomLibrary) Native.load("xxx", CustomLibrary.class);
^
symbol: method load()
location: class Native
1 error
Any suggestions?
You have a transitive dependency on an older version of JNA in another dependency.
As you have tagged this with spring boot that is the likely cause. Older Spring Boot versions used a 4.x (I think 4.3) JNA dependency and the syntax has changed.
The POM for Spring Boot uses a property jna.version that you could override if you were using Maven, but I don't think that is (easily) possible using Gradle. However, updating to the latest version of Spring Boot should solve your problem.

SPRING BOOT UPGRADE CAUSES ISSUE WITH REACTOR DEPENDENCIES

I have the updated my application spring and spring boot dependencies to the following version.
spring-version-5.3.18. spring-boot-version-2.5.12
Not sure why the reactor related dependencies are breaking and i get this while starting up the application
***************************
APPLICATION FAILED TO START
***************************
Description:
An attempt was made to call a method that does not exist. The attempt was made from the following location:
org.springframework.boot.web.embedded.netty.NettyReactiveWebServerFactory.createHttpServer(NettyReactiveWebServerFactory.java:163)
The following method did not exist:
reactor.netty.http.server.HttpServer.runOn(Lreactor/netty/resources/LoopResources;)Lreactor/netty/transport/Transport;
The method's class, reactor.netty.http.server.HttpServer, is available from the following locations:
jar:file:/Users/vn50y2z/.m2/repository/io/projectreactor/netty/reactor-netty/0.9.11.RELEASE/reactor-netty-0.9.11.RELEASE.jar!/reactor/netty/http/server/HttpServer.class
jar:file:/Users/vn50y2z/.m2/repository/io/projectreactor/netty/reactor-netty-http/1.0.17/reactor-netty-http-1.0.17.jar!/reactor/netty/http/server/HttpServer.class
The class hierarchy was loaded from the following locations:
reactor.netty.http.server.HttpServer: file:/Users/vn50y2z/.m2/repository/io/projectreactor/netty/reactor-netty/0.9.11.RELEASE/reactor-netty-0.9.11.RELEASE.jar
Action:
Correct the classpath of your application so that it contains a single, compatible version of reactor.netty.http.server.HttpServer

How to resolve error after upgrading Spring Boot

APPLICATION FAILED TO START
Description:
An attempt was made to call the method org.springframework.beans.factory.annotation.AnnotatedBeanDefinition.setRole(I)V but it does not exist. Its class, org.springframework.beans.factory.annotation.AnnotatedBeanDefinition, is available from the following locations:
jar: ../.m2/repository/org/springframework/spring-beans/5.0.9.RELEASE/spring-beans-5.0.9.RELEASE.jar!/org/springframework/beans/factory/annotation/AnnotatedBeanDefinition.class
It was loaded from the following location:
file:../.m2/repository/org/springframework/spring-beans/5.0.9.RELEASE/spring-beans-5.0.9.RELEASE.jar
Action:
Correct the classpath of your application so that it contains a single, compatible version of org.springframework.beans.factory.annotation.AnnotatedBeanDefinition

Java jetty servlet container fails to resolve class dependencies

15:28:38.716 [qtp1588771273-32] WARN o.e.jetty.servlet.ServletHandler - /tp/gremlin/execute
java.lang.IllegalArgumentException: Could not resolve dependency of type:javax.transaction.TransactionManager
at org.neo4j.graphdb.DependencyResolver$Adapter$1.select(DependencyResolver.java:87) ~[neo4j-kernel-2.2.9.jar:2.2.9]
at org.neo4j.kernel.extension.KernelExtensions.resolveDependency(KernelExtensions.java:112) ~[neo4j-kernel-2.2.9.jar:2.2.9]
This is from Neo4j 2.x (the Gremlin plug-in). The package, when built and deployed as instructed at https://github.com/thinkaurelius/neo4j-gremlin-plugin, does contain the jar-file which describes this class, and Maven did download it and did install it there. But, when the server attempts to load and execute the extension, nothing is resolved.
Why?

Spring Web Flow - Failed to load class "org.slf4j.impl.StaticLoggerBinder"

I am getting this error:
Failed to load class org.slf4j.impl.StaticLoggerBinder in spring web flow application implementation.
Please check dependency is loaded properly.
Use maven dependency tree command to make sure that no jar is conflicting.

Categories

Resources