org.springframework.transaction.CannotCreateTransactionException

Could not open JPA EntityManager for transaction; nested exception is <openjpa-2.2.0-r422266:1244990 fatal general error> org.apache.openjpa.persistence.PersistenceException: Cannot create PoolableConnectionFactory (Could not create connection to database server. Attempted reconnect 3 times. Giving up.)

Samebug tips4

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 web5136

  • via Unknown by Maxim Solodovnik,
  • via Unknown by Corey Brady,
  • Stack trace

    • org.springframework.transaction.CannotCreateTransactionException: Could not open JPA EntityManager for transaction; nested exception is <openjpa-2.2.0-r422266:1244990 fatal general error> org.apache.openjpa.persistence.PersistenceException: Cannot create PoolableConnectionFactory (Could not create connection to database server. Attempted reconnect 3 times. Giving up.) at org.springframework.orm.jpa.JpaTransactionManager.doBegin(JpaTransactionManager.java:427)[org.springframework.orm-jar-3.1.1.RELEASE.jar:3.1.1.RELEASE] at org.springframework.transaction.support.AbstractPlatformTransactionManager.getTransaction(AbstractPlatformTransactionManager.java:371)[org.springframework.transaction-jar-3.1.1.RELEASE.jar:3.1.1.RELEASE] at org.springframework.transaction.interceptor.TransactionAspectSupport.createTransactionIfNecessary(TransactionAspectSupport.java:335)[org.springframework.transaction-jar-3.1.1.RELEASE.jar:3.1.1.RELEASE] at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:105)[org.springframework.transaction-jar-3.1.1.RELEASE.jar:3.1.1.RELEASE] at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)[spring-aop-3.1.1.RELEASE.jar:3.1.1.RELEASE] at org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:622)[spring-aop-3.1.1.RELEASE.jar:3.1.1.RELEASE] at org.openmeetings.app.data.basic.Sessionmanagement$$EnhancerByCGLIB$$62325b28.clearSessionTable(<generated>)[com.springsource.net.sf.cglib-2.2.0.jar:na] at org.openmeetings.app.quartz.scheduler.SessionClearJob.doIt(SessionClearJob.java:36)[openmeetings-2.0.0-RELEASE.jar:na] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)[na:1.7.0_25] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)[na:1.7.0_25] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)[na:1.7.0_25] at java.lang.reflect.Method.invoke(Unknown Source)[na:1.7.0_25] at org.springframework.util.MethodInvoker.invoke(MethodInvoker.java:273)[spring-core-3.1.1.RELEASE.jar:3.1.1.RELEASE] at org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean$MethodInvokingJob.executeInternal(MethodInvokingJobDetailFactoryBean.java:311)[spring-context-support-3.1.1.RELEASE.jar:3.1.1.RELEASE] at org.springframework.scheduling.quartz.QuartzJobBean.execute(QuartzJobBean.java:113)[spring-context-support-3.1.1.RELEASE.jar:3.1.1.RELEASE] at org.quartz.core.JobRunShell.run(JobRunShell.java:216)[quartz-1.8.5.jar:na] at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:549)[quartz-1.8.5.jar:na] Caused by: org.apache.openjpa.persistence.PersistenceException: Cannot create PoolableConnectionFactory (Could not create connection to database server. Attempted reconnect 3 times. Giving up.) at org.apache.openjpa.jdbc.sql.DBDictionaryFactory.newDBDictionary(DBDictionaryFactory.java:102)[openjpa-bundle-2.2.0.jar:2.2.0] at org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl.getDBDictionaryInstance(JDBCConfigurationImpl.java:603)[openjpa-bundle-2.2.0.jar:2.2.0] at org.apache.openjpa.jdbc.meta.MappingRepository.endConfiguration(MappingRepository.java:1510)[openjpa-bundle-2.2.0.jar:2.2.0] at org.apache.openjpa.lib.conf.Configurations.configureInstance(Configurations.java:518)[openjpa-bundle-2.2.0.jar:2.2.0] at org.apache.openjpa.lib.conf.Configurations.configureInstance(Configurations.java:443)[openjpa-bundle-2.2.0.jar:2.2.0] at org.apache.openjpa.lib.conf.PluginValue.instantiate(PluginValue.java:104)[openjpa-bundle-2.2.0.jar:2.2.0] at org.apache.openjpa.conf.MetaDataRepositoryValue.instantiate(MetaDataRepositoryValue.java:68)[openjpa-bundle-2.2.0.jar:2.2.0] at org.apache.openjpa.lib.conf.ObjectValue.instantiate(ObjectValue.java:83)[openjpa-bundle-2.2.0.jar:2.2.0] at org.apache.openjpa.conf.OpenJPAConfigurationImpl.newMetaDataRepositoryInstance(OpenJPAConfigurationImpl.java:968)[openjpa-bundle-2.2.0.jar:2.2.0] at org.apache.openjpa.conf.OpenJPAConfigurationImpl.getMetaDataRepositoryInstance(OpenJPAConfigurationImpl.java:959)[openjpa-bundle-2.2.0.jar:2.2.0] at org.apache.openjpa.kernel.BrokerImpl.initialize(BrokerImpl.java:337)[openjpa-bundle-2.2.0.jar:2.2.0] at org.apache.openjpa.kernel.BrokerImpl.initialize(BrokerImpl.java:325)[openjpa-bundle-2.2.0.jar:2.2.0] at org.apache.openjpa.kernel.AbstractBrokerFactory.initializeBroker(AbstractBrokerFactory.java:228)[openjpa-bundle-2.2.0.jar:2.2.0] at org.apache.openjpa.kernel.AbstractBrokerFactory.newBroker(AbstractBrokerFactory.java:212)[openjpa-bundle-2.2.0.jar:2.2.0] at org.apache.openjpa.kernel.DelegatingBrokerFactory.newBroker(DelegatingBrokerFactory.java:156)[openjpa-bundle-2.2.0.jar:2.2.0] at org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:227)[openjpa-bundle-2.2.0.jar:2.2.0] at org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:154)[openjpa-bundle-2.2.0.jar:2.2.0] at org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:60)[openjpa-bundle-2.2.0.jar:2.2.0] at org.springframework.orm.jpa.JpaTransactionManager.createEntityManagerForTransaction(JpaTransactionManager.java:445)[org.springframework.orm-jar-3.1.1.RELEASE.jar:3.1.1.RELEASE] at org.springframework.orm.jpa.JpaTransactionManager.doBegin(JpaTransactionManager.java:366)[org.springframework.orm-jar-3.1.1.RELEASE.jar:3.1.1.RELEASE] ... 16 more Caused by: org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (Could not create connection to database server. Attempted reconnect 3 times. Giving up.) at org.apache.commons.dbcp.BasicDataSource.createPoolableConnectionFactory(BasicDataSource.java:1549)[commons-dbcp-jar-1.4.jar:1.4] at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1388)[commons-dbcp-jar-1.4.jar:1.4] at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:1044)[commons-dbcp-jar-1.4.jar:1.4] at org.apache.openjpa.lib.jdbc.DelegatingDataSource.getConnection(DelegatingDataSource.java:110)[openjpa-bundle-2.2.0.jar:2.2.0] at org.apache.openjpa.lib.jdbc.DecoratingDataSource.getConnection(DecoratingDataSource.java:87)[openjpa-bundle-2.2.0.jar:2.2.0] at org.apache.openjpa.jdbc.sql.DBDictionaryFactory.newDBDictionary(DBDictionaryFactory.java:91)[openjpa-bundle-2.2.0.jar:2.2.0] ... 35 more Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Could not create connection to database server. Attempted reconnect 3 times. Giving up. at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)[na:1.7.0_25] at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)[na:1.7.0_25] at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)[na:1.7.0_25] at java.lang.reflect.Constructor.newInstance(Unknown Source)[na:1.7.0_25] at com.mysql.jdbc.Util.handleNewInstance(Util.java:411)[mysql-connector-java-5.1.22-bin.jar:na] at com.mysql.jdbc.Util.getInstance(Util.java:386)[mysql-connector-java-5.1.22-bin.jar:na] at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1014)[mysql-connector-java-5.1.22-bin.jar:na] at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:988)[mysql-connector-java-5.1.22-bin.jar:na] at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:974)[mysql-connector-java-5.1.22-bin.jar:na] at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:919)[mysql-connector-java-5.1.22-bin.jar:na] at com.mysql.jdbc.ConnectionImpl.connectWithRetries(ConnectionImpl.java:2314)[mysql-connector-java-5.1.22-bin.jar:na] at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2235)[mysql-connector-java-5.1.22-bin.jar:na] at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:813)[mysql-connector-java-5.1.22-bin.jar:na] at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:47)[mysql-connector-java-5.1.22-bin.jar:na] at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)[na:1.7.0_25] at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)[na:1.7.0_25] at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)[na:1.7.0_25] at java.lang.reflect.Constructor.newInstance(Unknown Source)[na:1.7.0_25] at com.mysql.jdbc.Util.handleNewInstance(Util.java:411)[mysql-connector-java-5.1.22-bin.jar:na] at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:399)[mysql-connector-java-5.1.22-bin.jar:na] at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:334)[mysql-connector-java-5.1.22-bin.jar:na] at org.apache.commons.dbcp.DriverConnectionFactory.createConnection(DriverConnectionFactory.java:38)[commons-dbcp-jar-1.4.jar:1.4] at org.apache.commons.dbcp.PoolableConnectionFactory.makeObject(PoolableConnectionFactory.java:582)[commons-dbcp-jar-1.4.jar:1.4] at org.apache.commons.dbcp.BasicDataSource.validateConnectionFactory(BasicDataSource.java:1556)[commons-dbcp-jar-1.4.jar:1.4] at org.apache.commons.dbcp.BasicDataSource.createPoolableConnectionFactory(BasicDataSource.java:1545)[commons-dbcp-jar-1.4.jar:1.4] ... 40 more Caused by: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server. at sun.reflect.GeneratedConstructorAccessor20.newInstance(Unknown Source)[na:na] at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)[na:1.7.0_25] at java.lang.reflect.Constructor.newInstance(Unknown Source)[na:1.7.0_25] at com.mysql.jdbc.Util.handleNewInstance(Util.java:411)[mysql-connector-java-5.1.22-bin.jar:na] at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:1117)[mysql-connector-java-5.1.22-bin.jar:na] at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:350)[mysql-connector-java-5.1.22-bin.jar:na] at com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2408)[mysql-connector-java-5.1.22-bin.jar:na] at com.mysql.jdbc.ConnectionImpl.connectWithRetries(ConnectionImpl.java:2253)[mysql-connector-java-5.1.22-bin.jar:na] ... 54 more Caused by: java.net.ConnectException: Connection refused at java.net.PlainSocketImpl.socketConnect(Native Method)[na:1.7.0_25] at java.net.AbstractPlainSocketImpl.doConnect(Unknown Source)[na:1.7.0_25] at java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source)[na:1.7.0_25] at java.net.AbstractPlainSocketImpl.connect(Unknown Source)[na:1.7.0_25] at java.net.SocksSocketImpl.connect(Unknown Source)[na:1.7.0_25] at java.net.Socket.connect(Unknown Source)[na:1.7.0_25] at java.net.Socket.connect(Unknown Source)[na:1.7.0_25] at java.net.Socket.<init>(Unknown Source)[na:1.7.0_25] at java.net.Socket.<init>(Unknown Source)[na:1.7.0_25] at com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.java:259)[mysql-connector-java-5.1.22-bin.jar:na] at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:300)[mysql-connector-java-5.1.22-bin.jar:na] ... 56 more

    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

    linxiaolonglinxiaolong
    582 times, last one
    HandemelindoHandemelindo
    Once,
    poroszdporoszd
    5 times, last one
    stigkjstigkj
    4 times, last one
    michallosmichallos
    Once,
    824 more bugmates