Spring Boot Admin 2.0.1 minimum Spring Boot version - spring-boot-admin

Which is the minimum version of Spring Boot compatible with Spring Boot Admin 2.0.1?
I have a project which uses Spring Boot 1.5.8 and I would like to use Spring Boot Admin last version but it results in:
Caused by: java.lang.ClassNotFoundException: org.thymeleaf.spring5.templateresolver.SpringResourceTemplateResolver
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 27 more

You can integrate spring boot admin 2.0 with 1.5.X and 2.0 . Follow these steps for spring boot 1.X
1. Add this dependency in your pom
<dependency>
<groupId>de.codecentric</groupId>
<artifactId>spring-boot-admin-starter-client</artifactId>
<version>1.5.7</version>
</dependency>
2. Add spring boot admin URL in application properties
spring.boot.admin.url: http://localhost:7777
spring.boot.admin.api-path: instances
For full project check my project
References:
https://github.com/codecentric/spring-boot-admin/issues/802
http://codecentric.github.io/spring-boot-admin/current/#monitoring-spring-boot-1.5.x

Spring Boot Admin 2.0.1 at least requires Spring Boot 2.0.2

Related

which spring-data-mongodb version is supported by Spring-boot 2.3.4 because I am getting this error while server startup locally

Failed to introspect Class [org.springframework.data.mongodb.config.MongoConfigurationSupport] from ClassLoader
java.lang.NoClassDefFoundError: org/springframework/data/support/IsNewStrategyFactory
Caused by: java.lang.ClassNotFoundException: org.springframework.data.support.IsNewStrategyFactory
Dependency versions are listed in an appendix of Spring Boot's reference documentation. In that appendix can see that Spring Boot 2.3.4.RELEASE uses 3.0.4.RELEASE of org.springframework.data:spring-data-mongodb by default.
If you use Spring Boot's dependency management, either by inheriting from spring-boot-starter-parent or importing spring-boot-dependencies, you can declare a dependency without a version and Spring Boot's dependency management will give you the correct version automatically. You can learn more about this in the reference documentation.

How to use log4j 2.17.1 in Spring-Boot 1.3.6 with Java-8

My Java-8 project is build using spring-boot 1.3.6 version, Which by default inherit 'log4j-core-2.4.1', but now I want to upgrade log4j-core to 2.17.1 for which I added
<log4j2.version>2.17.1</log4j2.version> into pom.xml file of my project. The build runs fine but the error says:-
*ERROR org.springframework.boot.SpringApplication - Application startup failed
java.lang.NoSuchMethodError: org.apache.logging.log4j.core.config.ConfigurationFactory.getConfiguration(Lorg/apache/logging/log4j/core/config/ConfigurationSource;)Lorg/apache/logging/log4j/core/config/Configuration;*
Short answer: you can't.
A breaking change in log4j-core (cf. LOG4J2-1547) renders version 2.7.0 and later incompatible with Spring Boot 1.3.x. You can either:
upgrade to Spring Boot 1.5.x or later,
downgrade to Log4j 2.3.2 (which includes the newest security patches):
<properties>
<log4j2.version>2.3.2</log4j2.version>
</properties>

Spring Cloud Starter Eureka Setup

I try to setup Spring Cloud Eureka by following a tutorial link on Spring.io. I get the server up, but not its client. The tutorial uses Spring Boot 1.5.9.RELEASE. But there isn't the version of Spring Cloud Starter Eureka on http://mvnrepository.com/. So, I try 1.4.0 and 2.0.0.M2. I get
09:15:41.027 [main] ERROR org.springframework.boot.SpringApplication - Application startup failed
java.lang.NoSuchMethodError:
org.springframework.boot.builder.SpringApplicationBuilder.<init>([Ljava/lang/Class;)V
at org.springframework.cloud.bootstrap.BootstrapApplicationListener.bootstrapServiceContext(BootstrapApplicationListener.java:166)
at org.springframework.cloud.bootstrap.BootstrapApplicationListener.onApplicationEvent(BootstrapApplicationListener.java:104)
at org.springframework.cloud.bootstrap.BootstrapApplicationListener.onApplicationEvent(BootstrapApplicationListener.java:70)
at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:172)
at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:165)
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:139)
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:122)
at org.springframework.boot.context.event.EventPublishingRunListener.environmentPrepared(EventPublishingRunListener.java:74)
at org.springframework.boot.SpringApplicationRunListeners.environmentPrepared(SpringApplicationRunListeners.java:54)
at org.springframework.boot.SpringApplication.prepareEnvironment(SpringApplication.java:325)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:296)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1118)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1107)
at com.example.gateway.GatewayApplication.main(GatewayApplication.java:30)
What do I do wrong?
I use Gradle for the build tool.
The artifact has been renamed to spring-cloud-starter-netflix-eureka-client for Spring Cloud Finchley and Spring Boot 2

Spring boot jackson auto configuration linkage error wildfly

