来自 postgresql 数据库的 Wso2dss 连接关闭异常

Wso2dss connection closed exception from postgresql DB

您好,我正在使用 WSO2 DSS 3.0.0 和 postgresql。

我已经部署了多个数据服务并称为我的 Wso2esb 代理服务,一切正常,但过了一段时间后我的 dss 出现错误,如下所示

DS Fault Message: Error in 'SQLQuery.processNormalQuery'
DS Code: DATABASE_ERROR
Source Data Service:-
Name: tlocationtrack_DataService2.0
Location: /tlocationtrack_DataService2.0.dbs
Description: N/A
Default Namespace: http://ws.wso2.org/dataservice
Current Request Name: Insertinto_tlocationtrack_OP
Current Params: {geolocation=17.720311,78.473837, userid=2579878364153500, trackdate=1441129831385, accuracy=54.0, deviceid=353323065783531}
Nested Exception:-
DS Fault Message: Error in 'createProcessedPreparedStatement'
DS Code: UNKNOWN_ERROR
Nested Exception:-
org.postgresql.util.PSQLException: This connection has been closed.


        at org.wso2.carbon.dataservices.core.description.query.SQLQuery.processNormalQuery(SQLQuery.java:808)
        at org.wso2.carbon.dataservices.core.description.query.SQLQuery.runQuery(SQLQuery.java:2098)
        at org.wso2.carbon.dataservices.core.description.query.Query.execute(Query.java:252)
        at org.wso2.carbon.dataservices.core.engine.CallQuery.executeElement(CallQuery.java:179)
        at org.wso2.carbon.dataservices.core.engine.CallQueryGroup.executeElement(CallQueryGroup.java:111)
        at org.wso2.carbon.dataservices.core.engine.OutputElement.execute(OutputElement.java:89)
        at org.wso2.carbon.dataservices.core.description.operation.Operation.execute(Operation.java:71)
        at org.wso2.carbon.dataservices.core.engine.DataService.invoke(DataService.java:569)
        at org.wso2.carbon.dataservices.core.engine.DSOMDataSource.execute(DSOMDataSource.java:99)
        at org.wso2.carbon.dataservices.core.engine.DSOMDataSource.serialize(DSOMDataSource.java:110)
        at org.wso2.carbon.dataservices.core.engine.DSOMDataSource.getReader(DSOMDataSource.java:116)
        at org.apache.axiom.om.impl.llom.OMSourcedElementImpl.getDirectReader(OMSourcedElementImpl.java:225)
        at org.apache.axiom.om.impl.llom.OMSourcedElementImpl.getXMLStreamReader(OMSourcedElementImpl.java:498)
        at org.apache.axiom.om.impl.llom.OMSourcedElementImpl.getXMLStreamReaderWithoutCaching(OMSourcedElementImpl.java:507)
        at org.wso2.carbon.dataservices.core.DBUtils.cloneAndReturnBuiltElement(DBUtils.ja

va:756)
            at org.wso2.carbon.dataservices.core.dispatch.DataServiceRequest.dispatch(DataServiceRequest.java:288)
    :
    at java.lang.Thread.run(Thread.java:745)
Caused by: DS Fault Message: Error in 'createProcessedPreparedStatement'
DS Code: UNKNOWN_ERROR
Nested Exception:-
org.postgresql.util.PSQLException: This connection has been closed.

        at org.wso2.carbon.dataservices.core.description.query.SQLQuery.createProcessedPreparedStatement(SQLQuery.java:1379)
        at org.wso2.carbon.dataservices.core.description.query.SQLQuery.processNormalQuery(SQLQuery.java:766)
        ... 52 more
Caused by: org.postgresql.util.PSQLException: This connection has been closed.
        at org.postgresql.jdbc2.AbstractJdbc2Connection.checkClosed(AbstractJdbc2Connection.java:714)
        at org.postgresql.jdbc3.AbstractJdbc3Connection.prepareStatement(AbstractJdbc3Connection.java:361)
        at sun.reflect.GeneratedMethodAccessor54.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at org.apache.tomcat.jdbc.pool.ProxyConnection.invoke(ProxyConnection.java:126)
        at org.apache.tomcat.jdbc.pool.JdbcInterceptor.invoke(JdbcInterceptor.java:99)
        at org.wso2.carbon.ndatasource.rdbms.ConnectionRollbackOnReturnInterceptor.invoke(ConnectionRollbackOnReturnInterceptor.java:51)
        at org.apache.tomcat.jdbc.pool.JdbcInterceptor.invoke(JdbcInterceptor.java:99)
        at org.apache.tomcat.jdbc.pool.interceptor.AbstractCreateStatementInterceptor.invoke(AbstractCreateStatementInterceptor.java:67)
        at org.apache.tomcat.jdbc.pool.JdbcInterceptor.invoke(JdbcInterceptor.java:99)
        at org.apache.tomcat.jdbc.pool.interceptor.ConnectionState.invoke(ConnectionState.java:153)
        at org.apache.tomcat.jdbc.pool.JdbcInterceptor.invoke(JdbcInterceptor.java:99)
        at org.apache.tomcat.jdbc.pool.TrapException.invoke(TrapException.java:41)
        at org.apache.tomcat.jdbc.pool.JdbcInterceptor.invoke(JdbcInterceptor.java:99)
        at org.apache.tomcat.jdbc.pool.DisposableConnectionFacade.invoke(DisposableConnectionFacade.java:63)
        at com.sun.proxy.$Proxy12.prepareStatement(Unknown Source)
        at org.wso2.carbon.dataservices.core.description.query.SQLQuery.createProcessedPreparedStatement(SQLQuery.java:1305)

此后所有数据服务都抛出相同的错误,此错误的根本原因是什么,是否需要进行任何更改以避免此错误。

谢谢...!!

您的数据服务数据库连接是如何配置的?你在使用 Carbon 数据源吗(你应该!)?如果是这样,您是否定义了测试查询并启用了 "test on borrow" 配置选项?

您遇到的异常有时是由配置为关闭空闲连接的数据库服务器引起的。当你没有正确配置你的连接池时,它不会检测到连接已关闭,它会将它处理给客户端代码(你的数据服务),从而导致这个错误。