Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Possible conflicts with azure-spring-boot-bom and spring-boot-starter-actuator #25553

Closed
TcarrollJH opened this issue Nov 19, 2021 · 6 comments
Assignees
Labels
azure-spring All azure-spring related issues Client This issue points to a problem in the data-plane of the library. customer-reported Issues that are reported by GitHub users external to the Azure organization. needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team question The issue doesn't require a change to the product in order to be resolved. Most issues start as that

Comments

@TcarrollJH
Copy link

TcarrollJH commented Nov 19, 2021

-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:

com.azure.spring
azure-spring-boot-bom
3.9.0
pom
import


com.azure.spring azure-spring-boot-starter-active-directory org.springframework.boot spring-boot-starter-web org.springframework.boot spring-boot-starter-security org.springframework.boot spring-boot-starter-actuator
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']

@ghost ghost added needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. customer-reported Issues that are reported by GitHub users external to the Azure organization. question The issue doesn't require a change to the product in order to be resolved. Most issues start as that labels Nov 19, 2021
@stliu stliu added azure-spring All azure-spring related issues Client This issue points to a problem in the data-plane of the library. and removed needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. labels Nov 22, 2021
@ghost ghost added the needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team label Nov 22, 2021
@stliu
Copy link
Member

stliu commented Nov 22, 2021

@backwind1233 could u take a look of this?

@backwind1233
Copy link
Contributor

backwind1233 commented Nov 22, 2021

Hi, @TcarrollJH
the version of bom you used is compatible with Spring Boot 2.5.0 - 2.5.4, so it may have some issue when you using Spring boot 2.5.6.

you can follow the link: #24988 for our updates

@TcarrollJH
Copy link
Author

TcarrollJH commented Nov 22, 2021

Hello @backwind1233 thank you for looking into it. I have to say it must have been something different or maybe there was an update? I have zero issues today when I booted it up and all the security functions as well in 2.5.6. I didn't change the version or anything really. Sorry, I wish I had more information on what is different now.

@backwind1233
Copy link
Contributor

backwind1233 commented Nov 23, 2021

@TcarrollJH
can you give me your pom file?
I have tested it in my local and it's fine.
link
image
it should be ok since 2.5.0.

@TcarrollJH
Copy link
Author

TcarrollJH commented Nov 23, 2021

Here is the pom. Still no issues anymore even on 2.5.6.

`<parent>
	<groupId>org.springframework.boot</groupId>
	<artifactId>spring-boot-starter-parent</artifactId>
	<version>2.5.6</version>
	<relativePath /> <!-- lookup parent from repository -->
</parent>
<groupId> </groupId>
<artifactId></artifactId>
<version>0.0.7-develop</version>
<name></name>
<description></description>
<properties>
	<java.version>1.8</java.version>
	<spring-cloud.version>Greenwich.SR1</spring-cloud.version>
	<maven-jar-plugin.version>3.1.1</maven-jar-plugin.version>
	<maven.compiler.source>1.8</maven.compiler.source>
	<maven.compiler.target>1.8</maven.compiler.target>
</properties>

<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-batch</artifactId>
	</dependency>
	<dependency>
		<groupId>org.springframework.boot</groupId>
		<artifactId>spring-boot-starter-data-jpa</artifactId>
	</dependency>
	<dependency>
		<groupId>org.springframework.boot</groupId>
		<artifactId>spring-boot-starter-test</artifactId>
		<scope>test</scope>
	</dependency>
	<dependency>
		<groupId>org.springframework.batch</groupId>
		<artifactId>spring-batch-test</artifactId>
		<scope>test</scope>
	</dependency>
	<dependency>
		<groupId>org.springframework.boot</groupId>
		<artifactId>spring-boot-devtools</artifactId>
		<optional>true</optional>
	</dependency>
	<dependency>
		<groupId>com.microsoft.sqlserver</groupId>
		<artifactId>mssql-jdbc</artifactId>
	</dependency>
	<dependency>
		<groupId>org.springframework.boot</groupId>
		<artifactId>spring-boot-starter-actuator</artifactId>
	</dependency>
	<dependency>
		<groupId>org.springframework.boot</groupId>
		<artifactId>spring-boot-starter-tomcat</artifactId>
		<scope>provided</scope>
	</dependency>
	<dependency>
		<groupId>org.projectlombok</groupId>
		<artifactId>lombok</artifactId>
		<optional>true</optional>
	</dependency>
</dependencies>
<repositories>
	<repository>
		<snapshots>
			<enabled>true</enabled>
			<updatePolicy>always</updatePolicy>
		</snapshots>
		<releases>
			<enabled>true</enabled>
			<updatePolicy>always</updatePolicy>
		</releases>
		<id>central</id>
		<name>libs-release-local</name>
		<url>private artifactory url</url>
	</repository>
	<repository>
		<snapshots>
			<enabled>true</enabled>
			<updatePolicy>always</updatePolicy>
		</snapshots>			
		<id>snapshots</id>
		<name>libs-snapshot-local</name>
		<url>private artifactory url</url>
	</repository>
</repositories>

<build>
	<resources>
		<resource>
			<directory>src/main/resources</directory>
			<filtering>true</filtering>
			<excludes>
				<exclude>certificate/keystore.p12</exclude>
				<exclude>config/application.properties</exclude>
			</excludes>
		</resource>
	</resources>
	<pluginManagement>
		<plugins>
			<plugin>
      			<groupId>org.codehaus.mojo</groupId>
      			<artifactId>exec-maven-plugin</artifactId>
      			<version>3.0.0</version>
      			<executions>
					<execution>
						<id>exec-npm-install</id>
						<goals>
							<goal>exec</goal>
						</goals>
						<phase>generate-sources</phase>
						<configuration>
							<workingDirectory>${project.basedir}/ui</workingDirectory>
							<executable>npm</executable>
							<arguments>
								<argument>install</argument>
								<argument>-P</argument>
							</arguments>
						</configuration>
					</execution>					
					<execution>
						<id>npm run build</id>
						<goals>
							<goal>exec</goal>
						</goals>
						<phase>generate-sources</phase>
						<configuration>
							<workingDirectory>${project.basedir}/ui</workingDirectory>
							<executable>npm</executable>
							<arguments>
								<argument>run</argument>
								<argument>build</argument>
							</arguments>
						</configuration>
					</execution>
				</executions>
			</plugin>
		</plugins>
	</pluginManagement>
	<plugins>
		<plugin>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-maven-plugin</artifactId>

			<configuration>

				<excludeDevtools>true</excludeDevtools>

				<archive>
					<manifest>
						<addClasspath>true</addClasspath>
						<mainClass>Jdbc</mainClass>
					</manifest>
					<manifestEntries>
						<Class-Path>libs/*.jar</Class-Path>
					</manifestEntries>
				</archive> 
			</configuration>
		</plugin>
    	<plugin>
			<groupId>org.apache.maven.plugins</groupId>
			<artifactId>maven-resources-plugin</artifactId>
			<version>3.1.0</version><!--$NO-MVN-MAN-VER$-->
		</plugin>   
	</plugins>
</build>

`

@backwind1233
Copy link
Contributor

Thank you @TcarrollJH, I have just tested in my machine, no issues on my side, if you find any issues again, please provide the error infos and reopen the issue.

@github-actions github-actions bot locked and limited conversation to collaborators Apr 11, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
azure-spring All azure-spring related issues Client This issue points to a problem in the data-plane of the library. customer-reported Issues that are reported by GitHub users external to the Azure organization. needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team question The issue doesn't require a change to the product in order to be resolved. Most issues start as that
Projects
Archived in project
Development

No branches or pull requests

3 participants