在类路径中找不到属性文件-部署EAR

时间:2018-09-19 21:55:22

标签: spring eclipse maven gradle jboss7.x

尝试在JBoss AS 7中部署EAR项目时遇到以下错误。 (MSC服务线程1-5)上下文初始化失败。 java.io.FileNotFoundException:无法打开类路径资源[.properties]

以下是错误的详细快照。

16:20:08,548 ERROR [org.springframework.web.servlet.DispatcherServlet]
(MSC service thread 1-5) Context initialization failed:
org.springframework.beans.factory.BeanDefinitionStoreException: 
Failed to parse configuration class [xx.xx.Config]; nested exception
is java.io.FileNotFoundException: class path resource
[wwwr.properties] cannot be opened because it does not exist at
org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:181)
[spring-context-4.2.1.RELEASE.jar:4.2.1.RELEASE]  Caused by:
java.io.FileNotFoundException: class path resource [wwwr.properties]
cannot be opened because it does not exist



16:20:08,588 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/MyWeb]]
(MSC service thread 1-5)  StandardWrapper.Throwable:
org.springframework.beans.factory.BeanDefinitionStoreException: Failed
to parse configuration class [com.xx.Config];  nested exception is
java.io.FileNotFoundException: class path resource [wwwr.properties]
cannot be opened because it does not exist

我正在使用JBoss AS7服务器和MyEclipse作为IDE。

1 个答案:

答案 0 :(得分:0)

我发现解决方案涉及以下步骤

1)确保属性文件位于相关项目的“类路径”中,或者至少位于Jboss中部署的模块中。 1- a)确认modules.xml文件具有正确的条目

ghs.googlehosted.com/myapp.example.com/...

2)验证EAR中的Manifest.mf文件具有必需的依赖性。

<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.0" name="com.xx.yy">
<resources>
<resource-root path="./properties/"/>

3)清理构建并将其部署到服务器。