-Spring boot 2.5.6 -Maven error: java.lang.NoSuchFieldError: ERROR_ATTRIBUTE

ANY request made to the API works but throws a 500 as a response and kicks up the error on spring. When removing actuator from the application pom.xml there are no errors at all. Everything works perfectly The addition of actuator, despite if it's secured or not by spring security, introduces the error. I've removed all bits of security configuration from the application and just having the two dependencies in the pom, not being used, will still replicate the error. I've cleaned the project, tried to manually override the dependencies versions for both actuator and spring security but all to no avail.

Dependencies:

<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.azure.spring</groupId>
<artifactId>azure-spring-boot-bom</artifactId>
<version>3.9.0</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>

<dependencies>
<dependency>
<groupId>com.azure.spring</groupId>
<artifactId>azure-spring-boot-starter-active-directory</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>

Error Log:

2021-11-19 10:30:29.480 DEBUG 22256 --- [http-nio-9086-exec-4] o.s.web.servlet.DispatcherServlet : "INCLUDE" dispatch for GET "/error", parameters={}
2021-11-19 10:30:29.481 DEBUG 22256 --- [http-nio-9086-exec-4] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped to org.springframework.boot.autoconfigure.web.servlet.error.BasicErrorController#error(HttpServletRequest)
2021-11-19 10:30:29.482 TRACE 22256 --- [http-nio-9086-exec-6] o.s.s.w.header.writers.HstsHeaderWriter : Not injecting HSTS header since it did not match request to [Is Secure]
2021-11-19 10:30:29.482 DEBUG 22256 --- [http-nio-9086-exec-4] o.s.w.s.m.m.a.HttpEntityMethodProcessor : Found 'Content-Type:application/font-woff' in response
2021-11-19 10:30:29.483 DEBUG 22256 --- [http-nio-9086-exec-6] w.c.HttpSessionSecurityContextRepository : Did not store anonymous SecurityContext
2021-11-19 10:30:29.483 WARN 22256 --- [http-nio-9086-exec-4] .w.s.m.s.DefaultHandlerExceptionResolver : Resolved [org.springframework.http.converter.HttpMessageNotWritableException: No converter for [class java.util.LinkedHashMap] with preset Content-Type 'application/font-woff']
2021-11-19 10:30:29.483 DEBUG 22256 --- [http-nio-9086-exec-4] o.s.web.servlet.DispatcherServlet : Exiting from "INCLUDE" dispatch, status 200
2021-11-19 10:30:29.484 DEBUG 22256 --- [http-nio-9086-exec-6] o.s.web.servlet.DispatcherServlet : Completed 200 OK
2021-11-19 10:30:29.484 DEBUG 22256 --- [http-nio-9086-exec-6] w.c.HttpSessionSecurityContextRepository : Did not store anonymous SecurityContext
2021-11-19 10:30:29.484 DEBUG 22256 --- [http-nio-9086-exec-6] s.s.w.c.SecurityContextPersistenceFilter : Cleared SecurityContextHolder to complete request
2021-11-19 10:30:29.485 ERROR 22256 --- [http-nio-9086-exec-6] o.a.c.c.C.[.[.[/].[dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Filter execution threw an exception] with root cause



java.lang.NoSuchFieldError: ERROR_ATTRIBUTE
at org.springframework.boot.actuate.metrics.web.servlet.WebMvcMetricsFilter.fetchException(WebMvcMetricsFilter.java:125) ~[spring-boot-actuator-2.5.6.jar:2.5.6]
at org.springframework.boot.actuate.metrics.web.servlet.WebMvcMetricsFilter.doFilterInternal(WebMvcMetricsFilter.java:102) ~[spring-boot-actuator-2.5.6.jar:2.5.6]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.9.jar:5.3.9]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.52.jar:9.0.52]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.52.jar:9.0.52]
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201) ~[spring-web-5.3.9.jar:5.3.9]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.9.jar:5.3.9]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.52.jar:9.0.52]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.52.jar:9.0.52]
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:197) ~[tomcat-embed-core-9.0.52.jar:9.0.52]
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:97) ~[tomcat-embed-core-9.0.52.jar:9.0.52]
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:542) ~[tomcat-embed-core-9.0.52.jar:9.0.52]
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:135) ~[tomcat-embed-core-9.0.52.jar:9.0.52]
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92) ~[tomcat-embed-core-9.0.52.jar:9.0.52]
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:78) ~[tomcat-embed-core-9.0.52.jar:9.0.52]
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:357) ~[tomcat-embed-core-9.0.52.jar:9.0.52]
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:382) ~[tomcat-embed-core-9.0.52.jar:9.0.52]
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65) ~[tomcat-embed-core-9.0.52.jar:9.0.52]
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:893) ~[tomcat-embed-core-9.0.52.jar:9.0.52]
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1726) ~[tomcat-embed-core-9.0.52.jar:9.0.52]
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) ~[tomcat-embed-core-9.0.52.jar:9.0.52]
at org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1191) ~[tomcat-embed-core-9.0.52.jar:9.0.52]
at org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659) ~[tomcat-embed-core-9.0.52.jar:9.0.52]
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) ~[tomcat-embed-core-9.0.52.jar:9.0.52]
at java.base/java.lang.Thread.run(Thread.java:831) ~[na:na]



2021-11-19 10:30:29.494 DEBUG 22256 --- [http-nio-9086-exec-6] o.s.web.servlet.DispatcherServlet : "INCLUDE" dispatch for GET "/error", parameters={}
2021-11-19 10:30:29.494 DEBUG 22256 --- [http-nio-9086-exec-6] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped to org.springframework.boot.autoconfigure.web.servlet.error.BasicErrorController#error(HttpServletRequest)
2021-11-19 10:30:29.495 DEBUG 22256 --- [http-nio-9086-exec-6] o.s.w.s.m.m.a.HttpEntityMethodProcessor : Found 'Content-Type:application/font-woff' in response
2021-11-19 10:30:29.497 WARN 22256 --- [http-nio-9086-exec-6] .w.s.m.s.DefaultHandlerExceptionResolver : Resolved [org.springframework.http.converter.HttpMessageNotWritableException: No converter for [class java.util.LinkedHashMap] with preset Content-Type 'application/font-woff']

Comment From: wilkinsona

The ERROR_ATTRIBUTE field was added to org.springframework.boot.web.servlet.error.ErrorAttributes from the org.springframework.boot:spring-boot module in Spring Boot 2.5.0. It would appear that you have an earlier version of that module on the classpath. I can't tell why that's the case from the information you've provided thus far but I suspect the cause of the problem is in your pom.xml file.

If you would like us to spend some more time investigating, please spend some time providing a complete yet minimal sample that reproduces the problem. You can share it with us by pushing it to a separate repository on GitHub or by zipping it up and attaching it to this issue.

Comment From: TcarrollJH

I am no longer having this issue. I logged in this morning and it worked without changes. Thank you for the response though.