具体报错如下:
2022-08-18 10:51:06.125 [main] ERROR o.s.boot.SpringApplication - Application startup failed
java.lang.IllegalStateException: Failed to execute CommandLineRunner
at org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:779)
at org.springframework.boot.SpringApplication.callRunners(SpringApplication.java:760)
at org.springframework.boot.SpringApplication.afterRefresh(SpringApplication.java:747)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:315)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1162)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1151)
at com.dataplatform.bigData.RestBigdataKuduApplication.main(RestBigdataKuduApplication.java:33)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:49)
at org.springframework.boot.loader.Launcher.launch(Launcher.java:108)
at org.springframework.boot.loader.Launcher.launch(Launcher.java:58)
at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:88)
Caused by: redis.clients.jedis.exceptions.JedisException: Could not return the resource to the pool
at redis.clients.jedis.JedisPool.returnResource(JedisPool.java:256)
at redis.clients.jedis.JedisPool.returnResource(JedisPool.java:16)
at redis.clients.jedis.Jedis.close(Jedis.java:3409)
at com.dataplatform.bigData.service.impl.ApplicationTask.freshFaultInfoFromRedis(ApplicationTask.java:93)
at com.dataplatform.bigData.RestBigdataKuduApplication.run(RestBigdataKuduApplication.java:39)
at org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:776)
... 14 common frames omitted
Caused by: redis.clients.jedis.exceptions.JedisConnectionException: Unknown reply: [
at redis.clients.jedis.Protocol.process(Protocol.java:164)
at redis.clients.jedis.Protocol.read(Protocol.java:215)
at redis.clients.jedis.Connection.readProtocolWithCheckingBroken(Connection.java:340)
at redis.clients.jedis.Connection.getAll(Connection.java:310)
at redis.clients.jedis.Connection.getAll(Connection.java:302)
at redis.clients.jedis.Pipeline.sync(Pipeline.java:99)
at redis.clients.jedis.Pipeline.clear(Pipeline.java:85)
at redis.clients.jedis.BinaryJedis.resetState(BinaryJedis.java:1781)
at redis.clients.jedis.JedisPool.returnResource(JedisPool.java:252)
... 19 common frames omitted
原因:本次原因由于springboot 微服务的内存不够导致的,与代码关系不大;
解决方式:
提高微服务内存占用。如:java -Xms2048m -Xmx2048m
本文只提供了一种可能性,也可能有其它原因,如jedis错误关闭,redis服务端链接数不够等。