shenyu icon indicating copy to clipboard operation
shenyu copied to clipboard

[BUG] Can not startup shenyu-examples-http-swagger2

Open VampireAchao opened this issue 1 year ago • 0 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues

Current Behavior

After upgrading to Spring Boot 3.3.1, the shenyu-examples-http-swagger2 module fails to start. The issue is caused by the fact that Springfox is no longer supported with this version of Spring Boot.

Expected Behavior

The application should start without errors. Springfox should either be replaced with Springdoc to support the upgraded Spring Boot version, or compatibility issues should be resolved.

Steps To Reproduce

  1. Upgrade the project to use Spring Boot version 3.3.1.
  2. Try to run the shenyu-examples-http-swagger2 module.
  3. Observe the application failing to start due to compatibility issues.

Environment

ShenYu version(s): branch master latest

Debug logs

org.apache.shenyu.examples.http.ShenyuTestSwaggerApplication#main will log:

/Users/achao/Library/Java/JavaVirtualMachines/azul-17.0.8.1/Contents/Home/bin/java -agentlib:jdwp=transport=dt_socket,address=127.0.0.1:51121,suspend=y,server=n -XX:TieredStopAtLevel=1 -Dspring.output.ansi.enabled=always -Dcom.sun.management.jmxremote -Dspring.jmx.enabled=true -Dspring.liveBeansView.mbeanDomain -Dspring.application.admin.enabled=true -Dmanagement.endpoints.jmx.exposure.include=* -javaagent:/Users/achao/Library/Caches/JetBrains/IntelliJIdea2024.1/captureAgent/debugger-agent.jar=file:/private/var/folders/ms/k86qsfvd28ggrvp1g_ftr25c0000gn/T/capture.props -Dfile.encoding=UTF-8 -classpath /Users/achao/IdeaProjects/shenyu/shenyu-examples/shenyu-examples-http-swagger2/target/classes:/Users/achao/IdeaProjects/shenyu/shenyu-spring-boot-starter/shenyu-spring-boot-starter-client/shenyu-spring-boot-starter-client-springmvc/target/classes:/Users/achao/IdeaProjects/shenyu/shenyu-client/shenyu-client-http/shenyu-client-springmvc/target/classes:/Users/achao/IdeaProjects/shenyu/shenyu-client/shenyu-client-core/target/classes:/Users/achao/IdeaProjects/shenyu/shenyu-spi/target/classes:/Users/achao/.m2/repository/org/apache/commons/commons-lang3/3.3.2/commons-lang3-3.3.2.jar:/Users/achao/IdeaProjects/shenyu/shenyu-disruptor/target/classes:/Users/achao/.m2/repository/com/lmax/disruptor/3.4.0/disruptor-3.4.0.jar:/Users/achao/IdeaProjects/shenyu/shenyu-register-center/shenyu-register-client/shenyu-register-client-http/target/classes:/Users/achao/IdeaProjects/shenyu/shenyu-common/target/classes:/Users/achao/.m2/repository/org/apache/commons/commons-collections4/4.4/commons-collections4-4.4.jar:/Users/achao/.m2/repository/com/github/ben-manes/caffeine/caffeine/3.1.8/caffeine-3.1.8.jar:/Users/achao/.m2/repository/commons-codec/commons-codec/1.16.0/commons-codec-1.16.0.jar:/Users/achao/.m2/repository/org/ow2/asm/asm-tree/9.2/asm-tree-9.2.jar:/Users/achao/.m2/repository/org/bouncycastle/bcprov-jdk18on/1.78/bcprov-jdk18on-1.78.jar:/Users/achao/IdeaProjects/shenyu/shenyu-register-center/shenyu-register-client/shenyu-register-client-api/target/classes:/Users/achao/IdeaProjects/shenyu/shenyu-register-center/shenyu-register-common/target/classes:/Users/achao/IdeaProjects/shenyu/shenyu-client/shenyu-client-api-docs-annotations/target/classes:/Users/achao/IdeaProjects/shenyu/shenyu-discovery/shenyu-discovery-api/target/classes:/Users/achao/.m2/repository/com/squareup/okhttp3/okhttp/4.12.0/okhttp-4.12.0.jar:/Users/achao/.m2/repository/com/squareup/okio/okio/3.6.0/okio-3.6.0.jar:/Users/achao/.m2/repository/com/squareup/okio/okio-jvm/3.6.0/okio-jvm-3.6.0.jar:/Users/achao/.m2/repository/org/jetbrains/kotlin/kotlin-stdlib-common/1.9.20/kotlin-stdlib-common-1.9.20.jar:/Users/achao/.m2/repository/org/jetbrains/kotlin/kotlin-stdlib-jdk8/1.9.20/kotlin-stdlib-jdk8-1.9.20.jar:/Users/achao/.m2/repository/org/jetbrains/kotlin/kotlin-stdlib/1.9.20/kotlin-stdlib-1.9.20.jar:/Users/achao/.m2/repository/org/jetbrains/annotations/13.0/annotations-13.0.jar:/Users/achao/.m2/repository/org/jetbrains/kotlin/kotlin-stdlib-jdk7/1.9.20/kotlin-stdlib-jdk7-1.9.20.jar:/Users/achao/.m2/repository/com/google/code/gson/gson/2.10.1/gson-2.10.1.jar:/Users/achao/.m2/repository/org/javatuples/javatuples/1.2/javatuples-1.2.jar:/Users/achao/IdeaProjects/shenyu/shenyu-spring-boot-starter/shenyu-spring-boot-starter-client/shenyu-spring-boot-starter-client-common/target/classes:/Users/achao/IdeaProjects/shenyu/shenyu-client/shenyu-client-autoconfig/target/classes:/Users/achao/.m2/repository/com/google/guava/guava/32.0.0-jre/guava-32.0.0-jre.jar:/Users/achao/.m2/repository/com/google/guava/failureaccess/1.0.1/failureaccess-1.0.1.jar:/Users/achao/.m2/repository/com/google/guava/listenablefuture/9999.0-empty-to-avoid-conflict-with-guava/listenablefuture-9999.0-empty-to-avoid-conflict-with-guava.jar:/Users/achao/.m2/repository/com/google/code/findbugs/jsr305/3.0.2/jsr305-3.0.2.jar:/Users/achao/.m2/repository/org/checkerframework/checker-qual/3.33.0/checker-qual-3.33.0.jar:/Users/achao/.m2/repository/com/google/errorprone/error_prone_annotations/2.18.0/error_prone_annotations-2.18.0.jar:/Users/achao/.m2/repository/com/google/j2objc/j2objc-annotations/2.8/j2objc-annotations-2.8.jar:/Users/achao/.m2/repository/org/slf4j/slf4j-api/2.0.9/slf4j-api-2.0.9.jar:/Users/achao/.m2/repository/org/slf4j/jcl-over-slf4j/2.0.9/jcl-over-slf4j-2.0.9.jar:/Users/achao/.m2/repository/org/springframework/boot/spring-boot-starter/3.2.0/spring-boot-starter-3.2.0.jar:/Users/achao/.m2/repository/org/springframework/boot/spring-boot/3.2.0/spring-boot-3.2.0.jar:/Users/achao/.m2/repository/org/springframework/spring-context/6.1.1/spring-context-6.1.1.jar:/Users/achao/.m2/repository/org/springframework/boot/spring-boot-autoconfigure/3.2.0/spring-boot-autoconfigure-3.2.0.jar:/Users/achao/.m2/repository/jakarta/annotation/jakarta.annotation-api/2.1.1/jakarta.annotation-api-2.1.1.jar:/Users/achao/.m2/repository/org/springframework/spring-core/6.1.1/spring-core-6.1.1.jar:/Users/achao/.m2/repository/org/springframework/spring-jcl/6.1.1/spring-jcl-6.1.1.jar:/Users/achao/.m2/repository/org/yaml/snakeyaml/2.2/snakeyaml-2.2.jar:/Users/achao/.m2/repository/org/springframework/boot/spring-boot-starter-actuator/3.2.0/spring-boot-starter-actuator-3.2.0.jar:/Users/achao/.m2/repository/org/springframework/boot/spring-boot-actuator-autoconfigure/3.2.0/spring-boot-actuator-autoconfigure-3.2.0.jar:/Users/achao/.m2/repository/org/springframework/boot/spring-boot-actuator/3.2.0/spring-boot-actuator-3.2.0.jar:/Users/achao/.m2/repository/com/fasterxml/jackson/core/jackson-databind/2.15.3/jackson-databind-2.15.3.jar:/Users/achao/.m2/repository/com/fasterxml/jackson/core/jackson-core/2.15.3/jackson-core-2.15.3.jar:/Users/achao/.m2/repository/com/fasterxml/jackson/datatype/jackson-datatype-jsr310/2.15.3/jackson-datatype-jsr310-2.15.3.jar:/Users/achao/.m2/repository/io/micrometer/micrometer-observation/1.12.0/micrometer-observation-1.12.0.jar:/Users/achao/.m2/repository/io/micrometer/micrometer-commons/1.12.0/micrometer-commons-1.12.0.jar:/Users/achao/.m2/repository/io/micrometer/micrometer-jakarta9/1.12.0/micrometer-jakarta9-1.12.0.jar:/Users/achao/.m2/repository/io/micrometer/micrometer-core/1.12.0/micrometer-core-1.12.0.jar:/Users/achao/.m2/repository/org/hdrhistogram/HdrHistogram/2.1.12/HdrHistogram-2.1.12.jar:/Users/achao/.m2/repository/org/latencyutils/LatencyUtils/2.0.3/LatencyUtils-2.0.3.jar:/Users/achao/.m2/repository/org/springframework/boot/spring-boot-starter-webflux/3.2.0/spring-boot-starter-webflux-3.2.0.jar:/Users/achao/.m2/repository/org/springframework/boot/spring-boot-starter-json/3.2.0/spring-boot-starter-json-3.2.0.jar:/Users/achao/.m2/repository/com/fasterxml/jackson/datatype/jackson-datatype-jdk8/2.15.3/jackson-datatype-jdk8-2.15.3.jar:/Users/achao/.m2/repository/com/fasterxml/jackson/module/jackson-module-parameter-names/2.15.3/jackson-module-parameter-names-2.15.3.jar:/Users/achao/.m2/repository/org/springframework/boot/spring-boot-starter-reactor-netty/3.2.0/spring-boot-starter-reactor-netty-3.2.0.jar:/Users/achao/.m2/repository/io/projectreactor/netty/reactor-netty-http/1.1.13/reactor-netty-http-1.1.13.jar:/Users/achao/.m2/repository/io/netty/netty-codec-http/4.1.101.Final/netty-codec-http-4.1.101.Final.jar:/Users/achao/.m2/repository/io/netty/netty-common/4.1.101.Final/netty-common-4.1.101.Final.jar:/Users/achao/.m2/repository/io/netty/netty-buffer/4.1.101.Final/netty-buffer-4.1.101.Final.jar:/Users/achao/.m2/repository/io/netty/netty-transport/4.1.101.Final/netty-transport-4.1.101.Final.jar:/Users/achao/.m2/repository/io/netty/netty-codec/4.1.101.Final/netty-codec-4.1.101.Final.jar:/Users/achao/.m2/repository/io/netty/netty-handler/4.1.101.Final/netty-handler-4.1.101.Final.jar:/Users/achao/.m2/repository/io/netty/netty-codec-http2/4.1.101.Final/netty-codec-http2-4.1.101.Final.jar:/Users/achao/.m2/repository/io/netty/netty-resolver-dns/4.1.101.Final/netty-resolver-dns-4.1.101.Final.jar:/Users/achao/.m2/repository/io/netty/netty-resolver/4.1.101.Final/netty-resolver-4.1.101.Final.jar:/Users/achao/.m2/repository/io/netty/netty-codec-dns/4.1.101.Final/netty-codec-dns-4.1.101.Final.jar:/Users/achao/.m2/repository/io/netty/netty-resolver-dns-native-macos/4.1.101.Final/netty-resolver-dns-native-macos-4.1.101.Final-osx-x86_64.jar:/Users/achao/.m2/repository/io/netty/netty-resolver-dns-classes-macos/4.1.101.Final/netty-resolver-dns-classes-macos-4.1.101.Final.jar:/Users/achao/.m2/repository/io/netty/netty-transport-native-epoll/4.1.101.Final/netty-transport-native-epoll-4.1.101.Final-linux-x86_64.jar:/Users/achao/.m2/repository/io/netty/netty-transport-native-unix-common/4.1.101.Final/netty-transport-native-unix-common-4.1.101.Final.jar:/Users/achao/.m2/repository/io/netty/netty-transport-classes-epoll/4.1.101.Final/netty-transport-classes-epoll-4.1.101.Final.jar:/Users/achao/.m2/repository/io/projectreactor/netty/reactor-netty-core/1.1.13/reactor-netty-core-1.1.13.jar:/Users/achao/.m2/repository/io/netty/netty-handler-proxy/4.1.101.Final/netty-handler-proxy-4.1.101.Final.jar:/Users/achao/.m2/repository/io/netty/netty-codec-socks/4.1.101.Final/netty-codec-socks-4.1.101.Final.jar:/Users/achao/.m2/repository/org/springframework/spring-web/6.1.1/spring-web-6.1.1.jar:/Users/achao/.m2/repository/org/springframework/spring-beans/6.1.1/spring-beans-6.1.1.jar:/Users/achao/.m2/repository/org/springframework/spring-webflux/6.1.1/spring-webflux-6.1.1.jar:/Users/achao/.m2/repository/io/projectreactor/reactor-core/3.6.0/reactor-core-3.6.0.jar:/Users/achao/.m2/repository/org/reactivestreams/reactive-streams/1.0.4/reactive-streams-1.0.4.jar:/Users/achao/.m2/repository/org/springframework/boot/spring-boot-starter-logging/3.2.0/spring-boot-starter-logging-3.2.0.jar:/Users/achao/.m2/repository/ch/qos/logback/logback-classic/1.4.11/logback-classic-1.4.11.jar:/Users/achao/.m2/repository/ch/qos/logback/logback-core/1.4.11/logback-core-1.4.11.jar:/Users/achao/.m2/repository/org/apache/logging/log4j/log4j-to-slf4j/2.21.1/log4j-to-slf4j-2.21.1.jar:/Users/achao/.m2/repository/org/apache/logging/log4j/log4j-api/2.21.1/log4j-api-2.21.1.jar:/Users/achao/.m2/repository/org/slf4j/jul-to-slf4j/2.0.9/jul-to-slf4j-2.0.9.jar:/Users/achao/.m2/repository/org/ow2/asm/asm/9.3/asm-9.3.jar:/Users/achao/.m2/repository/net/bytebuddy/byte-buddy/1.14.10/byte-buddy-1.14.10.jar:/Users/achao/.m2/repository/org/springframework/boot/spring-boot-starter-web/3.2.0/spring-boot-starter-web-3.2.0.jar:/Users/achao/.m2/repository/org/springframework/boot/spring-boot-starter-tomcat/3.2.0/spring-boot-starter-tomcat-3.2.0.jar:/Users/achao/.m2/repository/org/apache/tomcat/embed/tomcat-embed-core/10.1.16/tomcat-embed-core-10.1.16.jar:/Users/achao/.m2/repository/org/apache/tomcat/embed/tomcat-embed-el/10.1.16/tomcat-embed-el-10.1.16.jar:/Users/achao/.m2/repository/org/apache/tomcat/embed/tomcat-embed-websocket/10.1.16/tomcat-embed-websocket-10.1.16.jar:/Users/achao/.m2/repository/org/springframework/spring-webmvc/6.1.1/spring-webmvc-6.1.1.jar:/Users/achao/.m2/repository/org/springframework/spring-aop/6.1.1/spring-aop-6.1.1.jar:/Users/achao/.m2/repository/org/springframework/spring-expression/6.1.1/spring-expression-6.1.1.jar:/Users/achao/.m2/repository/io/springfox/springfox-swagger2/2.9.2/springfox-swagger2-2.9.2.jar:/Users/achao/.m2/repository/io/swagger/swagger-annotations/1.5.20/swagger-annotations-1.5.20.jar:/Users/achao/.m2/repository/io/swagger/swagger-models/1.5.20/swagger-models-1.5.20.jar:/Users/achao/.m2/repository/com/fasterxml/jackson/core/jackson-annotations/2.15.3/jackson-annotations-2.15.3.jar:/Users/achao/.m2/repository/io/springfox/springfox-spi/2.9.2/springfox-spi-2.9.2.jar:/Users/achao/.m2/repository/io/springfox/springfox-core/2.9.2/springfox-core-2.9.2.jar:/Users/achao/.m2/repository/io/springfox/springfox-schema/2.9.2/springfox-schema-2.9.2.jar:/Users/achao/.m2/repository/io/springfox/springfox-swagger-common/2.9.2/springfox-swagger-common-2.9.2.jar:/Users/achao/.m2/repository/io/springfox/springfox-spring-web/2.9.2/springfox-spring-web-2.9.2.jar:/Users/achao/.m2/repository/com/fasterxml/classmate/1.6.0/classmate-1.6.0.jar:/Users/achao/.m2/repository/org/springframework/plugin/spring-plugin-core/1.2.0.RELEASE/spring-plugin-core-1.2.0.RELEASE.jar:/Users/achao/.m2/repository/org/springframework/plugin/spring-plugin-metadata/1.2.0.RELEASE/spring-plugin-metadata-1.2.0.RELEASE.jar:/Users/achao/.m2/repository/org/mapstruct/mapstruct/1.2.0.Final/mapstruct-1.2.0.Final.jar:/Users/achao/.m2/repository/io/springfox/springfox-swagger-ui/2.9.2/springfox-swagger-ui-2.9.2.jar:/Applications/IntelliJ IDEA.app/Contents/lib/idea_rt.jar org.apache.shenyu.examples.http.ShenyuTestSwaggerApplication
Connected to the target VM, address: '127.0.0.1:51121', transport: 'socket'

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::                (v3.2.0)

