2012-10-05 105 views
1

它從this問題要求張貼不同的問題。無法連接到MySQL在CloudBees的CommunicationsException:通信鏈路故障

我按照上面的問題推薦,並正確更正了cloudbees.xml文件。但即使如此,我無法連接。這裏的堆棧跟蹤:

HTTP Status 500 - 

type Exception report 

message 

description The server encountered an internal error() that prevented it from fulfilling this request. 

exception 

javax.servlet.ServletException: javax.persistence.PersistenceException: Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.4.0.v20120608-r11652): org.eclipse.persistence.exceptions.DatabaseException 
Internal Exception: 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. 
Error Code: 0 
    com.vaadin.terminal.gwt.server.AbstractApplicationServlet.handleServiceException(AbstractApplicationServlet.java:1010) 
    com.vaadin.terminal.gwt.server.AbstractApplicationServlet.service(AbstractApplicationServlet.java:548) 
    javax.servlet.http.HttpServlet.service(HttpServlet.java:717) 
    com.bluecubs.xinco.core.server.filter.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:98) 
root cause 

javax.persistence.PersistenceException: Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.4.0.v20120608-r11652): org.eclipse.persistence.exceptions.DatabaseException 
Internal Exception: 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. 
Error Code: 0 
    org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.deploy(EntityManagerSetupImpl.java:602) 
    org.eclipse.persistence.internal.jpa.EntityManagerFactoryDelegate.getDatabaseSession(EntityManagerFactoryDelegate.java:186) 
    org.eclipse.persistence.internal.jpa.EntityManagerFactoryDelegate.createEntityManagerImpl(EntityManagerFactoryDelegate.java:278) 
    org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.createEntityManagerImpl(EntityManagerFactoryImpl.java:304) 
    org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:282) 
    com.bluecubs.xinco.core.server.XincoDBManager.getProtectedEntityManager(XincoDBManager.java:574) 
    com.bluecubs.xinco.core.server.XincoDBManager.getEntityManager(XincoDBManager.java:565) 
    com.bluecubs.xinco.core.server.XincoDBManager.updateDBState(XincoDBManager.java:280) 
    com.bluecubs.xinco.core.server.XincoDBManager.reload(XincoDBManager.java:125) 
    com.bluecubs.xinco.core.server.XincoDBManager.reload(XincoDBManager.java:102) 
    com.bluecubs.xinco.core.server.vaadin.Xinco.init(Xinco.java:197) 
    com.vaadin.Application.start(Application.java:551) 
    com.vaadin.terminal.gwt.server.AbstractApplicationServlet.startApplication(AbstractApplicationServlet.java:1219) 
    com.vaadin.terminal.gwt.server.AbstractApplicationServlet.service(AbstractApplicationServlet.java:484) 
    javax.servlet.http.HttpServlet.service(HttpServlet.java:717) 
    com.bluecubs.xinco.core.server.filter.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:98) 
root cause 

Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.4.0.v20120608-r11652): org.eclipse.persistence.exceptions.DatabaseException 
Internal Exception: 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. 
Error Code: 0 
    org.eclipse.persistence.exceptions.DatabaseException.sqlException(DatabaseException.java:324) 
    org.eclipse.persistence.exceptions.DatabaseException.sqlException(DatabaseException.java:319) 
    org.eclipse.persistence.sessions.DefaultConnector.connect(DefaultConnector.java:138) 
    org.eclipse.persistence.sessions.DatasourceLogin.connectToDatasource(DatasourceLogin.java:162) 
    org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.loginAndDetectDatasource(DatabaseSessionImpl.java:685) 
    org.eclipse.persistence.internal.jpa.EntityManagerFactoryProvider.login(EntityManagerFactoryProvider.java:213) 
    org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.deploy(EntityManagerSetupImpl.java:542) 
    org.eclipse.persistence.internal.jpa.EntityManagerFactoryDelegate.getDatabaseSession(EntityManagerFactoryDelegate.java:186) 
    org.eclipse.persistence.internal.jpa.EntityManagerFactoryDelegate.createEntityManagerImpl(EntityManagerFactoryDelegate.java:278) 
    org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.createEntityManagerImpl(EntityManagerFactoryImpl.java:304) 
    org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:282) 
    com.bluecubs.xinco.core.server.XincoDBManager.getProtectedEntityManager(XincoDBManager.java:574) 
    com.bluecubs.xinco.core.server.XincoDBManager.getEntityManager(XincoDBManager.java:565) 
    com.bluecubs.xinco.core.server.XincoDBManager.updateDBState(XincoDBManager.java:280) 
    com.bluecubs.xinco.core.server.XincoDBManager.reload(XincoDBManager.java:125) 
    com.bluecubs.xinco.core.server.XincoDBManager.reload(XincoDBManager.java:102) 
    com.bluecubs.xinco.core.server.vaadin.Xinco.init(Xinco.java:197) 
    com.vaadin.Application.start(Application.java:551) 
    com.vaadin.terminal.gwt.server.AbstractApplicationServlet.startApplication(AbstractApplicationServlet.java:1219) 
    com.vaadin.terminal.gwt.server.AbstractApplicationServlet.service(AbstractApplicationServlet.java:484) 
    javax.servlet.http.HttpServlet.service(HttpServlet.java:717) 
    com.bluecubs.xinco.core.server.filter.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:98) 
