1

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!

retromuz
  • 809
  • 9
  • 26

1 Answers1

1

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)
Community
  • 1
  • 1
Aris2World
  • 1,214
  • 12
  • 22