2024-08-23T19:57:11.708+08:00  INFO 95759 --- [           main] o.a.s.e.h.ShenyuTestSwaggerApplication   : Starting ShenyuTestSwaggerApplication using Java 17.0.8.1 with PID 95759 (/Users/achao/IdeaProjects/shenyu/shenyu-examples/shenyu-examples-http-swagger2/target/classes started by achao in /Users/achao/IdeaProjects/shenyu)
2024-08-23T19:57:11.710+08:00  INFO 95759 --- [           main] o.a.s.e.h.ShenyuTestSwaggerApplication   : No active profile set, falling back to 1 default profile: "default"
2024-08-23T19:57:12.280+08:00  WARN 95759 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'swaggerConfiguration' of type [org.apache.shenyu.examples.http.config.SwaggerConfiguration$$SpringCGLIB$$0] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying). The currently created BeanPostProcessor [springfoxBeanHandler] is declared through a non-static factory method on that class; consider declaring it as static instead.
2024-08-23T19:57:12.409+08:00  INFO 95759 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat initialized with port 8190 (http)
2024-08-23T19:57:12.413+08:00  INFO 95759 --- [           main] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
2024-08-23T19:57:12.413+08:00  INFO 95759 --- [           main] o.apache.catalina.core.StandardEngine    : Starting Servlet engine: [Apache Tomcat/10.1.16]
2024-08-23T19:57:12.445+08:00  INFO 95759 --- [           main] o.a.c.c.C.[.[.[/http-swagger2]           : Initializing Spring embedded WebApplicationContext
2024-08-23T19:57:12.445+08:00  INFO 95759 --- [           main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 713 ms
2024-08-23T19:57:12.547+08:00  WARN 95759 --- [           main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'apiDocumentationScanner' defined in URL [jar:file:/Users/achao/.m2/repository/io/springfox/springfox-spring-web/2.9.2/springfox-spring-web-2.9.2.jar!/springfox/documentation/spring/web/scanners/ApiDocumentationScanner.class]: Unsatisfied dependency expressed through constructor parameter 1: Error creating bean with name 'apiListingScanner' defined in URL [jar:file:/Users/achao/.m2/repository/io/springfox/springfox-spring-web/2.9.2/springfox-spring-web-2.9.2.jar!/springfox/documentation/spring/web/scanners/ApiListingScanner.class]: Unsatisfied dependency expressed through constructor parameter 0: Error creating bean with name 'apiDescriptionReader' defined in URL [jar:file:/Users/achao/.m2/repository/io/springfox/springfox-spring-web/2.9.2/springfox-spring-web-2.9.2.jar!/springfox/documentation/spring/web/scanners/ApiDescriptionReader.class]: Unsatisfied dependency expressed through constructor parameter 0: Error creating bean with name 'cachingOperationReader' defined in URL [jar:file:/Users/achao/.m2/repository/io/springfox/springfox-spring-web/2.9.2/springfox-spring-web-2.9.2.jar!/springfox/documentation/spring/web/scanners/CachingOperationReader.class]: Unsatisfied dependency expressed through constructor parameter 0: Error creating bean with name 'apiOperationReader' defined in URL [jar:file:/Users/achao/.m2/repository/io/springfox/springfox-spring-web/2.9.2/springfox-spring-web-2.9.2.jar!/springfox/documentation/spring/web/readers/operation/ApiOperationReader.class]: Unsatisfied dependency expressed through constructor parameter 0: Error creating bean with name 'documentationPluginsManager': Unsatisfied dependency expressed through field 'documentationPlugins': Error creating bean with name 'documentationPluginRegistry': 'void org.springframework.util.Assert.notNull(java.lang.Object)'
2024-08-23T19:57:12.549+08:00  INFO 95759 --- [           main] o.apache.catalina.core.StandardService   : Stopping service [Tomcat]
2024-08-23T19:57:12.560+08:00  INFO 95759 --- [           main] .s.b.a.l.ConditionEvaluationReportLogger : 

Error starting ApplicationContext. To display the condition evaluation report re-run your application with 'debug' enabled.
2024-08-23T19:57:12.570+08:00 ERROR 95759 --- [           main] o.s.b.d.LoggingFailureAnalysisReporter   : 

***************************
APPLICATION FAILED TO START
***************************

Description:

An attempt was made to call a method that does not exist. The attempt was made from the following location:

    org.springframework.plugin.core.support.AbstractTypeAwareSupport$BeansOfTypeTargetSource.<init>(AbstractTypeAwareSupport.java:135)

The following method did not exist:

    'void org.springframework.util.Assert.notNull(java.lang.Object)'

The calling method's class, org.springframework.plugin.core.support.AbstractTypeAwareSupport$BeansOfTypeTargetSource, was loaded from the following location:

    jar:file:/Users/achao/.m2/repository/org/springframework/plugin/spring-plugin-core/1.2.0.RELEASE/spring-plugin-core-1.2.0.RELEASE.jar!/org/springframework/plugin/core/support/AbstractTypeAwareSupport$BeansOfTypeTargetSource.class

The called method's class, org.springframework.util.Assert, is available from the following locations:

    jar:file:/Users/achao/.m2/repository/org/springframework/spring-core/6.1.1/spring-core-6.1.1.jar!/org/springframework/util/Assert.class

The called method's class hierarchy was loaded from the following locations:

    org.springframework.util.Assert: file:/Users/achao/.m2/repository/org/springframework/spring-core/6.1.1/spring-core-6.1.1.jar


Action:

Correct the classpath of your application so that it contains compatible versions of the classes org.springframework.plugin.core.support.AbstractTypeAwareSupport$BeansOfTypeTargetSource and org.springframework.util.Assert

Disconnected from the target VM, address: '127.0.0.1:51121', transport: 'socket'

Process finished with exit code 1

Anything else?

Due to the compatibility issues with Springfox, I have decided to upgrade to Springdoc and migrate from Swagger 2 to Swagger 3. Any guidance or fixes related to this migration would be greatly appreciated.

VampireAchao avatar Aug 23 '24 12:08 VampireAchao