VelocityServlet: Error processing the template

unexpected error when rollbacking
javax.persistence.PersistenceException: unexpected error when rollbacking at org.hibernate.ejb.TransactionImpl.rollback(TransactionImpl.java:88) at com.dg.persistence.JPAPersister.rollback(JPAPersister.java:139) at com.dg.webtools.velocity.VelocityBase.handleRequest(VelocityBase.java:137) at org.apache.velocity.servlet.VelocityServlet.doRequest(VelocityServlet.java:365) at org.apache.velocity.servlet.VelocityServlet.doGet(VelocityServlet.java:318) at javax.servlet.http.HttpServlet.service(HttpServlet.java:489) at javax.servlet.http.HttpServlet.service(HttpServlet.java:583) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:212) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:156) at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:51) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:181) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:156) at com.dg.webtools.filters.RefererFilter.doFilter(RefererFilter.java:65) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:181) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:156) at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:662) at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:428) at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:360) at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:297) at com.dg.webtools.filters.LocaleFilter.doFilter(LocaleFilter.java:49) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:181) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:156) at com.dg.webtools.filters.PersistenceFilter.doFilter(PersistenceFilter.java:27) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:181) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:156) at com.dg.webtools.filters.MaintenanceFilter.doFilter(MaintenanceFilter.java:42) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:181) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:156) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:167) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:90) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:483) at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:682) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:130) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:93) at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:682) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343) at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:617) at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:63) at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:932) at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1694) at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:52) at org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1191) at org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659) at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) at java.base/java.lang.Thread.run(Thread.java:829) Caused by: org.hibernate.TransactionException: JDBC rollback failed at org.hibernate.transaction.JDBCTransaction.rollback(JDBCTransaction.java:170) at org.hibernate.ejb.TransactionImpl.rollback(TransactionImpl.java:85) ... 45 more Caused by: java.sql.SQLException: Connection com.mysql.cj.jdbc.ConnectionImpl@3fd4a94e is closed. at org.apache.tomcat.dbcp.dbcp2.DelegatingConnection.checkOpen(DelegatingConnection.java:603) at org.apache.tomcat.dbcp.dbcp2.DelegatingConnection.rollback(DelegatingConnection.java:480) at org.apache.tomcat.dbcp.dbcp2.DelegatingConnection.rollback(DelegatingConnection.java:482) at org.hibernate.transaction.JDBCTransaction.rollbackAndResetAutoCommit(JDBCTransaction.java:183) at org.hibernate.transaction.JDBCTransaction.rollback(JDBCTransaction.java:162) ... 46 more