【问题标题】:FilenotFound exception while loading from a .properties file in Mule 3.8从 Mule 3.8 中的 .properties 文件加载时出现 FilenotFound 异常
【发布时间】:2016-11-07 14:24:54
【问题描述】:

我从 Git 存储库导入了一个项目。当我尝试部署到 ESB 时,部署失败并报告它找不到属性文件。 //org.springframework.beans.factory.BeanInitializationException: 无法加载属性;嵌套异常是 java.io.FileNotFoundException:类路径资源 [config.properties] 无法打开,因为它不存在 在 org.springframework.beans.factory.config.PropertyResourceConfigurer.postProcessBean 工厂(PropertyResourceConfigurer.java:89)~[spring-beans-4.1.6.RELEASE.jar:4.1.6.RELEASE] 在 org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors (PostProcessorRegistrationDelegate.java:265)~[spring-context-4.1.6.RELEASE.jar:4.1.6.RELEASE] 在 org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors (PostProcessorRegistrationDelegate.java:162) ~[spring-context-4.1.6.RELEASE.jar:4.1.6.RELEASE]

我正在使用一个属性文件来获取多个环境详细信息,并根据环境名称来选择文件并复制到 src/main/resources 文件夹下。但是,即使我能够看到文件被正确拾取并复制到 src/main/resources 位置。 其他人似乎已经能够成功部署它。我尝试将属性文件移动到 src/main/resources 文件夹,结果相同。 为什么 ESB 无法找到 /src/main/resources 中的属性文件?

这里是代码 sn-p:

【问题讨论】:

    标签: deployment dependency-properties mule-studio filenotfoundexception anypoint-studio


    【解决方案1】:

    将您的 config.properties 文件保存在您的类路径中,并按如下方式引用它

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-07-07
      • 1970-01-01
      • 1970-01-01
      • 2011-02-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多