wangzihaogithub / spring-boot-protocol

springboot功能扩充-netty动态协议,可以支持各种网络协议的动态切换(单端口支持多个网络协议).支持mmap,sendfile零拷贝,http请求批量聚合
https://zihaoapi.cn
Apache License 2.0
117 stars 63 forks source link

适配springboot3出现问题 #43

Open yangxf-Ovo opened 2 months ago

yangxf-Ovo commented 2 months ago

大佬你好,我在自己的项目中用了当前工程,现在我像给我的项目升级springboot3,因此当前工程同样需要适配springboot3和jdk17. 当前我升级了一些组件的版本 <java.version>17</java.version> <spring-boot.version>3.3.1</spring-boot.version> <servlet-api.version>6.0.0</servlet-api.version> <jakarta-websocket-api.version>2.2.0</jakarta-websocket-api.version> 并替换了一些过期的类。 最终使用com.github.netty.http.HttpBootstrap启动测试时出现了错误,这里请教一下,是否能帮助我定位该问题是什么原因导致的。下面是我的启动日志:

`2024-08-08T15:25:01.953+08:00 INFO 22544 --- [ main] com.github.netty.http.HttpBootstrap : Starting HttpBootstrap using Java 17.0.12 with PID 22544 (D:\File\Project\data\spring-boot-protocol\target\test-classes started by bangsun in D:\File\Project\data\spring-boot-protocol) 2024-08-08T15:25:01.957+08:00 INFO 22544 --- [ main] com.github.netty.http.HttpBootstrap : No active profile set, falling back to 1 default profile: "default" 2024-08-08T15:25:03.422+08:00 INFO 22544 --- [ main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 1383 ms 2024-08-08T15:25:04.184+08:00 INFO 22544 --- [ main] c.g.netty.core.util.ResourceManager : ResourceManager rootPath : 'C:\Users\bangsun\AppData\Local\Temp\netty-docbase.8080.5161089438207562972', workspace : '/localhost' 2024-08-08T15:25:04.191+08:00 INFO 22544 --- [ main] c.g.netty.protocol.HttpServletProtocol : Netty servlet on port: 8080, with context path '/test' 2024-08-08T15:25:04.205+08:00 INFO 22544 --- [ main] c.g.n.s.s.NRpcProtocolSpringAdapter : addInstance(/_nrpc/command:, RpcCommandServiceImpl, ClassFileMethodToParameterNamesFunction) 2024-08-08T15:25:04.206+08:00 INFO 22544 --- [ main] c.g.n.s.s.NRpcProtocolSpringAdapter : addInstance(/_nrpc/db:, RpcDBServiceImpl, ClassFileMethodToParameterNamesFunction) 2024-08-08T15:25:04.208+08:00 WARN 22544 --- [ main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.context.ApplicationContextException: Failed to start bean 'webServerStartStop' 2024-08-08T15:25:04.218+08:00 INFO 22544 --- [ main] .s.b.a.l.ConditionEvaluationReportLogger :

Error starting ApplicationContext. To display the condition evaluation report re-run your application with 'debug' enabled. 2024-08-08T15:25:04.238+08:00 ERROR 22544 --- [ main] o.s.boot.SpringApplication : Application run failed

org.springframework.context.ApplicationContextException: Failed to start bean 'webServerStartStop' at org.springframework.context.support.DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:288) ~[spring-context-6.1.10.jar:6.1.10] at org.springframework.context.support.DefaultLifecycleProcessor$LifecycleGroup.start(DefaultLifecycleProcessor.java:469) ~[spring-context-6.1.10.jar:6.1.10] at java.base/java.lang.Iterable.forEach(Iterable.java:75) ~[na:na] at org.springframework.context.support.DefaultLifecycleProcessor.startBeans(DefaultLifecycleProcessor.java:257) ~[spring-context-6.1.10.jar:6.1.10] at org.springframework.context.support.DefaultLifecycleProcessor.onRefresh(DefaultLifecycleProcessor.java:202) ~[spring-context-6.1.10.jar:6.1.10] at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:981) ~[spring-context-6.1.10.jar:6.1.10] at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:627) ~[spring-context-6.1.10.jar:6.1.10] at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:146) ~[spring-boot-3.3.1.jar:3.3.1] at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:754) ~[spring-boot-3.3.1.jar:3.3.1] at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:456) ~[spring-boot-3.3.1.jar:3.3.1] at org.springframework.boot.SpringApplication.run(SpringApplication.java:335) ~[spring-boot-3.3.1.jar:3.3.1] at org.springframework.boot.SpringApplication.run(SpringApplication.java:1363) ~[spring-boot-3.3.1.jar:3.3.1] at org.springframework.boot.SpringApplication.run(SpringApplication.java:1352) ~[spring-boot-3.3.1.jar:3.3.1] at com.github.netty.http.HttpBootstrap.main(HttpBootstrap.java:17) ~[test-classes/:na] Caused by: org.springframework.boot.web.server.WebServerException: tcp server start fail.. cause = java.lang.UnsupportedOperationException: serverMethodOverwriteCheckList: [1] bad major

[2] bad major at com.github.netty.springboot.server.NettyTcpServer.start(NettyTcpServer.java:63) ~[classes/:na] at org.springframework.boot.web.servlet.context.WebServerStartStopLifecycle.start(WebServerStartStopLifecycle.java:44) ~[spring-boot-3.3.1.jar:3.3.1] at org.springframework.context.support.DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:285) ~[spring-context-6.1.10.jar:6.1.10] ... 13 common frames omitted Caused by: java.lang.UnsupportedOperationException: serverMethodOverwriteCheckList: [1] bad major

[2] bad major at com.github.netty.protocol.NRpcProtocol.onServerStart(NRpcProtocol.java:190) ~[classes/:na] at com.github.netty.springboot.server.NRpcProtocolSpringAdapter.onServerStart(NRpcProtocolSpringAdapter.java:48) ~[classes/:na] at com.github.netty.springboot.server.NettyTcpServer.start(NettyTcpServer.java:59) ~[classes/:na] ... 15 common frames omitted

Process finished with exit code 1 `

wangzihaogithub commented 2 months ago

用最新版本,或者你把NRpcProtocolSpringAdapter排除掉也行

因为 NRpcProtocolSpringAdapter目前不支持java17

yangxf-Ovo commented 2 months ago

(*ゝω・)ノThanks!