Reputation: 799
My File is located at:
<JBOSS_HOME>/standalone/deployments/mycompany.war/META-INF/myfile.xml
The Class which is trying to lookup the file is inside a jar file at:
<JBOSS_HOME>/modules/com/mycompany/lib/main/mycompany.jar
The code snippet looks like:
Thread.currentThread().getContextClassLoader().getResourceAsStream("META-INF/myfile.xml"))
This returns null.
Why? I'm lost!
Upvotes: 1
Views: 1132
Reputation: 1234
It seems to be a problem of classloading isolation. Look at this may help How can i add a jboss 7.1 module that contain classes that implements/extends from classes in the main ear file of the server?
Specifically try adding below into your jboss-deployment-structure.xml
<resources>
<resource-root path="META-INF/myfolder" />
</resources>
And access the resources inside it as below.
Thread.currentThread().getContextClassLoader().getResourceAsStream(MY_RESOURCE_PATH)
Upvotes: 1