Cannot access resources defined in EAR from the outside classes (JBoss 5.1)
I have a resource file located in WAR file stored inside of EAR.
开发者_JAVA技巧The location is, to be precise: myApp-web.ear/myApp.war/WEB-INF/classes/file.properties.
I'm trying to access this file from another class located in JAR file (not within the main EAR).
This is how I'm trying to access the file:
SomeClass.class.getResourceAsStream("/WEB-INF/classes/file.properties");
The result is null.
This used to work well in JBoss 4.2, but does not work in 5.1.
Any ideas?
This should never have worked. WEB-INF/classes/
is already part of the classpath, so getResourceAsStream("/file.properties")
is the correct way to locate the file.
精彩评论