WSO2数据服务服务器错误调用存储过程

时间:2016-04-21 15:40:56

标签: jdbc wso2 wso2dss mssql-jdbc

我能够从WSO2数据服务服务器(DSS)成功调用Microsoft SQL Server存储过程并返回结果。但是,从某些存储过程返回结果集会导致com.microsoft.sqlserver.jdbc.SQLServerException:不支持此操作。经过一些实验,我发现至少有一个标准导致了这个错误。那是我在存储过程中创建临时表的时候。我的猜测是,这导致了一种DSS代码不期望或无法正确处理的结果。

我使用的Microsoft SQL Server驱动程序jar文件来自sqljdbc4.jar,它是2015年8月发布的Microsoft JDBC Driver 4.2 for SQL Server的一部分。 SQL Server版本是SQL Server 2012(11.0.5582.0)。

我为重现这种情况而创建的示例存储过程如下:

CREATE Proc [dbo].[example_proc]
(
    @id       varchar(255)
)
AS

BEGIN
Create table #temp
(
         command_name       varchar(50), 
         transactions     int,
         timeouts           int, 
         errors             int
)

insert into #temp values ('abc', 5, 10, 25)

select command_name, transactions, timeouts, errors from #temp

drop table #temp 

/*
    select 'test' "command_name", 5 "transactions", 10 "timeouts", 25 "errors"
    */
END

数据服务的示例配置如下:

<data disableStreaming="true" name="MESCDataService" transports="http https">
   <config enableOData="false" id="MESCDataSource">
       <property name="carbon_datasource_name">MESCDataSource</property>
   </config>
   <query id="test" useConfig="MESCDataSource">
      <sql>{ call dbo.example_proc (?) }</sql>
      <result element="Results" rowName="Result">
         <element column="test_column" name="TestColumn" xsdType="string"/>
      </result>
      <param name="val" sqlType="STRING"/>
   </query>
   <operation disableStreaming="true" name="test">
      <call-query href="test">
         <with-param name="val" query-param="val"/>
      </call-query>
   </operation>
</data>

碳数据源的配置是:

驱动程序:com.microsoft.sqlserver.jdbc.SQLServerDriver URL格式:jdbc:sqlserver:// [hostname]:[port]; databaseName = [dbname];

以下是wso2carbon.log文件的摘录,其中包含错误的详细信息:

TID: [-1234] [] [2016-04-21 09:01:00,016] ERROR {org.wso2.carbon.dataservices.core.DBInOutMessageReceiver} -  Error in in-out message receiver {org.wso2.carbon.dataservices.core.DBInOutMessageReceiver}
DS Code: DATABASE_ERROR
Nested Exception:-
javax.xml.stream.XMLStreamException: DS Fault Message: Error in 'SQLQuery.processStoredProcQuery': This operation is not supported.
DS Code: DATABASE_ERROR
Source Data Service:-
Name: MESCDataService
Location: \MESCDataService.dbs
Description: N/A
Default Namespace: http://ws.wso2.org/dataservice
Current Request Name: test
Current Params: {Id=3}
Nested Exception:-
com.microsoft.sqlserver.jdbc.SQLServerException: This operation is not supported.


    at org.wso2.carbon.dataservices.core.dispatch.SingleDataServiceRequest.processRequest(SingleDataServiceRequest.java:75)
    at org.wso2.carbon.dataservices.core.dispatch.DataServiceRequest.dispatch(DataServiceRequest.java:344)
    at org.wso2.carbon.dataservices.core.DataServiceProcessor.dispatch(DataServiceProcessor.java:41)
    at org.wso2.carbon.dataservices.core.DBInOutMessageReceiver.invokeBusinessLogic(DBInOutMessageReceiver.java:52)
    at org.apache.axis2.receivers.AbstractInOutSyncMessageReceiver.invokeBusinessLogic(AbstractInOutSyncMessageReceiver.java:42)
    at org.apache.axis2.receivers.AbstractMessageReceiver.receive(AbstractMessageReceiver.java:110)
    at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:180)
    at org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(HTTPTransportUtils.java:173)
    at org.apache.axis2.transport.http.AxisServlet.doPost(AxisServlet.java:146)
    at org.wso2.carbon.core.transports.CarbonServlet.doPost(CarbonServlet.java:231)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:646)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
    at org.eclipse.equinox.http.servlet.internal.ServletRegistration.service(ServletRegistration.java:61)
    at org.eclipse.equinox.http.servlet.internal.ProxyServlet.processAlias(ProxyServlet.java:128)
    at org.eclipse.equinox.http.servlet.internal.ProxyServlet.service(ProxyServlet.java:68)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
    at org.wso2.carbon.tomcat.ext.servlet.DelegationServlet.service(DelegationServlet.java:68)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
    at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
    at org.wso2.carbon.ui.filters.CSRFPreventionFilter.doFilter(CSRFPreventionFilter.java:88)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
    at org.wso2.carbon.ui.filters.CRLFPreventionFilter.doFilter(CRLFPreventionFilter.java:59)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
    at org.wso2.carbon.tomcat.ext.filter.CharacterSetFilter.doFilter(CharacterSetFilter.java:61)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:504)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
    at org.wso2.carbon.tomcat.ext.valves.CompositeValve.continueInvocation(CompositeValve.java:99)
    at org.wso2.carbon.tomcat.ext.valves.CarbonTomcatValve$1.invoke(CarbonTomcatValve.java:47)
    at org.wso2.carbon.webapp.mgt.TenantLazyLoaderValve.invoke(TenantLazyLoaderValve.java:57)
    at org.wso2.carbon.tomcat.ext.valves.TomcatValveContainer.invokeValves(TomcatValveContainer.java:47)
    at org.wso2.carbon.tomcat.ext.valves.CompositeValve.invoke(CompositeValve.java:62)
    at org.wso2.carbon.tomcat.ext.valves.CarbonStuckThreadDetectionValve.invoke(CarbonStuckThreadDetectionValve.java:159)
    at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)
    at org.wso2.carbon.tomcat.ext.valves.CarbonContextCreatorValve.invoke(CarbonContextCreatorValve.java:57)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:421)
    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1074)
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:611)
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1739)
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1698)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
    at java.lang.Thread.run(Unknown Source)
