【问题标题】:Mule ESB - Configure Multiple Components in same FlowMule ESB - 在同一流程中配置多个组件
【发布时间】:2015-08-03 18:26:03
【问题描述】:

尝试将 Spring 组件添加到 Mule Flow 时,我收到一条错误消息。这应该是一个常见的用户案例,但我找不到正确的文档或示例。提前致谢。

以下是原始配置并且工作正常:

<flow name="ApplicationEndpoint">
    <inbound-endpoint address="server:port/JSONAPI/"/>
    <jersey:resources>
        <component>
            <spring-object bean="myJerseyService"/>     
        </component>            
    </jersey:resources>

    <catch-exception-strategy doc:name="Catch Exception Strategy">
        <flow-ref name="ErrorHandling" doc:name="Flow Reference"/>
    </catch-exception-strategy>         
</flow>

我只是想添加一个新组件来做一些后期处理。当我尝试这个时,它不起作用:

<flow name="ApplicationEndpoint">
    <inbound-endpoint address="server:port/JSONAPI/"/>
    <jersey:resources>
        <component>
            <spring-object bean="myJerseyService"/>     
        </component>            
    </jersey:resources>
    <component>
      <spring-object bean="postProcessor"/>
    <component>
    <catch-exception-strategy doc:name="Catch Exception Strategy">
        <flow-ref name="ErrorHandling" doc:name="Flow Reference"/>
    </catch-exception-strategy>         
</flow>

“postProcessor”在配置中的其他位置映射为 spring bean。

我得到的错误信息是:

org.xml.sax.SAXParseException:cvc-complex-type.2.4.a:发现以元素“组件”开头的无效内容。应为 '{"http://www.mulesoft.org/schema/mule/core":abstract-lifecycle-adapter-factory, "http://www.mulesoft.org/schema/mule/core":binding}' 之一。

【问题讨论】:

  • 我尝试了您的配置并登陆端点“server:port/JSONAPI/”格式错误,无法解析。请您发布完整的 XML 和完整的错误堆栈跟踪。

标签: java spring mule esb


【解决方案1】:

上面的错误清楚地表明标签&lt;component&gt;没有关闭..

例如,它应该采用以下格式:-

 <component>
    <spring-object bean="postProcessor"/>
 </component>

您需要在哪里结束标记,如下所示:- &lt;/component&gt;

还有一件事...我试图运行您的代码,但由于在您的inbound-endpoint 地址中配置了server:port/JSONAPI/,它给出了一个错误,指出 xml 格式错误

所以我修改了你的代码如下,它运行成功:-

<flow name="ApplicationEndpoint">
    <inbound-endpoint address="http://localhost:8189/JSONAPI"/>
    <jersey:resources>
        <component>
            <spring-object bean="myJerseyService"/>     
        </component>            
    </jersey:resources>
    <component>
      <spring-object bean="postProcessor"/>
    </component>
    <catch-exception-strategy doc:name="Catch Exception Strategy">
        <flow-ref name="ErrorHandling" doc:name="Flow Reference"/>
    </catch-exception-strategy>         
</flow>

所以,您现在可以使用它并根据您的要求进行修改

【讨论】:

  • 非常感谢。我不敢相信我没有看到。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2016-05-15
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多