Currently migrating my spring-boot app to use the latest compatibile version for JDK 8. I'm currently receiving this error when running the spring-boot-app
ightsTelemetryAutoConfiguration': Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'azure.application-insights-com.microsoft.applicationinsights.boot.ApplicationInsightsProperties': Initialization
of bean failed; nested exception is java.lang.NoSuchFieldError: Companion
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.java:165)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:577)
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:147)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:731)
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:408)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:307)
at org.springframework.boot.web.servlet.support.SpringBootServletInitializer.run(SpringBootServletInitializer.java:175)
at org.springframework.boot.web.servlet.support.SpringBootServletInitializer.createRootApplicationContext(SpringBootServletInitializer.java:155)
at org.springframework.boot.web.servlet.support.SpringBootServletInitializer.onStartup(SpringBootServletInitializer.java:97)
at org.springframework.web.SpringServletContainerInitializer.onStartup(SpringServletContainerInitializer.java:174)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5218)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:753)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:727)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:695)
at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:1016)
at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1903)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:750)
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'webRequestTrackingFilterRegistrationBean' defined in class path resource [com/microsoft/applicationinsights/boot/ApplicationInsightsWebMvcAutoConfiguration.class]: Unsatisfied dependency expressed through method
'webRequestTrackingFilterRegistrationBean' parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'com.microsoft.applicationinsights.boot.ApplicationInsightsTelemetryAutoConfiguration': Unsatisfied dependency expressed through constructor paramet
er 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'azure.application-insights-com.microsoft.applicationinsights.boot.ApplicationInsightsProperties': Initialization of bean failed; nested exception is java.lang.NoSuchFieldError: Companion
at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:800)
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:541)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1352)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1195)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:582)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542)
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
I have these versions for my applicationinsights, spring-boot-starter-parent 2.7.12, spring-cloud-dependencies 2021.0.3 and spring-cloud-starter-bootstrap in my parent pom. I updated to the latest version of applicationinsights but I'm still receiving the same error.
<dependency>
<groupId>com.microsoft.azure</groupId>
<artifactId>applicationinsights-spring-boot-starter</artifactId>
<version>2.6.4</version>
</dependency>
<dependency>
<groupId>com.microsoft.azure</groupId>
<artifactId>applicationinsights-logging-logback</artifactId>
<version>2.6.4</version>
</dependency>
I've updated the following artifacts and I've also added spring-cloud-starter-bootstrap dependency
artifact | previous version | updated version |
---|---|---|
spring-boot-starter-parent | 2.2.4.RELEASE | 2.7.12 |
spring-cloud-dependencies | Finchley.M9 | 2021.0.3 |
applicationinsights-spring-boot-starter | 1.0.0-BETA | 2.6.4 |
application-insights-logging | 2.1.1 | 2.6.4 |