項目不報錯,正常運行,無法請求到服務


先說我最終的解決辦法:

導致原因: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

 

 

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM