java.lang.ClassNotFoundException: com.mulesoft.weave.module.writer.Writer

1.3k views Asked by At

I'm having an error with mule standalone version 3.8.1 when trying to transform a payload into an xml before sending it to a webservice.

My flow config is like this:

<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>

When we try to process the message we get:

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)

The dependency in my pom.xml is:

...
        <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>

Thanks, Jose.

3

There are 3 answers

2
pringi On

Add the following dependency

<dependency>
    <groupId>com.mulesoft.weave</groupId>
    <artifactId>core</artifactId>
    <version>1.2.0-M4</version>
</dependency>
2
Khalil M On

update your pom to mule plugin version 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: Invalid content was found starting with element 'dw:transform-message

this means that you did not configure correctly the flow so be sure to declare everything you need in the namespace

0
CountD On

As confirmed by @joseluisvl (the OP) in comments, the exception arises because DataWeave is only available for EE (Enterprise Edition) runtimes.