root cause 

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. 
    sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) 
    sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) 
    sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) 
    java.lang.reflect.Constructor.newInstance(Constructor.java:513) 
    com.mysql.jdbc.Util.handleNewInstance(Util.java:411) 
    com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:1117) 
    com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:350) 
    com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2393) 
    com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2430) 
    com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2215) 
    com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:813) 
    com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:47) 
    sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) 
    sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) 
    sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) 
    java.lang.reflect.Constructor.newInstance(Constructor.java:513) 
    com.mysql.jdbc.Util.handleNewInstance(Util.java:411) 
    com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:399) 
    com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:334) 
    java.sql.DriverManager.getConnection(DriverManager.java:582) 
    java.sql.DriverManager.getConnection(DriverManager.java:154) 
    org.eclipse.persistence.sessions.DefaultConnector.connect(DefaultConnector.java:98) 
    org.eclipse.persistence.sessions.DatasourceLogin.connectToDatasource(DatasourceLogin.java:162) 
    org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.loginAndDetectDatasource(DatabaseSessionImpl.java:685) 
    org.eclipse.persistence.internal.jpa.EntityManagerFactoryProvider.login(EntityManagerFactoryProvider.java:213) 
    org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.deploy(EntityManagerSetupImpl.java:542) 
    org.eclipse.persistence.internal.jpa.EntityManagerFactoryDelegate.getDatabaseSession(EntityManagerFactoryDelegate.java:186) 
    org.eclipse.persistence.internal.jpa.EntityManagerFactoryDelegate.createEntityManagerImpl(EntityManagerFactoryDelegate.java:278) 
    org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.createEntityManagerImpl(EntityManagerFactoryImpl.java:304) 
    org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:282) 
    com.bluecubs.xinco.core.server.XincoDBManager.getProtectedEntityManager(XincoDBManager.java:574) 
    com.bluecubs.xinco.core.server.XincoDBManager.getEntityManager(XincoDBManager.java:565) 
    com.bluecubs.xinco.core.server.XincoDBManager.updateDBState(XincoDBManager.java:280) 
    com.bluecubs.xinco.core.server.XincoDBManager.reload(XincoDBManager.java:125) 
    com.bluecubs.xinco.core.server.XincoDBManager.reload(XincoDBManager.java:102) 
    com.bluecubs.xinco.core.server.vaadin.Xinco.init(Xinco.java:197) 
    com.vaadin.Application.start(Application.java:551) 
    com.vaadin.terminal.gwt.server.AbstractApplicationServlet.startApplication(AbstractApplicationServlet.java:1219) 
    com.vaadin.terminal.gwt.server.AbstractApplicationServlet.service(AbstractApplicationServlet.java:484) 
    javax.servlet.http.HttpServlet.service(HttpServlet.java:717) 
    com.bluecubs.xinco.core.server.filter.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:98) 
root cause 

