我在尝试将有效负载转换为xml之前将mule独立版本3.8.1发生错误,然后再将其发送到Web服务。
我的流配置是这样的:
<dw:transform-message doc:name="Transform Message" mode="immediate">
<dw:set-payload>
<![CDATA[%dw 1.0
%input payload application/java
%output application/xml
%namespace ns0 urn:INDRA:JIRA:Integracion
---
{
ns0#Create: {
KeyClient: payload.externalIssue,
Accion: payload.accion,
Priority: payload.priority,
Assignee: payload.assignee,
Resolution_Coment: payload.reopenComment,
Solucion: payload.comment,
IssueType: payload.issueType,
ComponentJIRA: payload.component,
No_Rellenar: ""
}
}
]]>
</dw:set-payload>
</dw:transform-message>
当我们尝试处理消息时,我们得到:
ERROR 2016-12-19 13:37:52,208 [ActiveMQ Session Task-1] org.mule.exception.RollbackMessagingExceptionStrategy:
********************************************************************************
Message : com.mulesoft.weave.module.Module: Provider com.mulesoft.weave.module.flatfile.FlatFileModule could not be instantiated: java.lang.NoClassDefFoundError: com/mulesoft/weave/module/writer/Writer (java.util.ServiceConfigurationError).
Payload : RemedyMessageBean{accion='TCURSO', comment=' ', empresa='SSII-Administración (CSA)', externalIssue='INC000000004965', projectParameter4='No Aplica', dueDate='31/12/2016 10:17:00', priority='', reopenComment='', projectParameter1='No Aplica', projectParameter11='No Aplica', stopReason='', component='AX-UTES', issueType='', stopComment='null', assignee=''}
Element XML : <dw:transform-message doc:name="Transform Message" mode="immediate">
<dw:set-payload>%dw 1.0%input payload application/java%output application/xml%namespace ns0 urn:INDRA:JIRA:Integracion---{ns0#Create: {KeyClient: payload.externalIssue,Accion: payload.accion,Priority: payload.priority,Assignee: payload.assignee,Resolution_Coment: payload.reopenComment,Solucion: payload.comment,IssueType: payload.issueType,ComponentJIRA: payload.component,No_Rellenar: ""}}</dw:set-payload>
</dw:transform-message>
Payload Type : es.indra.esb.remedy.servicios.RemedyMessageBean
Element : /AsincronoRemedySI/processors/2/5/0/3 @ EsbOrigin-a:remedy-config.xml:508 (Transform Message)
--------------------------------------------------------------------------------
Root Exception stack trace:
java.lang.ClassNotFoundException: com.mulesoft.weave.module.writer.Writer
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at org.mule.module.launcher.FineGrainedControlClassLoader.findClass(FineGrainedControlClassLoader.java:175)
at org.mule.module.launcher.MuleApplicationClassLoader.findClass(MuleApplicationClassLoader.java:134)
at org.mule.module.launcher.FineGrainedControlClassLoader.loadClass(FineGrainedControlClassLoader.java:119)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Class.java:2493)
at java.lang.Class.getConstructor0(Class.java:2803)
at java.lang.Class.newInstance(Class.java:345)
at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:373)
at java.util.ServiceLoader$1.next(ServiceLoader.java:445)
at scala.collection.convert.Wrappers$JIteratorWrapper.next(Wrappers.scala:43)
我的pom.xml中的依赖项是:
...
<mule.version>3.8.1</mule.version>
...
<dependency>
<groupId>com.mulesoft.weave</groupId>
<artifactId>mule-plugin-weave</artifactId>
<version>${mule.version}</version>
</dependency>
<dependency>
<groupId>com.mulesoft.weave</groupId>
<artifactId>flatfile</artifactId>
<version>1.2.0-M4</version>
</dependency>
谢谢, 何。
答案 0 :(得分:1)
添加以下依赖项
<dependency>
<groupId>com.mulesoft.weave</groupId>
<artifactId>core</artifactId>
<version>1.2.0-M4</version>
</dependency>
答案 1 :(得分:1)
正如@joseluisvl(OP)in comments所证实的那样,出现异常是因为 DataWeave仅适用于EE(企业版)运行时。
答案 2 :(得分:0)
将您的pom更新为mule插件版本4
<!-- https://mvnrepository.com/artifact/com.mulesoft.weave/mule-plugin-weave -->
<dependency>
<groupId>com.mulesoft.weave</groupId>
<artifactId>mule-plugin-weave</artifactId>
<version>4.0.0-M4</version>
</dependency>
<dependency>
<groupId>com.mulesoft.weave</groupId>
<artifactId>core</artifactId>
<version>1.2.0-M4</version>
</dependency>
SAXParseException:cvc-complex-type.2.4.a:找到了无效的内容 从元素'dw:transform-message
开始
这意味着您未正确配置流,因此请务必在命名空间中声明所需的所有内容