Caused by: javax.xml.stream.XMLStreamException: DS Fault Message: Error in 'SQLQuery.processStoredProcQuery': This operation is not supported.
DS Code: DATABASE_ERROR
Source Data Service:-
Name: MESCDataService
Location: \MESCDataService.dbs
Description: N/A
Default Namespace: http://ws.wso2.org/dataservice
Current Request Name: test
Current Params: {Id=3}
Nested Exception:-
com.microsoft.sqlserver.jdbc.SQLServerException: This operation is not supported.

    at org.wso2.carbon.dataservices.core.engine.DSOMDataSource.execute(DSOMDataSource.java:102)
    at org.wso2.carbon.dataservices.core.dispatch.SingleDataServiceRequest.processRequest(SingleDataServiceRequest.java:73)
    ... 53 more
Caused by: DS Fault Message: Error in 'SQLQuery.processStoredProcQuery': This operation is not supported.
DS Code: DATABASE_ERROR
Source Data Service:-
Name: MESCDataService
Location: \MESCDataService.dbs
Description: N/A
Default Namespace: http://ws.wso2.org/dataservice
Current Request Name: test
Current Params: {Id=3}
Nested Exception:-
com.microsoft.sqlserver.jdbc.SQLServerException: This operation is not supported.

    at org.wso2.carbon.dataservices.core.description.query.SQLQuery.processPreStoredProcQuery(SQLQuery.java:916)
    at org.wso2.carbon.dataservices.core.description.query.SQLQuery.runPreQuery(SQLQuery.java:2134)
    at org.wso2.carbon.dataservices.core.description.query.Query.execute(Query.java:285)
    at org.wso2.carbon.dataservices.core.engine.CallQuery.executeElement(CallQuery.java:286)
    at org.wso2.carbon.dataservices.core.engine.OutputElement.execute(OutputElement.java:89)
    at org.wso2.carbon.dataservices.core.description.operation.Operation.execute(Operation.java:61)
    at org.wso2.carbon.dataservices.core.engine.DataService.invoke(DataService.java:583)
    at org.wso2.carbon.dataservices.core.engine.DSOMDataSource.execute(DSOMDataSource.java:96)
    ... 54 more
Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: This operation is not supported.
    at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDriverError(SQLServerException.java:190)
    at com.microsoft.sqlserver.jdbc.SQLServerStatement.NotImplemented(SQLServerStatement.java:565)
    at com.microsoft.sqlserver.jdbc.SQLServerStatement.getMoreResults(SQLServerStatement.java:2061)
    at org.wso2.carbon.dataservices.core.description.query.SQLQuery.getFirstRSOfStoredProc(SQLQuery.java:1034)
    at org.wso2.carbon.dataservices.core.description.query.SQLQuery.processPreStoredProcQuery(SQLQuery.java:909)
    ... 61 more

0 个答案:

没有答案