从Mule中的.properties文件加载时出现FileNotFound异常 [英] FileNotFound exception while loading from a .properties file in Mule

查看:96
本文介绍了从Mule中的.properties文件加载时出现FileNotFound异常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试从Mule中的.properties文件加载值,并且当文件明确存在时出现FileNotFound异常.我尝试使用相对路径将文件放入项目目录中,但无济于事.

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.

以下是我的ule子流中的相关内容-

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?

推荐答案

settings.properties文件放在类路径中(直接在项目中的src/main/resources/下),并像这样引用它:

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

这篇关于从Mule中的.properties文件加载时出现FileNotFound异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