我正在将一个Spring项目与Mule和a集成,在启动时收到以下错误 . 有没有最好的参考我可以用于 spring 骡子整合流量?
骡流配置
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns:mulexml="http://www.mulesoft.org/schema/mule/xml"
xmlns:file="http://www.mulesoft.org/schema/mule/file" xmlns="http://www.mulesoft.org/schema/mule/core"
xmlns:doc="http://www.mulesoft.org/schema/mule/documentation"
xmlns:spring="http://www.springframework.org/schema/beans" version="EE-3.7.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
http://www.mulesoft.org/schema/mule/file http://www.mulesoft.org/schema/mule/file/current/mule-file.xsd
http://www.mulesoft.org/schema/mule/xml http://www.mulesoft.org/schema/mule/xml/current/mule-xml.xsd">
<spring:beans>
<spring:import resource="classpath:app-spring.xml"/>
</spring:beans>
<file:connector name="File" autoDelete="true" streaming="true" validateConnections="true" doc:name="File" />
<mulexml:jaxb-context name="JAXB_Context" packageNames="com.dbs.ibgt.scf.eventhandler" doc:name="JAXB Context" />
<flow name="Push Transactions to IMEX">
<file:inbound-endpoint responseTimeout="10000" doc:name="File" path="D:\SCF\eh_in" />
<mulexml:jaxb-xml-to-object-transformer jaxbContext-ref="JAXB_Context" doc:name="XML to JAXB Object" returnClass="com.eventhandler.EventHandlerMessage" />
<set-session-variable variableName="jaxbObject" value="#[payload]" doc:name="Set the Jaxb Object" />
<component>
<spring-object bean="EventChecker">
<property-entry-point-resolver property = "checkEvent" />
</spring-object>
</component>
<logger level="INFO" doc:name="Logger" message="message="#[message.payload]"" />
</flow>
</mule>
Java文件
@Component
public class EventChecker {
public String checkEvent()
{
System.out.println("Inside Check Event");
return "SEND_IMEX";
}
}
错误堆栈.....
INFO:初始化Spring root WebApplicationContext org.mule.api.config.ConfigurationException:来自URL的XML文档中的第35行[file:/ D:/Work/.metadata/.plugins/org.eclipse.wst.server.core/tmp0 /wtpwebapps/...../WEB-INF/classes/EventHandler.xml]无效;嵌套异常是org.xml.sax.SAXParseException; lineNumber:35; columnNumber:66; cvc-complex-type.2.4.a:从元素'property-entry-point-resolver'开始发现无效内容 . 其中一个'{“http://www.mulesoft.org/schema/mule/core":property,,http://www.mulesoft.org/schema/mule/core":properties}'是预料之中的 . (org.mule.config.buil.AbstractConfigurationBuilder.configure(ArlectionConfigurationBuilder.java:49)org.mule.config.builders.AbstractResourceConfigurationBuilder.configure(AbstractResourceConfigurationBuilder.java:69)at org.mule.config.buil.life.InitialisationException org.mule.context.DefaultMuleContextFactory $ 2.configure(DefaultMuleContextFactory.java:103)org.mule.context.DefaultMuleContextFactory.doCreateMuleContext(DefaultMuleContextFactory.java:217)org.mule.context.DefaultMuleContextFactory.createMuleContext(DefaultMuleContextFactory.java:98 )org.apule.context.DefaultMuleContextFactory.createMuleContext(DefaultMuleContextFactory.java:57)at com.dbs.ibgt.scf.startup.MuleStartup.contextInitialized(MuleStartup.java:57)at org.apache.catalina.core.StandardContext . listenerStart(StandardContext.java:4973)位于org.ap的org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5467)org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) ache.catalina.core.ContainerBase $ StartChild.call(ContainerBase.java:1559)atg.apache.catalina.core.ContainerBase $ StartChild.call(ContainerBase.java:1549)at java.util.concurrent.FutureTask.run( FutureTask.java:262)java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)at java.util.concurrent.ThreadPoolExecutor $ Worker.run(ThreadPoolExecutor.java:615)at java.lang.Thread.run (Thread.java:745)
3 回答
根据documentation,spring-object允许的唯一子元素是属性和属性 . 如果要配置property-entry-point-resolver,则需要为组件执行此操作 .
试试下面的东西
杰巴,我有一个模板可以满足您的要求:
https://github.com/jrichardsz/mule-esb-usefull-templates
这个项目包含一个简单的 spring 组件,并展示了如何在mule app中使用它 .
还显示了如何读取属性文件和同时处理mule消息 .
Structure :
Mule app :
Spring component :
Spring xml configurations :
app-spring-context.xml
app-spring-component.xml
我希望这可以帮助你 .
问候 .