1

I am trying to integrate mule with drools, I have mainly followed the tutorial here but I am getting this error :

"The prefix "vm" for element "vm:endpoint" is not bound."

can anyone help me solve this problem?

following is my .drl file and mule flow files.

<?xml version="1.0" encoding="UTF-8"?>
<mule 
xmlns:bpm="http://www.mulesoft.org/schema/mule/bpm"
xmlns:http="http://www.mulesoft.org/schema/mule/http"
xmlns:tracking="http://www.mulesoft.org/schema/mule/ee/tracking" 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.6.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.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd
http://www.mulesoft.org/schema/mule/ee/tracking http://www.mulesoft.org/schema/mule/ee/tracking/current/mule-tracking-ee.xsd
http://www.mulesoft.org/schema/mule/bpm http://www.mulesoft.org/schema/mule/bpm/3.6/mule-bpm.xsd">
    <http:listener-config name="HTTP_Listener_Configuration"
    host="localhost" port="8084" doc:name="HTTP Listener Configuration" />

    <spring:beans>
        <spring:bean id="dto" class="com.hamgam.hit.esb.XMLDTO" scope="singleton" />
        <spring:bean id="dto-convertor" class="com.hamgam.hit.esb.XMLToDTO" scope="singleton" />
        <spring:bean id="rule-convertor" class="com.hamgam.hit.esb.RuleXMLToDRL" scope="singleton" />           
    </spring:beans>

    <bpm:drools />

    <flow name="basic_tutorialFlow">
        <http:listener config-ref="HTTP_Listener_Configuration" path="/{name}" doc:name="HTTP" />
        <vm:endpoint name = "emc" path="drool.msg" />
        <set-variable  variableName="name" value="#[message.inboundProperties['http.uri.params']['name']]" />       
        <set-variable variableName="msg" value="#[payload]"/>
        <logger level="DEBUG" doc:name="Logger" message="Current path is flowVars['name']" />

        <expression-component>
        app.registry['dto'] = app.registry['dto-convertor'].convert(flowVars['name']);
        </expression-component> 

        <bpm:rules rulesDefinition="rule.drl" cepMode="true" initialFacts-ref="dto" entryPoint="XMLDTO stream" />
    
        <choice doc:name="Choice">
            <when expression="#[flowVars.emc == 'KeyValueMatched']">
            <set-payload doc:name="Set Payload" value="#['KeyValueMatched! You are with us on 8084. ' + flowVars['name'] + '. Today is ' + server.dateTime.format('dd/MM/yy') + '.' ]" />
            </when>
            <otherwise>
            <set-payload doc:name="Set Payload" value="#['Nothing! You are with us on 8084. ' + flowVars['name'] + '. Today is ' + server.dateTime.format('dd/MM/yy') + '.' ]" />
            </otherwise>
        </choice>

    </flow>
</mule>

and the drl file :

global org.mule.module.bpm.MessageService mule;    
import com.me.mit.esb.*;
 
rule "La Vita Ebela"    
dialect "mvel"

when
    $x:XMLDTO( inputXML == "inputXML" )
then
    mule.generateMessage("emc",  "KeyValueMatched", null, MessageExchangePattern.ONE_WAY);
end
Djordje Nedovic
  • 559
  • 8
  • 20
MoienGK
  • 4,544
  • 11
  • 58
  • 92

2 Answers2

4

You have to add XML namespache and scema reference to your xml file:

XML namespace:
   xmlns:vm="http://www.mulesoft.org/schema/mule/vm" 

XML Schema Location:
http://www.mulesoft.org/schema/mule/vm http://www.mulesoft.org/schema/mule/vm/3.6/mule-vm.xsd 

So it looks like so:

<mule 
    xmlns:bpm="http://www.mulesoft.org/schema/mule/bpm"
    xmlns:vm="http://www.mulesoft.org/schema/mule/vm" 

    xmlns:http="http://www.mulesoft.org/schema/mule/http"
    xmlns:tracking="http://www.mulesoft.org/schema/mule/ee/tracking" 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.6.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.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd
    http://www.mulesoft.org/schema/mule/ee/tracking http://www.mulesoft.org/schema/mule/ee/tracking/current/mule-tracking-ee.xsd
    http://www.mulesoft.org/schema/mule/bpm http://www.mulesoft.org/schema/mule/bpm/3.6/mule-bpm.xsd
    http://www.mulesoft.org/schema/mule/vm http://www.mulesoft.org/schema/mule/vm/3.6/mule-vm.xsd 
">
Jens
  • 67,715
  • 15
  • 98
  • 113
  • thanks for pointing that out. i did what you told and now i am facing : org.xml.sax.SAXParseException: cvc-complex-type.2.4.a: Invalid content was found starting with element 'vm:endpoint'. – MoienGK Jan 28 '15 at 12:34
  • @dave do you have added `mule-module-objectstore` to jor classpath? – Jens Jan 29 '15 at 06:12
  • I am using anypoint studio so the required libs are included. – MoienGK Jan 30 '15 at 07:01
1

Replase vm:endpoint by vm:inbound-endpoint. As Jens said, add vm schema to your mule-config. And don't forget to include mule-transports-vm-3.6.0.jar to your test classpath.

Ale Sequeira
  • 2,039
  • 1
  • 11
  • 19
  • thanks for reply. i am using Anypoint studio, so i guess the mentioned jar file is included. (i checked under mule server 3.6.0 and the dependecy is there) – MoienGK Jan 28 '15 at 14:17
  • I see your problem now, you should use vm:inbound-endpoint instead of vm:endpoint. I'm Updating my answer. – Ale Sequeira Jan 28 '15 at 14:22
  • i did what you told and now i am facing : Caused by: org.xml.sax.SAXParseException: cvc-complex-type.2.4.a: Invalid content was found starting with element 'vm:inbound-endpoint'. One of '{"http://www.springframework.org/schema/beans":beans,... – MoienGK Jan 28 '15 at 14:36