【问题标题】:How to load Mule XML configuration如何加载 Mule XML 配置
【发布时间】:2012-02-13 19:41:49
【问题描述】:

我试图遵循这个例子

http://www.mulesoft.org/documentation/display/MULE3USER/Building+Web+Services+with+CXF

在一个遗留项目上,然后我创建一个主类,它的主方法像这样启动 spring(或者我认为这就是这样做的方法)

    XmlBeanFactory beanFactory = new XmlBeanFactory(new ClassPathResource(
            "mule-config.xml"));

但是我然后 telnet 到我的 web 服务端口,它不起作用!!!

  1. 它应该启动它自己的 Web 容器/服务器,还是我需要部署到 tomcat 或某个应用服务器来完成这项工作
  2. 如果#1 的答案是需要部署,为什么在他们的示例中指定了一个绝对网址,就像它会为您启动一个?

如何让它工作?

这是我的 xml..

<flow name="helloService">
    <http:inbound-endpoint address="http://localhost:63081/enrollment" exchange-pattern="request-response">
        <cxf:jaxws-service serviceClass="com.ifp.esb.integration.ingest.EnrollmentWS"/>
    </http:inbound-endpoint>
    <component> 
        <spring-object bean="enrollmentBean" />  
    </component> 
</flow>

【问题讨论】:

    标签: mule


    【解决方案1】:

    您需要使用 Mule 特定的 Spring 配置加载器:

    SpringXmlConfigurationBuilder builder = new SpringXmlConfigurationBuilder("mule-config.xml");
    MuleContextFactory muleContextFactory = new DefaultMuleContextFactory();
    MuleContext muleContext = muleContextFactory.createMuleContext(builder);
    muleContext.start();
    

    【讨论】:

      【解决方案2】:

      您也可以使用 web 应用程序来启动 mule 上下文。看到它被标记为在启动时加载。

      这是一个 web.xml 的示例

      <web-app
      xmlns="http://java.sun.com/xml/ns/j2ee"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee web-app_2_4.xsd"
      version="2.4">
      <context-param>
          <param-name>org.mule.config</param-name>
          <param-value>
              mule-config.xml,
              mule-config2.xml,
                  ...
              mule-config99.xml
          </param-value>
      </context-param>
      
      <listener>
          <listener-class>org.mule.config.builders.MuleXmlBuilderContextListener</listener-class>
      </listener>
      
      <servlet>
          <servlet-name>muleServlet</servlet-name>
          <servlet-class>org.mule.transport.servlet.MuleReceiverServlet</servlet-class>
          <load-on-startup>1</load-on-startup>
      </servlet>
      
      <servlet-mapping>
          <servlet-name>muleServlet</servlet-name>
          <url-pattern>/muleservlet/*</url-pattern>
      </servlet-mapping>
      </web-app>
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2017-07-08
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2014-01-09
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多