Xml 从Mule中的.properties文件加载时,FileNotFound异常

Xml 从Mule中的.properties文件加载时,FileNotFound异常,xml,mule,mule-studio,Xml,Mule,Mule Studio,我试图从Mule中的.properties文件加载值,当文件明显存在时,我会得到一个FileNotFound异常。我尝试过使用相对路径将文件放入项目目录中,但没有任何效果 这是我的骡子流中的相关资料- <?xml version="1.0" encoding="UTF-8"?> <mule xmlns:context="http://www.springframework.org/schema/context" xmlns:file="http://www.mulesoft

我试图从Mule中的.properties文件加载值,当文件明显存在时,我会得到一个FileNotFound异常。我尝试过使用相对路径将文件放入项目目录中,但没有任何效果

这是我的骡子流中的相关资料-

<?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>


有什么办法解决这个问题吗?

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


设置.properties
文件放在类路径中(直接在项目中的src/main/resources/下),并如下引用:


默认情况下,上下文属性placeholder会查看类路径

使用以下配置在文件存在的物理路径中查找文件

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

这应该行得通

最好的方法是将属性文件保存在项目类路径中


希望这有帮助。

上下文属性placeholder默认情况下查看类路径

使用以下配置在文件存在的物理路径中查找文件

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

这应该行得通

最好的方法是将属性文件保存在项目类路径中


希望这有帮助。

将属性文件放在类路径中,如app/main/src。它会起作用的 有关属性文件的更多信息,请查看下面的链接


将属性文件放置在类路径中,如app/main/src。它会起作用的 有关属性文件的更多信息,请查看下面的链接


在此处添加说明在此处添加说明