A.war -> Is a simple spring boot REST app using version 1.2.6.RELEASE ( internally using spring 4.1.7 RELEASE, jackson 2.4.6 )
B.jar -> Is a wildfly9 shared module (stored in wildfly/modules) which is packaged using maven shaded plugin containing spring framework (without spring boot meaning using the old way of adding spring projects dependencies) and jackson classes of same version as above. (Its shaded because non-spring and non-container projects can just add this jar in their class-path and use it - it works)
A.war has maven dependency scope <provided> on B.jar and has jboss-deployment-structure.xml with <dependencies> <module name = "B"> </dependencies>
A.war deployment fails with below error.
Note: A.war deploys perfectly fine when i remove B.jar jboss dependency. So adding B.jar is causing this issue. And If i don't use spring boot in A.war (meaning if i use simple spring webmvc and context dependencies directly) with B.jar jboss dependency, A.war deploys perfectly too
Can anyone explain me what the error below says and how can i investigate more ?
As far as my understanding on wildlfy classloading, A.war and B.jar should be loaded in different module class loaders, Is A.war complaining about jackson classes of B.jar here in the error ?
Caused by: java.lang.LinkageError: loader constraint violation: when resolving method
"org.springframework.http.converter.json.Jackson2ObjectMapperBuilder.modulesToInstall([Lcom/fasterxml/jackson/databind/Module;)Lorg/springframework/http/converter/json/Jackson2ObjectMapperBuilder;"
the class loader (instance of org/jboss/modules/ModuleClassLoader) of the current class,
org/springframework/boot/autoconfigure/jackson/JacksonAutoConfiguration$JacksonObjectMapperBuilderConfiguration,
and the class loader (instance of org/jboss/modules/ModuleClassLoader) for resolved class,
org/springframework/http/converter/json/Jackson2ObjectMapperBuilder,
have different Class objects for the type der used in the signature
at org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration$JacksonObjectMapperBuilderConfiguration.configureModules(JacksonAutoConfiguration.java:259)
at org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration$JacksonObjectMapperBuilderConfiguration.jacksonObjectMapperBuilder(JacksonAutoConfiguration.java:186)
at org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration$JacksonObjectMapperBuilderConfiguration$$EnhancerBySpringCGLIB$$b993caa0.CGLIB$jacksonObjectMapperBuilder$1()
at org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration$JacksonObjectMapperBuilderConfiguration$$EnhancerBySpringCGLIB$$b993caa0$$FastClassBySpringCGLIB$$5262bf2.invoke()
at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228)
at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:318)
at org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration$JacksonObjectMapperBuilderConfiguration$$EnhancerBySpringCGLIB$$b993caa0.jacksonObjectMapperBuilder()
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:162) ... 108 more
After investigating more jboss classloading behavior, jackson classes inside B.jar are conflicting with same jackson classes from jboss restesay module.
so after excluding them in jboss-deployment-structure.xml as below this problem is fixed..
<exclusions>
<module name="org.jboss.resteasy.resteasy-jackson-provider"/>
<module name="org.jboss.resteasy.resteasy-jackson2-provider"/>
</exclusions>

How to classload Java EE 7 in Resin 4.0.42 and not use the Default Javaee-16.jar classloaded by default

I am using the latest Spring framework 4.1.5 and Hibernate-Entity-Manager 4.3.8 along with Javax.Persistence-api 1.0.2 all with JPA 2.1. This spec relies on Java EE 7. I noticed that in Resin 4.0.42, it uses "javaee-16.jar". The issue is I am getting the following exception:
Caused by: java.lang.NoSuchMethodError: javax.persistence.Table.indexes()
[Ljavax/persistence/Index;
at
org.hibernate.cfg.annotations.EntityBinder.processComplementaryTableDefinitions(EntityBinder.java:973)
at org.hibernate.cfg.AnnotationBinder.bindClass(AnnotationBinder.java:824)
at org.hibernate.cfg.Configuration$MetadataSourceQueue.processAnnotatedClassesQueue(Configuration.java:3845)
Method javax.persistence.Table.indexes() only exists in Java EE 7
(Javax.Persistence-api 1.0.2) as a JPA 2.1 spec and NOT in Java EE 6 as a
JPA 2.0 spec.
Problem is my code is based on JPA 2.1. Is there anyway I can classload
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
<version>7.0</version>
</dependency>
even after Resin has classloaded: javaee-16.jar first?
Got it working where I load child libs first, not the other way around. Resin was loading Parent-first. I noticed others were having the same challenge with implementing JPA 2.1 on an app server that only implements JPA 2.0. The key is that each app server has their own specific way to configure child libs (or your app's libs) first.
In my case, in Resin.xml, add the following:
<class-loader>
<servlet-hack/>
</class-loader>
I has a similar error due to resin has jpa 2.0 and the app want jpa 2.1
fixed by added the lib to resin classpath in resin config file
<server-default>
<jvm-classpath>path/to/lib/hibernate-jpa-2.1-api-1.0.2.Final.jar</jvm-classpath>
....
<server-default>