Search code examples
xmlmuleanypoint-studiodataweave

mule dataweave anypoint studio The prefix "metadata" for attribute "metadata:id" associated with an element type "dw:transform-message" is not bound


I'm getting this exception when running a mule application.

The prefix "metadata" for attribute "metadata:id" associated with an element type "dw:transform-message" is not bound.

It's calling out a dataweave transformation. I've gotten similar error before, just after editing through the Configuration XML rather than Message Flow.

I found this post which has a response about missing namespaces. From what I can tell, I have the dataweave namespace though

xmlns:file="http://www.mulesoft.org/schema/mule/file" 
xmlns:dw="http://www.mulesoft.org/schema/mule/ee/dw" 
xmlns:http="http://www.mulesoft.org/schema/mule/http" 
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" 
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/http 
http://www.mulesoft.org/schema/mule/http/current/mule-http.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/ee/dw 
http://www.mulesoft.org/schema/mule/ee/dw/current/dw.xsd
http://www.mulesoft.org/schema/mule/core 
http://www.mulesoft.org/schema/mule/core/current/mule.xsd">

I'm very new to mule, if I'm missing something in the namespace, or if someone has seen this, it would be appreciated. Here's the metadata:id too

        <dw:transform-message doc:name="json to flattened json" metadata:id="e1e281d5-880f-48f9-92af-b5ead2b0e5dd">
        <dw:input-payload mimeType="application/json"/>

Solution

  • Just remove the metadata-id

    metadata:id="e1e281d5-880f-48f9-92af-b5ead2b0e5dd

    from your config xml

    <dw:transform-message doc:name="json to flattened json" metadata:id="e1e281d5-880f-48f9-92af-b5ead2b0e5dd">
    <dw:input-payload mimeType="application/json"/>
    

    save it and re-start application once again.It should work.

    Seems this got copied over from some other config xml file, when you were editing your config xml.

    "metadata-id" is generated when you define your payload metadata in "Transform message" component using message flow.It remains valid for that particular config.When you copy this element to some other config it becomes obsolete/un-bound to that context.

    Let us know if that resolves your issue.