Spring Cloud Gateway报sun.misc.Unsafe.park(Native Method)

项目引入spring cloud gateway的jar报,启动的时候报:

bash 复制代码
[2024-07-05 10:10:16.162][main][ERROR][org.springframework.boot.web.embedded.tomcat.TomcatStarter][61]:Error starting Tomcat context. Exception: org.springframework.beans.factory.BeanCreationException. Message: Error creating bean with name 'servletEndpointRegistrar' defined in class path resource [org/springframework/boot/actuate/autoconfigure/endpoint/web/ServletEndpointManagementContextConfiguration$WebMvcServletEndpointManagementContextConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.boot.actuate.endpoint.web.ServletEndpointRegistrar]: Factory method 'servletEndpointRegistrar' threw exception; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'gatewayControllerEndpoint' defined in class path resource [org/springframework/cloud/gateway/config/GatewayAutoConfiguration$GatewayActuatorConfiguration.class]: Unsatisfied dependency expressed through method 'gatewayControllerEndpoint' parameter 2; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'modifyRequestBodyGatewayFilterFactory' defined in class path resource [org/springframework/cloud/gateway/config/GatewayAutoConfiguration.class]: Unsatisfied dependency expressed through method 'modifyRequestBodyGatewayFilterFactory' parameter 0; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'org.springframework.http.codec.ServerCodecConfigurer' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {}
[2024-07-05 10:10:16.188][main][INFO][org.apache.juli.logging.DirectJDKLog][173]:Stopping service [Tomcat]
[2024-07-05 10:10:16.193][main][WARN][org.apache.juli.logging.DirectJDKLog][173]:The web application [ROOT] appears to have started a thread named [spring.cloud.inetutils] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread:
 sun.misc.Unsafe.park(Native Method)
 java.util.concurrent.locks.LockSupport.park(LockSupport.java:175)
 java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2039)
 java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:442)
 java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1074)
 java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1134)
 java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
 java.lang.Thread.run(Thread.java:748)
[2024-07-05 10:10:16.196][main][WARN][org.springframework.context.support.AbstractApplicationContext][557]:Exception encountered during context initialization - cancelling refresh attempt: org.springframework.context.ApplicationContextException: Unable to start web server; nested exception is org.springframework.boot.web.server.WebServerException: Unable to start embedded Tomcat
[2024-07-05 10:10:16.213][main][INFO][org.springframework.boot.autoconfigure.logging.ConditionEvaluationReportLoggingListener][136]:

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
[2024-07-05 10:10:16.434][main][ERROR][org.springframework.boot.diagnostics.LoggingFailureAnalysisReporter][40]:

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

Description:

Parameter 0 of method modifyRequestBodyGatewayFilterFactory in org.springframework.cloud.gateway.config.GatewayAutoConfiguration required a bean of type 'org.springframework.http.codec.ServerCodecConfigurer' that could not be found.


Action:

Consider defining a bean of type 'org.springframework.http.codec.ServerCodecConfigurer' in your configuration.

解决方案:

网关异常报Consider defining a bean of type 'org.springframework.http.codec.ServerCodecConfigurer' in your configuration,

是因为项目引入了spring-boot-starter-web,因为会与spring cloud gateway的webflux冲突。所以项目不要引入spring-boot-starter-web。

本案例是删除spring-boot-starter-web的引入

相关推荐
运维开发王义杰1 天前
Kubernetes:EKS 中 Istio Ingress Gateway 负载均衡器配置及常见问题解析
kubernetes·gateway·istio
铭毅天下2 天前
极限网关 INFINI Gateway 从 0 到 1:简单易懂的入门教程
gateway
铭毅天下2 天前
极限网关核心架构解析:从 Nginx 到 INFINI Gateway 的演进
运维·nginx·架构·gateway
Xwzzz_3 天前
Spring Cloud Gateway中断言路由和过滤器的使用
java·spring cloud·gateway
zzyh1234563 天前
springcloudalibaba组件gateway
前端·javascript·gateway
@明明不知道3 天前
spring cloud 微服务部署(2025年)第一章:Nacos、LoadBalancer、GateWay、Ribbon集成之Nacos部署
spring cloud·微服务·nacos·gateway·loadbalancer
山海不说话4 天前
从零搭建微服务项目(第7章——微服务网关模块基础实现)
java·spring boot·spring·spring cloud·微服务·gateway
默辨4 天前
再谈SpringCloud Gateway源码
java·网关·spring cloud·gateway·reactor·webflux
飞火流星020274 天前
【动态路由】系统web url整合系列【springcloud-gateway实现】【不改hosts文件版】组件一:多个Eureka路由过滤器
gateway·gateway动态路由·gateway实现反向代理·系统url整合·eureka路由过滤器·gateway路由过滤器
azoon.top4 天前
springcloud集成gateway
微服务·gateway·springcloud