Mule 3 - Loading from .properties file

Narabhut picture Narabhut · Jun 25, 2013 · Viewed 10.5k times · Source

I'm using Mule 3 to query a database using JDBC, and I'd like to modify the query depending on input from a .properties file. I have this in my xml...

<context:property-placeholder location="C:\path\to\file\settings.properties" />

Getting the following exception...

Exception in thread "main" org.mule.module.launcher.DeploymentInitException: SAXParseException: The prefix "context" for element "context:property-placeholder" is not bound.

Do I need to include some special .xsd file?

Answer

user1760178 picture user1760178 · Jun 25, 2013

Add the xmlns namespace prefix and schema location to your Mule config mule element tag.

Prefix:

xmlns:context="http://www.springframework.org/schema/context"

SchemaLocation:

http://www.springframework.org/schema/context  http://www.springframework.org/schema/context/spring-context-3.0.xsd

It should look like as below.

Eg:

<mule xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:spring="http://www.springframework.org/schema/beans"      
    xmlns:http="http://www.mulesoft.org/schema/mule/http" 
    xmlns:context="http://www.springframework.org/schema/context"

    xsi:schemaLocation="
        http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/3.3/mule.xsd
        http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/3.3/mule-http.xsd
        http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
        http://www.springframework.org/schema/context  http://www.springframework.org/schema/context/spring-context-3.0.xsd      
        ">


<context:property-placeholder location="C:/path/to/file/settings.properties" />


  ...........  Other stuff



</mule>