如何加载 Mule XML 配置

发布于 2025-01-04 19:07:23 字数 1119 浏览 1 评论 0原文

我试图遵循这个示例

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

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

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

但是我然后远程登录到我的网络服务端口,但它不起作用!

  1. 它是否应该启动它自己的 Web 容器/服务器,或者我是否需要部署到 tomcat 或某些应用程序服务器才能使其工作
  2. 如果#1 的答案是需要部署,为什么在他们的示例中指定了一个绝对 URL会为您启动一个吗?

如何让它发挥作用?

这是我的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>

I was trying to follow this example

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

on a legacy project so then I create a main class with a main method that starts up spring like so(or I think this is how to do it)

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

but the I then telnet into the port I have for my webservice and it doesn't work!!!

  1. IS it supposed to start it's own web container/server or do I need to deploy to tomcat or some app server to make this work
  2. If the answer to #1 is need to deploy, why is there an absolute url specified in their example like it will start one for you?

How to get this to work?

Here is my 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>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

叫思念不要吵 2025-01-11 19:07:23

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

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

You need to use the Mule-specific Spring config loader:

SpringXmlConfigurationBuilder builder = new SpringXmlConfigurationBuilder("mule-config.xml");
MuleContextFactory muleContextFactory = new DefaultMuleContextFactory();
MuleContext muleContext = muleContextFactory.createMuleContext(builder);
muleContext.start();
雨落□心尘 2025-01-11 19:07:23

您也可以使用 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>

You can use a webapp to start the mule context too. See that it is marked to load on startup.

Here's an example of a 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>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文