我试图效仿这个例子
http://www.mulesoft.org/documentation/display/MULE3USER/Building+Web+Services+with+CXF
在遗留项目上然后我创建一个主类,使用main方法启动spring(或者我认为这是怎么做的)
XmlBeanFactory beanFactory = new XmlBeanFactory(new ClassPathResource(
"mule-config.xml"));
但是我然后telnet到我的web服务的端口,它不起作用!!!
如何让它发挥作用?
这是我的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>
答案 0 :(得分:5)
您需要使用特定于Mule的Spring配置加载程序:
SpringXmlConfigurationBuilder builder = new SpringXmlConfigurationBuilder("mule-config.xml");
MuleContextFactory muleContextFactory = new DefaultMuleContextFactory();
MuleContext muleContext = muleContextFactory.createMuleContext(builder);
muleContext.start();
答案 1 :(得分:0)
您也可以使用webapp启动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>