esanchezros / quickfixj-spring-boot-starter-examples

QuickFixJ Spring Boot Starter Examples
Other
65 stars 40 forks source link

problem with simple-server-spring-3 actuator #25

Closed david-gibbs-ig closed 8 months ago

david-gibbs-ig commented 8 months ago

With OpenJDK 64-Bit Server VM Temurin-17.0.7+7 (build 17.0.7+7, mixed mode, sharing) on WSL (ubuntu) I was getting errors trying to use actuator in my build using Spring Boot starter 3.2.2. so I tried the simple-server-spring-3 actuator example. I see the same issue.

The project builds and starts correctly but calling http://localhost:8080/actuator/quickfixjserver results in "Whitelabel Error Page" ( HTTP Status 500 ) and the following stack trace.

2024-02-19 12:19:11.825 ERROR 454711 --- [nio-8080-exec-1] o.a.c.c.C.[.[.[/].[dispatcherServlet]    : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Handler dispatch failed: java.lang.NoSuchMethodError: 'java.lang.Object org.springframework.boot.actuate.endpoint.Sanitizer.sanitize(java.lang.String, java.lang.Object)'] with root cause
java.lang.NoSuchMethodError: 'java.lang.Object org.springframework.boot.actuate.endpoint.Sanitizer.sanitize(java.lang.String, java.lang.Object)'
        at io.allune.quickfixj.spring.boot.actuate.endpoint.AbstractQuickFixJEndpoint.sanitizeProperty(AbstractQuickFixJEndpoint.java:78) ~[quickfixj-spring-boot-actuator-2.17.0.jar!/:na]
        at io.allune.quickfixj.spring.boot.actuate.endpoint.AbstractQuickFixJEndpoint.lambda$null$0(AbstractQuickFixJEndpoint.java:62) ~[quickfixj-spring-boot-actuator-2.17.0.jar!/:na]
        at java.base/java.util.concurrent.ConcurrentHashMap.forEach(ConcurrentHashMap.java:1603) ~[na:na]
        at java.base/java.util.Properties.forEach(Properties.java:1422) ~[na:na]
        at io.allune.quickfixj.spring.boot.actuate.endpoint.AbstractQuickFixJEndpoint.lambda$null$1(AbstractQuickFixJEndpoint.java:61) ~[quickfixj-spring-boot-actuator-2.17.0.jar!/:na]

To reproduce build this example project with Java 17,

cd simple-server-spring-3
java -jar target/simple-server-spring-3.jar
curl http://localhost:8080/actuator/quickfixjserver

Spring Boot 3.2.2 has a different API for Sanitizer. I get a similar but more verbose error with Spring Boot starter 3.2.2.

esanchezros commented 8 months ago

Thanks for reporting @david-gibbs-ig, let me have a look.

esanchezros commented 8 months ago

Someone at Spring thought it was a good idea to remove all previous sanitize methods and add a new one, breaking all backward compatibility

public Object sanitize(SanitizableData data, boolean showUnsanitized)

I can write my own sanitize class without having to rely on Spring's or, finally, deprecate the use of Spring Boot 2 in the quickfixj starter and upgrade to Spring Boot 3. Let me have a think about it

esanchezros commented 8 months ago

Should be fixed in 2.17.1