PostgreSQL “Protocol error. Session setup failed..

2019-08-12 03:06发布

问题:

When running a BIRT report that queries a Postgresql database, I get the following error? How can I fix this?

Mar 18, 2013 4:19:37 PM org.eclipse.birt.data.engine.odaconsumer.ConnectionManager openConnection
SEVERE: Unable to open connection.
org.eclipse.birt.report.data.oda.jdbc.JDBCException: There is an error in get connection, Protocol error.  Session setup failed..
    at org.eclipse.birt.report.data.oda.jdbc.JDBCDriverManager.doConnect(JDBCDriverManager.java:303)
    at org.eclipse.birt.report.data.oda.jdbc.JDBCDriverManager.getConnection(JDBCDriverManager.java:231)
    at org.eclipse.birt.report.data.oda.jdbc.Connection.connectByUrl(Connection.java:252)
    at org.eclipse.birt.report.data.oda.jdbc.Connection.open(Connection.java:162)
    at org.eclipse.datatools.connectivity.oda.consumer.helper.OdaConnection.open(OdaConnection.java:250)
    at org.eclipse.birt.data.engine.odaconsumer.ConnectionManager.openConnection(ConnectionManager.java:165)
    at org.eclipse.birt.data.engine.executor.DataSource.newConnection(DataSource.java:224)
    at org.eclipse.birt.data.engine.executor.DataSource.open(DataSource.java:212)
    at org.eclipse.birt.data.engine.impl.DataSourceRuntime.openOdiDataSource(DataSourceRuntime.java:217)
    at org.eclipse.birt.data.engine.impl.QueryExecutor.openDataSource(QueryExecutor.java:407)
    at org.eclipse.birt.data.engine.impl.QueryExecutor.prepareExecution(QueryExecutor.java:317)
    at org.eclipse.birt.data.engine.impl.PreparedQuery.doPrepare(PreparedQuery.java:455)
    at org.eclipse.birt.data.engine.impl.PreparedDataSourceQuery.produceQueryResults(PreparedDataSourceQuery.java:190)
    at org.eclipse.birt.data.engine.impl.PreparedDataSourceQuery.execute(PreparedDataSourceQuery.java:178)
    at org.eclipse.birt.data.engine.impl.PreparedOdaDSQuery.execute(PreparedOdaDSQuery.java:145)
    at org.eclipse.birt.report.data.adapter.impl.DataRequestSessionImpl.execute(DataRequestSessionImpl.java:624)
    at org.eclipse.birt.report.engine.api.impl.GetParameterDefinitionTask.executeQuery(GetParameterDefinitionTask.java:653)
    at org.eclipse.birt.report.engine.api.impl.GetParameterDefinitionTask.getResultSetOfCascadingGroup(GetParameterDefinitionTask.java:1074)
    at org.eclipse.birt.report.engine.api.impl.GetParameterDefinitionTask.getChoicesFromParameterGroup(GetParameterDefinitionTask.java:987)
    at org.eclipse.birt.report.engine.api.impl.GetParameterDefinitionTask.getCascadingParameterList(GetParameterDefinitionTask.java:590)
    at org.eclipse.birt.report.engine.api.impl.GetParameterDefinitionTask.doGetSelectionList(GetParameterDefinitionTask.java:487)
    at org.eclipse.birt.report.engine.api.impl.GetParameterDefinitionTask.getSelectionList(GetParameterDefinitionTask.java:447)
    at org.eclipse.birt.report.engine.api.impl.GetParameterDefinitionTask.getSelectionListForCascadingGroup(GetParameterDefinitionTask.java:737)
    at org.eclipse.birt.report.service.BirtViewerReportService.getSelectionListForCascadingGroup(BirtViewerReportService.java:777)
    at org.eclipse.birt.report.presentation.aggregation.parameter.ComboBoxParameterFragment.getParameterSelectionListForCascadingGroup(ComboBoxParameterFragment.java:119)
    at org.eclipse.birt.report.presentation.aggregation.parameter.ComboBoxParameterFragment.prepareParameterBean(ComboBoxParameterFragment.java:81)
    at org.eclipse.birt.report.presentation.aggregation.parameter.ScalarParameterFragment.doService(ScalarParameterFragment.java:91)
    at org.eclipse.birt.report.presentation.aggregation.AbstractBaseFragment.service(AbstractBaseFragment.java:76)
    at org.apache.jsp.webcontent.birt.pages.parameter.ParameterGroupFragment_jsp._jspService(ParameterGroupFragment_jsp.java:138)
    at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
    at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:369)
    at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:326)
    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:253)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)
    at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:840)
    at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:720)
    at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:657)
    at org.eclipse.birt.report.presentation.aggregation.AbstractBaseFragment.service(AbstractBaseFragment.java:82)
    at org.apache.jsp.webcontent.birt.pages.dialog.ParameterDialogFragment_jsp._jspService(ParameterDialogFragment_jsp.java:108)
    at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
    at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:369)
    at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:326)
    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:253)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)
    at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:840)
    at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:720)
    at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:657)
    at org.eclipse.birt.report.presentation.aggregation.AbstractBaseFragment.service(AbstractBaseFragment.java:82)
    at org.eclipse.birt.report.presentation.aggregation.AbstractBaseFragment.callBack(AbstractBaseFragment.java:106)
    at org.apache.jsp.webcontent.birt.pages.dialog.DialogContainerFragment_jsp._jspService(DialogContainerFragment_jsp.java:132)
    at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
    at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:369)
    at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:326)
    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:253)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)
    at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:840)
    at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:720)
    at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:657)
    at org.eclipse.birt.report.presentation.aggregation.AbstractBaseFragment.service(AbstractBaseFragment.java:82)
    at org.eclipse.birt.report.presentation.aggregation.AbstractBaseFragment.callBack(AbstractBaseFragment.java:106)
    at org.apache.jsp.webcontent.birt.pages.layout.ReportDialogFragment_jsp._jspService(ReportDialogFragment_jsp.java:72)
    at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
    at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:369)
    at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:326)
    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:253)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)
    at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:840)
    at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:720)
    at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:657)
    at org.eclipse.birt.report.presentation.aggregation.AbstractBaseFragment.service(AbstractBaseFragment.java:82)
    at org.eclipse.birt.report.presentation.aggregation.AbstractBaseFragment.callBack(AbstractBaseFragment.java:106)
    at org.apache.jsp.webcontent.birt.pages.layout.RunFragment_jsp._jspService(RunFragment_jsp.java:214)
    at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
    at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:369)
    at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:326)
    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:253)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)
    at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:840)
    at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:720)
    at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:657)
    at org.eclipse.birt.report.presentation.aggregation.layout.FramesetFragment.service(FramesetFragment.java:98)
    at org.eclipse.birt.report.servlet.ViewerServlet.__doGet(ViewerServlet.java:181)
    at org.eclipse.birt.report.servlet.BirtSoapMessageDispatcherServlet.doGet(BirtSoapMessageDispatcherServlet.java:160)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:734)
    at org.apache.axis.transport.http.AxisServletBase.service(AxisServletBase.java:327)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
    at org.eclipse.birt.report.servlet.BirtSoapMessageDispatcherServlet.service(BirtSoapMessageDispatcherServlet.java:122)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)
    at org.eclipse.birt.report.filter.ViewerFilter.doFilter(ViewerFilter.java:68)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161)
    at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:153)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:155)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:368)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:671)
    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:930)
    at java.lang.Thread.run(Thread.java:722)

回答1:

In my case this was due to the fact that the server was running (or emulating to be more precise) PostgreSQL 8.1, and I was using the JDBC 9.2 driver. Once I matched the PostgreSQL server and JDBC driver versions, everything started working fine.