项目不报错,正常运行,无法请求到服务

先说我最终的解决办法:

导致原因:idea断点打在了方法名上,导致项目无法运行

debug启动方式 ,无法启动。   

不开启debug   正常运行方式可以正常启动

排查这个问题好久了,花了很长时间才找到问题的关键,在初用idea的时候其实也有遇到过这个问题,但是当时很快的解决了

  1. 以为项目是正常运行成功了,并且也没报错。我去 这怎么查?  ping Redis  发现都可以正常运行的
  2. 以为是代码的问题,排除法,昨天是正常运行的,没有一点事,备份一下当前代码,还原到昨天的代码。发现还是不行
  3. 期间有报错,以为是 Redisson jar原因导致的,  或者是Netty冲突导致的。  这一块花了比较多的时间
  4. 打包放到服务器上,发现可以正常运行。  这一步很关键,一下就定位到问题是哪里了。然后cmd 在windows上运行也可以正常运行 ,那就说明是idea 搞的鬼了 

问题3记录的报错信息:

ERROR o.r.c.h.ErrorsLoggingHandler - Exception occured. Channel: [id: 0x6f524ea6, L:/192.168.1.15:51150 - R:/129.:6379]
java.io.IOException: 远程主机强迫关闭了一个现有的连接。
	at sun.nio.ch.SocketDispatcher.read0(Native Method)
	at sun.nio.ch.SocketDispatcher.read(SocketDispatcher.java:43)
	at sun.nio.ch.IOUtil.readIntoNativeBuffer(IOUtil.java:223)
	at sun.nio.ch.IOUtil.read(IOUtil.java:192)
	at sun.nio.ch.SocketChannelImpl.read(SocketChannelImpl.java:379)
	at io.netty.buffer.PooledUnsafeDirectByteBuf.setBytes(PooledUnsafeDirectByteBuf.java:288)
	at io.netty.buffer.AbstractByteBuf.writeBytes(AbstractByteBuf.java:1125)
	at io.netty.channel.socket.nio.NioSocketChannel.doReadBytes(NioSocketChannel.java:347)
	at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:148)
	at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:682)
	at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:617)
	at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:534)
	at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:496)
	at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:906)
	at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
	at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
	at java.lang.Thread.run(Thread.java:745)
[]-2020-12-25 15:51:16.747 [redisson-timer-4-1] ERROR o.r.c.h.PingConnectionHandler - Unable to send PING command over channel: [id: 0x6f524ea6, L:/192.168:51150 ! R:/129.20xx:6379]
org.redisson.client.RedisTimeoutException: Command execution timeout for command: (PING), params: [], Redis client: [addr=redis://129.2xx:6379]
	at org.redisson.client.RedisConnection.lambda$async$1(RedisConnection.java:207)
	at org.redisson.client.RedisConnection$$Lambda$376/1172508.run(Unknown Source)
	at io.netty.util.HashedWheelTimer$HashedWheelTimeout.expire(HashedWheelTimer.java:682)
	at io.netty.util.HashedWheelTimer$HashedWheelBucket.expireTimeouts(HashedWheelTimer.java:757)
	at io.netty.util.HashedWheelTimer$Worker.run(HashedWheelTimer.java:485)
	at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
	at java.lang.Thread.run(Thread.java:745)

这一行代码才代表整个项目运行了

[]-2020-12-26 10:25:35.763 [main] INFO  cn.blogspring.Application - Started Application in 31.123 seconds (JVM running for 32.419)

而这时候根本还没运行起来,只是上下文加载完成了

[]-2020-12-26 10:27:13.555 [main] INFO  o.s.w.c.ContextLoader - Root WebApplicationContext: initialization completed in 4956 ms
原文地址:https://www.cnblogs.com/blogspring/p/14191734.html