Error

Lock wait timeout exceeded; try restarting transaction\n; Lock wait timeout exceeded; try restarting transaction; nested exception is com.mysql.jdbc.exceptions.jdbc4.MySQLTransactionRollbackException: Lock wait timeout exceeded; try restarting transaction

Solution

You should avoid processing too much data at once in a transaction. If you have to process a lot of data, you can increase the value of innodb_lock_wait_timeout.