简体   繁体   中英

Cannot create PoolableConnectionFactory error while starting application in Bluemix

Once I deploy my Java Application to IBM Bluemix, it can't create the initial database connection due to this error:

Building new Hibernate SessionFactory 2015-04-11 14:24:04 [main] ERROR ohutil.JDBCExceptionReporter - Cannot create PoolableConnectionFactory (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.)

I tried to set the "hibernate.current_session_context_class" to "thread" (which solved the problem when I deployed the same app to Google Application Engine) but that didn't help with Websphere Liberty Profile:

<prop key="hibernate.current_session_context_class" >
        thread
 </prop>

Any ideas?

UPDATE 1 --- This is the actual root cause. Bluemix offers the ClearDB MySQL service but its pipeline cannot connect to it :(

Building new Hibernate SessionFactory 2015-04-11 15:04:49 [main] ERROR ohutil.JDBCExceptionReporter - 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.

UPDATE 2 --- Even the Experimental MySQL DB is also off limits if there's any attempt to connect from the pipeline machines:

ohutil.JDBCExceptionReporter - Cannot create PoolableConnectionFactory (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.) org.hibernate.exception.GenericJDBCException: Cannot open connection at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:140) at org.hibe at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:115) at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:75) Caused by: org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (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 org.apache.commons.dbcp.BasicDataSource.createPoolableConnectionFactory(BasicDataSource.java:1549) at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1388) at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:1044) at org.springframework.orm.hibernate3.LocalDataSourceConnectionProvider.getConnection(LocalDataSourceConnectionProvider.java:81) at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:446) ... 40 more Caused by: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure

Please let me know if you have any ideas.

Ah ok. So this is happening because the Liberty buildpack autowires in JDBC connections for you during deployment to Bluemix. For the unit tests you will need to provide this connection info to your app.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM