mysql事务报错Communications link failure during commit(). Transaction resolution unknown.
问题
线上报错
exception=com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Communications link failure during commit(). Transaction resolution unknown.
at sun.reflect.GeneratedConstructorAccessor400.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at com.mysql.jdbc.Util.handleNewInstance(Util.java:425)
at com.mysql.jdbc.Util.getInstance(Util.java:408)
原因
经查看代码&查询资料,发现在该代码方法上有个@Transactional,另外该接口请求延时较高,达8s
故问题点在于
- 查询方法不应加事务
- 依赖的三方延时高,添加缓存