我在我的项目中使用Spring Integration框架。数据库是在AS400上运行的db2。我必须一个接一个地调用两个存储过程。我的第一个存储过程执行没有任何问题,并将消息传递给第二个stored-proc-outbound-gateway。在这里,奇怪的事情正在发生。看来第二个存储过程成功执行,但奇怪的是第二个存储过程出站网关没有产生任何回复消息。
以下是连接到SQL Server后的日志语句:
[org.springframework.jdbc.core.JdbcTemplate.doInCallableStatement] CallableStatement.execute() returned 'true'
[org.springframework.jdbc.core.JdbcTemplate.doInCallableStatement] CallableStatement.getUpdateCount() returned -1
[org.springframework.jdbc.core.JdbcTemplate.extractReturnedResults] CallableStatement.getUpdateCount() returned 1
[org.springframework.jdbc.core.JdbcTemplate.extractReturnedResults] CallableStatement.getUpdateCount() returned -1
当我连接到db2时,相同的语句是不同的:
DEBUG [org.springframework.jdbc.core.JdbcTemplate.doInCallableStatement] CallableStatement.execute() returned 'false'
DEBUG [org.springframework.jdbc.core.JdbcTemplate.doInCallableStatement] CallableStatement.getUpdateCount() returned 0
DEBUG [org.springframework.jdbc.core.JdbcTemplate.extractReturnedResults] CallableStatement.getUpdateCount() returned -1
任何人都可以说这里有什么问题吗? 如果您需要任何其他信息,请随时问我。
以下是完整的spring-integration文件供您参考:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:int-xml="http://www.springframework.org/schema/integration/xml"
xmlns:int="http://www.springframework.org/schema/integration"
xmlns:int-jdbc="http://www.springframework.org/schema/integration/jdbc"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:util="http://www.springframework.org/schema/util"
xmlns:int-http="http://www.springframework.org/schema/integration/http"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/integration
http://www.springframework.org/schema/integration/spring-integration.xsd
http://www.springframework.org/schema/integration/xml
http://www.springframework.org/schema/integration/xml/spring-integration-xml.xsd
http://www.springframework.org/schema/util
http://www.springframework.org/schema/util/spring-util.xsd
http://www.springframework.org/schema/integration/jdbc
http://www.springframework.org/schema/integration/jdbc/spring-integration-jdbc.xsd
http://www.springframework.org/schema/integration/http
http://www.springframework.org/schema/integration/http/spring-integration-http.xsd ">
<int:channel id="PQPutUserBAInformation-InputChannel" />
<int:chain input-channel="PQPutUserBAInformation-InputChannel" output-channel="PQPutUserBAInformation-SetDateTag" >
<!-- Transformer to transform the resultXml to the user understandable form using XSLT -->
<int-xml:xslt-transformer xsl-resource="${stylesheet.PQPutUserBAInformationSetDateTag}" />
</int:chain>
<int:chain input-channel="PQPutUserBAInformation-SetDateTag" output-channel="PQPutUserBAInformation-SPCall" >
<!-- Split the Search Request Params from Xml -->
<int-xml:xpath-splitter>
<int-xml:xpath-expression expression="//AWDPQContactID" namespace-map="xmlMessageNamespace" />
</int-xml:xpath-splitter>
<!-- Store the original payload in header for future purpose -->
<int:header-enricher default-overwrite="true" should-skip-nulls="true" >
<int:header name="${headerNames.originalPayload}" expression="payload" />
</int:header-enricher>
</int:chain>
<!-- PQPutUserBAInformation Channel -->
<int:channel id="PQPutUserBAInformation-SPCall" />
<int:chain input-channel="PQPutUserBAInformation-SPCall" output-channel="PQPutUserBAInformation-SPCallStage1-Response" >
<int:service-activator ref="msgHandler" method="buildRequestBasedDataSource" />
<int-jdbc:stored-proc-outbound-gateway
id="PQPutUserBAInformation-AWD-StoredProcedure"
auto-startup="true"
data-source="routingDataSource"
stored-procedure-name="ZSPPQDELETEUSERIDBA"
skip-undeclared-results="true"
ignore-column-meta-data="true"
use-payload-as-parameter-source = "false"
expect-single-result="true" >
<int-jdbc:sql-parameter-definition name="P_USERID" direction="IN" type="VARCHAR" />
<int-jdbc:sql-parameter-definition name="P_BUSINESSAREA" direction="IN" type="VARCHAR" />
<int-jdbc:parameter name="P_USERID" expression="#xpath(payload, '//CurrentUserID')" />
<int-jdbc:parameter name="P_BUSINESSAREA" expression="#xpath(payload, '//SelectedBusinessArea/Code')" />
<int-jdbc:returning-resultset name="rowMapper" row-mapper="com.dsths.cs.awd.utils.ResultSetRowMapper"/>
</int-jdbc:stored-proc-outbound-gateway>
</int:chain>
<!-- Service Activator to build the Message from the Stored Procedure ResultSet -->
<int:channel id="PQPutUserBAInformation-SPCallStage1-Response" />
<int:service-activator input-channel="PQPutUserBAInformation-SPCallStage1-Response"
output-channel="PQPutUserBAInformation-SPCall2-Translate"
ref="msgHandler"
method="buildMessageFromExtSysResponse" />
<!-- Service Activator to build the Message from the Stored Procedure ResultSet -->
<int:channel id="PQPutUserBAInformation-SPCall2-Translate" />
<int:service-activator input-channel="PQPutUserBAInformation-SPCall2-Translate"
output-channel="PQPutUserBAInformation-SPCall2"
ref="cacheRequestHandler"
method="translatePassword" />
<!-- PQPutUserBAInformation Channel -->
<int:channel id="PQPutUserBAInformation-SPCall2" />
<int:chain input-channel="PQPutUserBAInformation-SPCall2" output-channel="PQPutUserBAInformation-SPCallStage2-Response" >
<int:service-activator ref="msgHandler" method="buildRequestBasedDataSource" />
<int-jdbc:stored-proc-outbound-gateway
id="PQPutUserBAInformation-AWD-StoredProcedure2"
auto-startup="true"
data-source="routingDataSource"
stored-procedure-name="ZSPPQINSERTUSERIDBA"
skip-undeclared-results="true"
ignore-column-meta-data="true"
use-payload-as-parameter-source = "false"
expect-single-result="true" >
<int-jdbc:sql-parameter-definition name="P_USERID" direction="IN" type="VARCHAR" />
<int-jdbc:sql-parameter-definition name="P_BUSINESSAREA" direction="IN" type="VARCHAR" />
<int-jdbc:sql-parameter-definition name="P_SELECTEDIND" direction="IN" type="VARCHAR" />
<int-jdbc:sql-parameter-definition name="P_DEFAULTIND" direction="IN" type="VARCHAR" />
<int-jdbc:sql-parameter-definition name="P_LEGACYSYSTEM" direction="IN" type="VARCHAR" />
<int-jdbc:sql-parameter-definition name="P_LEGACYLOGIN" direction="IN" type="VARCHAR" />
<int-jdbc:sql-parameter-definition name="P_LEGACYPASSWORD" direction="IN" type="VARCHAR" />
<int-jdbc:sql-parameter-definition name="P_OTHERLOGIN" direction="IN" type="VARCHAR" />
<int-jdbc:sql-parameter-definition name="P_OTHERPASSWORD" direction="IN" type="VARCHAR" />
<int-jdbc:sql-parameter-definition name="P_ADDSECURLOGIN" direction="IN" type="VARCHAR" />
<int-jdbc:sql-parameter-definition name="P_ADDSECURPASSWORD" direction="IN" type="VARCHAR" />
<int-jdbc:sql-parameter-definition name="P_LASTUPDATEUSERID" direction="IN" type="VARCHAR" />
<int-jdbc:sql-parameter-definition name="P_LASTUPDATE" direction="IN" type="VARCHAR" />
<int-jdbc:parameter name="P_USERID" expression="#xpath(payload, '//CurrentUserID')" />
<int-jdbc:parameter name="P_BUSINESSAREA" expression="#xpath(payload, '//SelectedBusinessArea/Code')" />
<int-jdbc:parameter name="P_SELECTEDIND" expression="#xpath(payload, '//SelectedBusinessArea/Selected')" />
<int-jdbc:parameter name="P_DEFAULTIND" expression="#xpath(payload, '//SelectedBusinessArea/Default')" />
<int-jdbc:parameter name="P_LEGACYSYSTEM" expression="#xpath(payload, '//SelectedBusinessArea/LegacySystem')" />
<int-jdbc:parameter name="P_LEGACYLOGIN" expression="#xpath(payload, '//SelectedBusinessArea/LegacyLogin')" />
<int-jdbc:parameter name="P_LEGACYPASSWORD" expression="headers.LegacyPassword" />
<int-jdbc:parameter name="P_OTHERLOGIN" expression="#xpath(payload, '//SelectedBusinessArea/OtherLogin')" />
<int-jdbc:parameter name="P_OTHERPASSWORD" expression="headers.otherPassword" />
<int-jdbc:parameter name="P_ADDSECURLOGIN" expression="#xpath(payload, '//SelectedBusinessArea/AddSecurLogin')" />
<int-jdbc:parameter name="P_ADDSECURPASSWORD" expression="headers.addSecurPassword" />
<int-jdbc:parameter name="P_LASTUPDATEUSERID" expression="#xpath(payload, '//userID')" />
<int-jdbc:parameter name="P_LASTUPDATE" expression="#xpath(payload, '//dateTimeStamp')" />
<int-jdbc:returning-resultset name="rowMapper" row-mapper="com.dsths.cs.awd.utils.ResultSetRowMapper"/>
</int-jdbc:stored-proc-outbound-gateway>
</int:chain>
<!-- Service Activator to build the Message from the Stored Procedure ResultSet -->
<int:channel id="PQPutUserBAInformation-SPCallStage2-Response" />
<int:service-activator input-channel="PQPutUserBAInformation-SPCallStage2-Response"
output-channel="PQPutUserBAInformation-Enrich-SPCallStage2"
ref="msgHandler"
method="buildMessageFromExtSysResponse" />
<!-- Service Activator to build the jobResponse xml making use of jobRequestXml and xlst transformed xml-->
<int:channel id="PQPutUserBAInformation-Enrich-SPCallStage2" />
<int:service-activator input-channel="PQPutUserBAInformation-Enrich-SPCallStage2"
output-channel="PQPutUserBAInformation-CleanUp"
ref="msgHandler"
method="enrichPayloadXml" />
<int:chain input-channel="PQPutUserBAInformation-CleanUp" >
<!-- Transformer to transform the resultXml to the user understandable form using XSLT -->
<int-xml:xslt-transformer xsl-resource="${stylesheet.PQPutUserBAInformationCleanUp}" />
</int:chain>
</beans>
答案 0 :(得分:0)
这意味着存储过程没有产生结果。
答案 1 :(得分:0)
我遇到了同样的问题,并且我将其修复,该异常意味着转换步骤返回null(不应为null),因为我创建的消息无法正确转换。尝试调试到转换步骤,然后看看结果如何。例外发生在我的第二行:
IntegrationFlows.from(testChannel() )
.transform( new ObjectTransformer() )
.<Object, Class<?>>route(Object::getClass,