java.net.ConnectException: Connection refused 
    java.net.PlainSocketImpl.socketConnect(Native Method) 
    java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:351) 
    java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:213) 
    java.net.PlainSocketImpl.connect(PlainSocketImpl.java:200) 
    java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366) 
    java.net.Socket.connect(Socket.java:529) 
    java.net.Socket.connect(Socket.java:478) 
    java.net.Socket.<init>(Socket.java:375) 
    java.net.Socket.<init>(Socket.java:218) 
    com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.java:257) 
    com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:300) 
    com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2393) 
    com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2430) 
    com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2215) 
    com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:813) 
    com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:47) 
    sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) 
    sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) 
    sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) 
    java.lang.reflect.Constructor.newInstance(Constructor.java:513) 
    com.mysql.jdbc.Util.handleNewInstance(Util.java:411) 
    com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:399) 
    com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:334) 
    java.sql.DriverManager.getConnection(DriverManager.java:582) 
    java.sql.DriverManager.getConnection(DriverManager.java:154) 
    org.eclipse.persistence.sessions.DefaultConnector.connect(DefaultConnector.java:98) 
    org.eclipse.persistence.sessions.DatasourceLogin.connectToDatasource(DatasourceLogin.java:162) 
    org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.loginAndDetectDatasource(DatabaseSessionImpl.java:685) 
    org.eclipse.persistence.internal.jpa.EntityManagerFactoryProvider.login(EntityManagerFactoryProvider.java:213) 
    org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.deploy(EntityManagerSetupImpl.java:542) 
    org.eclipse.persistence.internal.jpa.EntityManagerFactoryDelegate.getDatabaseSession(EntityManagerFactoryDelegate.java:186) 
    org.eclipse.persistence.internal.jpa.EntityManagerFactoryDelegate.createEntityManagerImpl(EntityManagerFactoryDelegate.java:278) 
    org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.createEntityManagerImpl(EntityManagerFactoryImpl.java:304) 
    org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:282) 
    com.bluecubs.xinco.core.server.XincoDBManager.getProtectedEntityManager(XincoDBManager.java:574) 
    com.bluecubs.xinco.core.server.XincoDBManager.getEntityManager(XincoDBManager.java:565) 
    com.bluecubs.xinco.core.server.XincoDBManager.updateDBState(XincoDBManager.java:280) 
    com.bluecubs.xinco.core.server.XincoDBManager.reload(XincoDBManager.java:125) 
    com.bluecubs.xinco.core.server.XincoDBManager.reload(XincoDBManager.java:102) 
    com.bluecubs.xinco.core.server.vaadin.Xinco.init(Xinco.java:197) 
    com.vaadin.Application.start(Application.java:551) 
    com.vaadin.terminal.gwt.server.AbstractApplicationServlet.startApplication(AbstractApplicationServlet.java:1219) 
    com.vaadin.terminal.gwt.server.AbstractApplicationServlet.service(AbstractApplicationServlet.java:484) 
    javax.servlet.http.HttpServlet.service(HttpServlet.java:717) 
    com.bluecubs.xinco.core.server.filter.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:98) 
note The full stack trace of the root cause is available in the Apache Tomcat/6.0.35 logs. 

Apache Tomcat/6.0.35 
+0

數據庫連接的設置代碼是什麼樣的?它看起來像你的數據庫連接連接到錯誤的東西(它做得這麼快,我假設本地主機)。來自com.bluecubs.xinco.core.server.vaadin.Xinco.init的一些代碼片段可能會有幫助。 –

+0

你可以在這裏找到來源:https://xinco.svn.sourceforge.net/svnroot/xinco/trunk/Xinco – javydreamercsw

回答

3

這是一個常見的MySQL連接超時,需要配置連接池,以檢查返回的連接是活的,請閱讀相關文檔「avoiding database idle timeouts」:

在您使用驗證查詢連接池設置:

<param name="validationQuery" value="SELECT 1" /> 

你也應該考慮使用database binding,作爲CloudBees的-web.xml中被棄用:

bees app:bind -a APP_ID -db DB_ID validationQuery="SELECT 1" 
+0

是否有從應用程序解除綁定數據庫的方法嗎?我忘了添加它的驗證查詢部分。 – javydreamercsw

+0

無法使其工作。沒有運氣就在連接池設置上添加了驗證查詢。 – javydreamercsw

相關問題