Jprotobuf-rpc-socket
Jprotobuf-rpc-socket copied to clipboard
Springboot使用时,必须要依赖spring-boot-starter-web吗?
SpringBoot: 2.5.6
Jprotobuf-rpc-socket: 4.1.8
不加这个的话, 服务端启动时报错:
org.springframework.context.ApplicationContextException: Unable to start web server; nested exception is org.springframework.context.ApplicationContextException: Unable to start ServletWebServerApplicationContext due to missing ServletWebServerFactory bean.
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.java:163) ~[spring-boot-2.5.6.jar:2.5.6]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:577) ~[spring-context-5.3.12.jar:5.3.12]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:145) ~[spring-boot-2.5.6.jar:2.5.6]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:754) ~[spring-boot-2.5.6.jar:2.5.6]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:434) ~[spring-boot-2.5.6.jar:2.5.6]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:338) ~[spring-boot-2.5.6.jar:2.5.6]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1343) ~[spring-boot-2.5.6.jar:2.5.6]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1332) ~[spring-boot-2.5.6.jar:2.5.6]
at org.zjxy.jprpc.JpRpcServerApp.main(JpRpcServerApp.java:20) ~[classes/:na]
Caused by: org.springframework.context.ApplicationContextException: Unable to start ServletWebServerApplicationContext due to missing ServletWebServerFactory bean.
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.getWebServerFactory(ServletWebServerApplicationContext.java:210) ~[spring-boot-2.5.6.jar:2.5.6]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.createWebServer(ServletWebServerApplicationContext.java:180) ~[spring-boot-2.5.6.jar:2.5.6]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.java:160) ~[spring-boot-2.5.6.jar:2.5.6]
... 8 common frames omitted
Process finished with exit code 1
Jprotobuf-rpc-socket 只在test测试时会依赖spring web的,你那边还有更多的stacktrace吗?
Jprotobuf-rpc-socket 只在test测试时会依赖spring web的,你那边还有更多的stacktrace吗? 这是全部的启动日志:
2021-12-15 10:29:37.421 INFO 12176 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'com.baidu.pbrpc.spring.conf.PbRPCConfiguration' of type [com.baidu.pbrpc.spring.conf.PbRPCConfiguration$$EnhancerBySpringCGLIB$$cfdc31e0] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2021-12-15 10:29:37.449 WARN 12176 --- [ main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.context.ApplicationContextException: Unable to start web server; nested exception is org.springframework.context.ApplicationContextException: Unable to start ServletWebServerApplicationContext due to missing ServletWebServerFactory bean.
2021-12-15 10:29:37.455 INFO 12176 --- [ main] ConditionEvaluationReportLoggingListener :
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2021-12-15 10:29:37.468 ERROR 12176 --- [ main] o.s.boot.SpringApplication : Application run failed
org.springframework.context.ApplicationContextException: Unable to start web server; nested exception is org.springframework.context.ApplicationContextException: Unable to start ServletWebServerApplicationContext due to missing ServletWebServerFactory bean.
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.java:163) ~[spring-boot-2.5.6.jar:2.5.6]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:577) ~[spring-context-5.3.12.jar:5.3.12]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:145) ~[spring-boot-2.5.6.jar:2.5.6]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:754) ~[spring-boot-2.5.6.jar:2.5.6]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:434) ~[spring-boot-2.5.6.jar:2.5.6]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:338) ~[spring-boot-2.5.6.jar:2.5.6]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1343) ~[spring-boot-2.5.6.jar:2.5.6]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1332) ~[spring-boot-2.5.6.jar:2.5.6]
at org.zjxy.jprpc.JpRpcServerApp.main(JpRpcServerApp.java:20) ~[classes/:na]
Caused by: org.springframework.context.ApplicationContextException: Unable to start ServletWebServerApplicationContext due to missing ServletWebServerFactory bean.
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.getWebServerFactory(ServletWebServerApplicationContext.java:210) ~[spring-boot-2.5.6.jar:2.5.6]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.createWebServer(ServletWebServerApplicationContext.java:180) ~[spring-boot-2.5.6.jar:2.5.6]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.java:160) ~[spring-boot-2.5.6.jar:2.5.6]
... 8 common frames omitted
下面是环境配置
SpringBoot: 2.5.6 JDK: Zulu-OpenJDK-11 pom.xml 依赖:
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<!-- 提供spring boot扩展 -->
<dependency>
<groupId>com.baidu</groupId>
<artifactId>jprotobuf-rpc-spring-starter</artifactId>
<version>4.1.9</version>
</dependency>
</dependencies>
刚试了下, 去掉杂七杂八的, 什么都不写, 就一个空的项目, 依赖了jprotobuf-rpc-spring-starter
就有这问题. 😭
不知道是不是使用问题 .
jprotobuf-rpc-core-spring 里面依赖了个 spring-web 的原因嘛
发布了4.1.9,你升级一下试一下