Flink程式異常--CommunicationsException: The last packet successfully received from the server was 46,912,998 milliseconds ago
阿新 • • 發佈:2022-03-16
一、異常截圖
com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: The last packet successfully received from the server was 46,912,998 milliseconds ago. The last packet sent successfully to the server was 46,913,003 milliseconds ago. is longer than the server configured value of 'wait_timeout'. You should consider either expiring and/or testing connection validity before use in your application, increasing the server configured values for client timeouts, or using the Connector/J connection property 'autoReconnect=true' to avoid this problem. at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
二、原因
連線資料庫超時
三、解決方法
解決方法1:使用連線池定時重新整理伺服器時間戳
解決方法2:flink連線mysql時指定autoReconnect=true
即使在建立Mysql時url中加入了autoReconnect=true引數,一但這個連線兩次訪問資料庫的時間超出了伺服器端 wait_timeout的時間限制