【问题标题】:Mule: Invalid Session IDMule:会话 ID 无效
【发布时间】:2016-03-24 16:09:39
【问题描述】:

一个错误 Invalid Session ID 出现在 Mule 上,这是一个使用 SOAP 和 SugarCRM 连接器 (http://mulesoft.github.io/sugarcrm-connector/) 的应用程序。

但是在这种情况下会出现这个错误:

  1. App 启动并处理所有 Poll(数据库查询)
  2. SOAP 工作正常
  3. 应用一直在等待新的更新/插入
  4. 在一段时间(24 小时,p.e)之后发生新的更新/插入
  5. 流程在 App 中处理
  6. 但是,出现以下错误(repreat for ever):

编辑:

2016-03-24 12:31:30,470 [pool-106-thread-1] 错误 org.mule.retry.notifiers.ConnectNotifier - 失败 连接/重新连接:工作描述符。根异常是:无效 会话 ID。类型:类 org.apache.cxf.binding.soap.SoapFault 2016-03-24 12:31:30,471 [pool-106-thread-1] 错误 org.mule.exception.DefaultMessagingExceptionStrategy - ****************************************************** ****************************** 消息:调用 getEntryList 失败。消息负载 是类型:GetEntryListRequest 代码: MULE_ERROR-29999 -------------------------------------------------- ------------------------------ 异常堆栈是: 1. 无效的会话 ID (org.apache.cxf.binding.soap.SoapFault) org.apache.cxf.binding.soap.interceptor.Soap11FaultInInterceptor:84 (空值) 2. 会话 ID 无效 (javax.xml.ws.soap.SOAPFaultException) org.apache.cxf.jaxws.JaxWsClientProxy:158 (http://java.sun.com/j2ee/sdk_1.3/techdocs/api/javax/xml/ws/soap/SOAPFaultException.html) 3. 调用getEntryList 失败。消息负载的类型:GetEntryListRequest (org.mule.api.MessagingException)
org.mule.devkit.processor.DevkitBasedMessageProcessor:133 (http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/api/MessagingException.html) -------------------------------------------------- ------------------------------ 根异常堆栈跟踪:org.apache.cxf.binding.soap.SoapFault: 会话 ID 无效 org.apache.cxf.binding.soap.interceptor.Soap11FaultInInterceptor.unmarshalFault(Soap11FaultInInterceptor.java:84) 在 org.apache.cxf.binding.soap.interceptor.Soap11FaultInInterceptor.handleMessage(Soap11FaultInInterceptor.java:51) 在 org.apache.cxf.binding.soap.interceptor.Soap11FaultInInterceptor.handleMessage(Soap11FaultInInterceptor.java:40) + 3 个以上(设置调试级别日志记录或 '-Dmule.verbose.exceptions=true' 为所有内容)


2016-03-24 12:31:40,471 [pool-106-thread-1] 错误 org.mule.retry.notifiers.ConnectNotifier - 失败 连接/重新连接:工作描述符。根异常是:无效 会话 ID。类型:类 org.apache.cxf.binding.soap.SoapFault 2016-03-24 12:31:40,472 [pool-106-thread-1] 错误 org.mule.exception.DefaultMessagingExceptionStrategy - ****************************************************** ****************************** 消息:调用 getEntryList 失败。消息负载 是类型:GetEntryListRequest 代码: MULE_ERROR-29999 -------------------------------------------------- ------------------------------ 异常堆栈是: 1. 无效的会话 ID (org.apache.cxf.binding.soap.SoapFault) org.apache.cxf.binding.soap.interceptor.Soap11FaultInInterceptor:84 (空值) 2. 会话 ID 无效 (javax.xml.ws.soap.SOAPFaultException) org.apache.cxf.jaxws.JaxWsClientProxy:158 (http://java.sun.com/j2ee/sdk_1.3/techdocs/api/javax/xml/ws/soap/SOAPFaultException.html) 3. 调用getEntryList 失败。消息负载的类型:GetEntryListRequest (org.mule.api.MessagingException)
org.mule.devkit.processor.DevkitBasedMessageProcessor:133 (http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/api/MessagingException.html) -------------------------------------------------- ------------------------------ 根异常堆栈跟踪:org.apache.cxf.binding.soap.SoapFault: 会话 ID 无效 org.apache.cxf.binding.soap.interceptor.Soap11FaultInInterceptor.unmarshalFault(Soap11FaultInInterceptor.java:84) 在 org.apache.cxf.binding.soap.interceptor.Soap11FaultInInterceptor.handleMessage(Soap11FaultInInterceptor.java:51) 在 org.apache.cxf.binding.soap.interceptor.Soap11FaultInInterceptor.handleMessage(Soap11FaultInInterceptor.java:40) + 3 个以上(设置调试级别日志记录或 '-Dmule.verbose.exceptions=true' 为所有内容)


我按照下图配置了重新连接,但没有错误继续。

编辑:

XML 配置(简化)

<db:oracle-config name="Oracle_Configuration" host="${db.host}" port="${db.port}" instance="${db.instance}" user="${db.user}" password="${db.password}" doc:name="Oracle Configuration">
    <db:pooling-profile/>
</db:oracle-config>
<sugar:config name="Sugar__Configuration" username="${crm.ws.user}" password="${crm.ws.password}" endpoint="${crm.ws.endpoint}" doc:name="Sugar: Configuration">
    <sugar:connection-pooling-profile initialisationPolicy="INITIALISE_ONE" exhaustedAction="WHEN_EXHAUSTED_GROW"/>
    <reconnect-forever frequency="60000"/>
</sugar:config>    
<flow name="produto-precoFlow" processingStrategy="synchronous">
    <poll doc:name="Poll" doc:description="Produto">
        <fixed-frequency-scheduler frequency="10000"/>
        <watermark variable="carimboTempo" default-expression="2016-02-24 00:00:00" selector="MAX" selector-expression="#[message.payload.datalt]"/>
        <db:select config-ref="Oracle_Configuration" doc:name="Database">
            <db:parameterized-query><![CDATA[SELECT * FROM PRODUTO WHERE TO_CHAR(DATALT, 'yyyy-mm-dd hh24:mi:ss') > #[flowVars.carimboTempo]]]></db:parameterized-query>
        </db:select>
    </poll>
    <foreach doc:name="For Each">
        <enricher target="#[payload.produtoPrecoSugar]" doc:name="Message Enricher Produto">
            <flow-ref name="produto-precoSub_FlowProduto" doc:name="produto-precoSub_FlowProduto"/>
        </enricher>
         // [...] mode code here (original) 
        <scripting:component doc:name="Groovy Inserir/Alterar">
            <scripting:script engine="Groovy"><![CDATA[import org.mule.modules.sugarcrm.request.SetEntryRequest;
import com.sugarcrm.sugarcrm.NameValue;
req = new SetEntryRequest();
req.setModuleName("AOS_Products");
nameValues = [];
for ( e in message.payload ) {
   nameValue = new NameValue();
   nameValue.setName(e.key);
   nameValue.setValue(e.value.toString());
   nameValues.add(nameValue);        
}
req.setNameValueList(nameValues);
return req;]]></scripting:script>
        </scripting:component>
        <sugar:set-entry config-ref="Sugar__Configuration" doc:name="Sugar Inserir/Alterar"/>
    </foreach>
</flow>
<sub-flow name="produto-precoSub_FlowProduto">
    <scripting:component doc:name="Groovy Id Produto">
        <scripting:script engine="Groovy"><![CDATA[import org.mule.modules.sugarcrm.request.GetEntryListRequest;

req = new GetEntryListRequest();
req.setModuleName("AOS_Products");

whereQuery = "aos_products.deleted = 0";

for ( e in message.payload ) {
    if (e.key == "sapiens_codtpr_c" || e.key == "sapiens_datini_c" || e.key == "sapiens_codser_c")  {
       whereQuery = whereQuery + " and " + e.key + " = '" + e.value.toString() + "'";
    } else if (e.key == "sapiens_codemp_c" || e.key == "sapiens_qtdmax_c") {
       whereQuery = whereQuery + " and " + e.key + " = " + e.value.toString();     
    } 
}

req.setQuery(whereQuery);
req.setSelectFields(["id"]);
req.setDeleted(0);

return req;

]]></scripting:script>
    </scripting:component>
    <sugar:get-entry-list config-ref="Sugar__Configuration" doc:name="Sugar Id Produto e Preço"/>
</sub-flow>

可能发生什么?有没有解决这个问题的表格?

【问题讨论】:

  • 会话ID是否可能已过期?您最初是如何获得它的?
  • 服务器上的会话可能已经过期(超时),是的。但是在这种情况下,Mule应该重新连接,对吧(重新连接策略)?第一次,Mule 服务器在启动/第一次请求时通过 Sugar Connection 参数建立了连接。上面已编辑以包含 XML 配置。

标签: soap mule sugarcrm


【解决方案1】:

查看source code of the connector,我们可以看到仅通过会话 ID 的存在,Sugar 连接就被认为是有效的:

@ValidateConnection
public boolean isConnected() {
    return sessionId != null;
}

这意味着即使会话过期,连接也会被认为是活动的。这可能被视为错误并报告给 MuleSoft。

请注意,使用重新连接策略后,预期行为将是:

  • 已尝试出站操作,
  • 失败了,
  • 重连策略调用connect
  • 出站操作已重试,现在成功。此重试应由应用程序完成,作为reliability pattern 的一部分。

如果您没有观察到这种行为,即如果出站操作失败后重新连接策略没有启动,这可能是一个需要向 MuleSoft 报告的错误。

【讨论】:

  • 我在错误跟踪器 MuleSoft 中打开了这个问题:mulesoft.org/jira/browse/MULE-9516。感谢您的帮助!
  • 您对解决此问题有什么建议吗?
  • 视情况而定 :) 当出站操作失败时,您是否看到重新连接策略启动?
  • 此时我看到两个选项: 1. 操作失败时,强制建立新连接。 2.当(for each)流完成后,我强制断开连接(设置SessionID = null),然后在初始化新的流实例时,我认为将完成新的重新连接。但是,对于这两个选项,我还不知道如何实现!
  • 好的,那么我们就破产了。重新连接不起作用,因此不值得重试。让我们希望连接器得到修复。
猜你喜欢
  • 2019-09-26
  • 2019-08-13
  • 2016-04-23
  • 2019-09-23
  • 2011-10-13
  • 1970-01-01
  • 1970-01-01
  • 2015-09-07
  • 2021-02-18
相关资源
最近更新 更多