这个问题我也遇见过,当你用connection.setAutoCommit(false)开始事务的时候,此Connection的reference必须是被你独占的,也就是说,只能有一个reference,不能被共享.因此,解决方式是用
connection = ds.getConnection()重开一个连结.