org.springframework.transaction.CannotCreateTransactionException

Could not open Hibernate Session for transaction; nested exception is org.hibernate.TransactionException: JDBC begin transaction failed:

Samebug tips0

We couldn't find tips for this exception.

Don't give up yet. Paste your full stack trace to get a solution.

Solutions on the web399

Stack trace

  • org.springframework.transaction.CannotCreateTransactionException: Could not open Hibernate Session for transaction; nested exception is org.hibernate.TransactionException: JDBC begin transaction failed: at org.springframework.orm.hibernate4.HibernateTransactionManager.doBegin(HibernateTransactionManager.java:544)[spring-orm-4.1.6.RELEASE.jar:4.1.6.RELEASE] at org.springframework.transaction.support.AbstractPlatformTransactionManager.getTransaction(AbstractPlatformTransactionManager.java:373)[spring-tx-4.0.9.RELEASE.jar:4.0.9.RELEASE] at org.springframework.transaction.interceptor.TransactionAspectSupport.createTransactionIfNecessary(TransactionAspectSupport.java:420)[spring-tx-4.0.9.RELEASE.jar:4.0.9.RELEASE] at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:257)[spring-tx-4.0.9.RELEASE.jar:4.0.9.RELEASE] at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:95)[spring-tx-4.0.9.RELEASE.jar:4.0.9.RELEASE] at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)[spring-aop-4.1.6.RELEASE.jar:4.1.6.RELEASE] at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:207)[spring-aop-4.1.6.RELEASE.jar:4.1.6.RELEASE] at com.sun.proxy.$Proxy222.getAllCampaigns(Unknown Source)[na:na] at com.adsizzler.adserver.controller.AdminCampaignController.GetCampaigns(AdminCampaignController.java:181)[classes/:na] at sun.reflect.GeneratedMethodAccessor183.invoke(Unknown Source)[na:na] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)[na:1.8.0_91] at java.lang.reflect.Method.invoke(Method.java:498)[na:1.8.0_91] at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:221)[spring-web-4.1.6.RELEASE.jar:4.1.6.RELEASE] at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:137)[spring-web-4.1.6.RELEASE.jar:4.1.6.RELEASE] at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:110)[spring-webmvc-4.1.6.RELEASE.jar:4.1.6.RELEASE] at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandleMethod(RequestMappingHandlerAdapter.java:776)[spring-webmvc-4.1.6.RELEASE.jar:4.1.6.RELEASE] at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:705)[spring-webmvc-4.1.6.RELEASE.jar:4.1.6.RELEASE] at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85)[spring-webmvc-4.1.6.RELEASE.jar:4.1.6.RELEASE] at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:959)[spring-webmvc-4.1.6.RELEASE.jar:4.1.6.RELEASE] at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:893)[spring-webmvc-4.1.6.RELEASE.jar:4.1.6.RELEASE] at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:966)[spring-webmvc-4.1.6.RELEASE.jar:4.1.6.RELEASE] at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:857)[spring-webmvc-4.1.6.RELEASE.jar:4.1.6.RELEASE] at javax.servlet.http.HttpServlet.service(HttpServlet.java:622)[servlet-api.jar:na] at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:842)[spring-webmvc-4.1.6.RELEASE.jar:4.1.6.RELEASE] at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)[servlet-api.jar:na] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:292)[catalina.jar:8.0.36] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)[catalina.jar:8.0.36] at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)[tomcat-websocket.jar:8.0.36] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)[catalina.jar:8.0.36] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)[catalina.jar:8.0.36] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)[spring-security-web-3.2.3.RELEASE.jar:3.2.3.RELEASE] at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:118)[spring-security-web-3.2.3.RELEASE.jar:3.2.3.RELEASE] at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:84)[spring-security-web-3.2.3.RELEASE.jar:3.2.3.RELEASE] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)[spring-security-web-3.2.3.RELEASE.jar:3.2.3.RELEASE] at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:113)[spring-security-web-3.2.3.RELEASE.jar:3.2.3.RELEASE] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)[spring-security-web-3.2.3.RELEASE.jar:3.2.3.RELEASE] at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:103)[spring-security-web-3.2.3.RELEASE.jar:3.2.3.RELEASE] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)[spring-security-web-3.2.3.RELEASE.jar:3.2.3.RELEASE] at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:113)[spring-security-web-3.2.3.RELEASE.jar:3.2.3.RELEASE] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)[spring-security-web-3.2.3.RELEASE.jar:3.2.3.RELEASE] at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:154)[spring-security-web-3.2.3.RELEASE.jar:3.2.3.RELEASE] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)[spring-security-web-3.2.3.RELEASE.jar:3.2.3.RELEASE] at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:45)[spring-security-web-3.2.3.RELEASE.jar:3.2.3.RELEASE] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)[spring-security-web-3.2.3.RELEASE.jar:3.2.3.RELEASE] at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:199)[spring-security-web-3.2.3.RELEASE.jar:3.2.3.RELEASE] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)[spring-security-web-3.2.3.RELEASE.jar:3.2.3.RELEASE] at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:110)[spring-security-web-3.2.3.RELEASE.jar:3.2.3.RELEASE] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)[spring-security-web-3.2.3.RELEASE.jar:3.2.3.RELEASE] at org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:50)[spring-security-web-3.2.3.RELEASE.jar:3.2.3.RELEASE] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)[spring-web-4.1.6.RELEASE.jar:4.1.6.RELEASE] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)[spring-security-web-3.2.3.RELEASE.jar:3.2.3.RELEASE] at org.springframework.security.web.session.ConcurrentSessionFilter.doFilter(ConcurrentSessionFilter.java:125)[spring-security-web-3.2.3.RELEASE.jar:3.2.3.RELEASE] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)[spring-security-web-3.2.3.RELEASE.jar:3.2.3.RELEASE] at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:87)[spring-security-web-3.2.3.RELEASE.jar:3.2.3.RELEASE] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)[spring-security-web-3.2.3.RELEASE.jar:3.2.3.RELEASE] at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:192)[spring-security-web-3.2.3.RELEASE.jar:3.2.3.RELEASE] at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:160)[spring-security-web-3.2.3.RELEASE.jar:3.2.3.RELEASE] at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:344)[spring-web-4.1.6.RELEASE.jar:4.1.6.RELEASE] at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:261)[spring-web-4.1.6.RELEASE.jar:4.1.6.RELEASE] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)[catalina.jar:8.0.36] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)[catalina.jar:8.0.36] at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:212)[catalina.jar:8.0.36] at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)[catalina.jar:8.0.36] at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)[catalina.jar:8.0.36] at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141)[catalina.jar:8.0.36] at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)[catalina.jar:8.0.36] at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:616)[catalina.jar:8.0.36] at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)[catalina.jar:8.0.36] at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:528)[catalina.jar:8.0.36] at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1099)[tomcat-coyote.jar:8.0.36] at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:670)[tomcat-coyote.jar:8.0.36] at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1520)[tomcat-coyote.jar:8.0.36] at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1476)[tomcat-coyote.jar:8.0.36] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)[na:1.8.0_91] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)[na:1.8.0_91] at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)[tomcat-util.jar:8.0.36] at java.lang.Thread.run(Thread.java:745)[na:1.8.0_91] Caused by: org.hibernate.TransactionException: JDBC begin transaction failed: at org.hibernate.engine.transaction.internal.jdbc.JdbcTransaction.doBegin(JdbcTransaction.java:76)[hibernate-core-4.3.7.Final.jar:4.3.7.Final] at org.hibernate.engine.transaction.spi.AbstractTransactionImpl.begin(AbstractTransactionImpl.java:162)[hibernate-core-4.3.7.Final.jar:4.3.7.Final] at org.hibernate.internal.SessionImpl.beginTransaction(SessionImpl.java:1435)[hibernate-core-4.3.7.Final.jar:4.3.7.Final] at org.springframework.orm.hibernate4.HibernateTransactionManager.doBegin(HibernateTransactionManager.java:502)[spring-orm-4.1.6.RELEASE.jar:4.1.6.RELEASE] ... 76 more Caused by: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure The last packet successfully received from the server was 435,883 milliseconds ago. The last packet sent successfully to the server was 1 milliseconds ago. at sun.reflect.GeneratedConstructorAccessor133.newInstance(Unknown Source)[na:na] at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)[na:1.8.0_91] at java.lang.reflect.Constructor.newInstance(Constructor.java:423)[na:1.8.0_91] at com.mysql.jdbc.Util.handleNewInstance(Util.java:409)[mysql-connector-java-5.1.30.jar:na] at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:1127)[mysql-connector-java-5.1.30.jar:na] at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:3715)[mysql-connector-java-5.1.30.jar:na] at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:3604)[mysql-connector-java-5.1.30.jar:na] at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4155)[mysql-connector-java-5.1.30.jar:na] at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2615)[mysql-connector-java-5.1.30.jar:na] at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2776)[mysql-connector-java-5.1.30.jar:na] at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2832)[mysql-connector-java-5.1.30.jar:na] at com.mysql.jdbc.ConnectionImpl.setAutoCommit(ConnectionImpl.java:5357)[mysql-connector-java-5.1.30.jar:na] at org.apache.commons.dbcp.DelegatingConnection.setAutoCommit(DelegatingConnection.java:331)[commons-dbcp-1.2.2.jar:1.2.2] at org.apache.commons.dbcp.PoolingDataSource$PoolGuardConnectionWrapper.setAutoCommit(PoolingDataSource.java:317)[commons-dbcp-1.2.2.jar:1.2.2] at org.hibernate.engine.transaction.internal.jdbc.JdbcTransaction.doBegin(JdbcTransaction.java:72)[hibernate-core-4.3.7.Final.jar:4.3.7.Final] ... 79 more Caused by: java.io.EOFException: Can not read response from server. Expected to read 4 bytes, read 0 bytes before connection was unexpectedly lost. at com.mysql.jdbc.MysqlIO.readFully(MysqlIO.java:3161)[mysql-connector-java-5.1.30.jar:na] at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:3615)[mysql-connector-java-5.1.30.jar:na]

Write tip

You have a different solution? A short tip here would help you and many other users who saw this issue last week.

Users with the same issue

mauritiusmauritius
2 times, last one
Unknown visitor
Unknown visitorOnce,
ivanszkypeterivanszkypeter
10 times, last one
AxeloAxelo
Once,
linxiaolonglinxiaolong
4 times, last one
19 more bugmates