FileNotFound exception while loading from a .properties file in Mule
Asked Answered
L

3

0

I'm trying to load values from a .properties file in Mule and I get a FileNotFound exception when the file clearly exists. I've tried putting the file inside the project directory, using relative path but nothing works.

Here is relevant stuff from my Mule flow -

<?xml version="1.0" encoding="UTF-8"?>

<mule 
xmlns:context="http://www.springframework.org/schema/context"
xmlns:file="http://www.mulesoft.org/schema/mule/file" 
xmlns="http://www.mulesoft.org/schema/mule/core" 
xmlns:mulexml="http://www.mulesoft.org/schema/mule/xml" 
xmlns:jdbc-ee="http://www.mulesoft.org/schema/mule/ee/jdbc" 
xmlns:doc="http://www.mulesoft.org/schema/mule/documentation" 
xmlns:spring="http://www.springframework.org/schema/beans" 
xmlns:core="http://www.mulesoft.org/schema/mule/core" 
version="EE-3.4.0" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xsi:schemaLocation="http://www.mulesoft.org/schema/mule/xml http://www.mulesoft.org/schema/mule/xml/current/mule-xml.xsd
http://www.mulesoft.org/schema/mule/ee/jdbc http://www.mulesoft.org/schema/mule/ee/jdbc/current/mule-jdbc-ee.xsd
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/file http://www.mulesoft.org/schema/mule/file/current/mule-file.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" />

<oracle data source info />
<connector info />
<flow name="temp" doc:name="Temp" >
<other stuff />
</flow>
</mule>

Is there any way to get past this issue?

Lisa answered 26/6, 2013 at 17:33 Comment(0)
S
2

Put settings.properties file in your classpath (directly under src/main/resources/ in your project) and refer it like this:

<context:property-placeholder location="settings.properties" />

Sediment answered 27/6, 2013 at 1:31 Comment(0)
D
2

The context property place holder look by default into the classpath.

Use the following configuration to look for a file in the physical path your file exists.

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

This should work.

The most preferred approach is to keep the properties file in the project classpath.

Hope this helps.

Dirge answered 27/6, 2013 at 14:2 Comment(0)
R
0

Place the properties file in class path like app/main/src. It will work For more information related to propertied file take a look at below link.

https://docs.mulesoft.com/mule-user-guide/v/3.5/configuring-properties

Relict answered 3/3, 2018 at 13:29 Comment(1)
Add some description hereRainarainah

© 2022 - 2024 — McMap. All rights reserved.