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

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

[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. SpringCloudGateway

    2024-07-09 19:50:06       20 阅读
  2. SpringCloudGateway之限流集成篇

    2024-07-09 19:50:06       34 阅读
  3. SpringCloudGateway之统一鉴权篇

    2024-07-09 19:50:06       28 阅读
  4. 基于SpringCloudGateway实现接口鉴权

    2024-07-09 19:50:06       30 阅读
  5. SpringCloudGateway 3.1.4版本 Netty内存泄漏问题解决

    2024-07-09 19:50:06       57 阅读
  6. 通过SpringCloudGateway中的GlobalFilter实现鉴权过滤

    2024-07-09 19:50:06       23 阅读

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2024-07-09 19:50:06       50 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2024-07-09 19:50:06       54 阅读
  3. 在Django里面运行非项目文件

    2024-07-09 19:50:06       43 阅读
  4. Python语言-面向对象

    2024-07-09 19:50:06       54 阅读

热门阅读

  1. Spring Cloud Gateway如何匹配某路径并进行路由转发

    2024-07-09 19:50:06       24 阅读
  2. 裸金属服务器与物理服务器之间的区别

    2024-07-09 19:50:06       18 阅读
  3. 精准注入:掌握Conda包依赖注入的艺术

    2024-07-09 19:50:06       26 阅读
  4. Haproxy搭建Web群集

    2024-07-09 19:50:06       22 阅读
  5. 同步的艺术:Conda包依赖的自动同步策略

    2024-07-09 19:50:06       26 阅读
  6. Shell学习——Shell运算符

    2024-07-09 19:50:06       41 阅读
  7. ECharts 饼图:数据可视化的重要工具

    2024-07-09 19:50:06       28 阅读
  8. react之错误边界

    2024-07-09 19:50:06       22 阅读
  9. 代码随想录算法训练营:27/60

    2024-07-09 19:50:06       29 阅读
  10. Websocket

    2024-07-09 19:50:06       39 阅读
  11. 力扣56.合并区间

    2024-07-09 19:50:06       37 阅读