I am trying to load a non-Java resource from a specific WAR file. Here is how I am trying to achieve this:
SomeClassInMyWarFile.class.getClassLoader().getResource("path/file.txt");
Works well when working in JBoss 4 - where getClassLoader () returns an instance of WebAppClassLoader .
But when I try to run this code under JBoss 6, I get an instance of BaseClassLoader , which in turn cannot find the resource inside this WAR.
For debugging purposes, when I call getResource ("./") on both, these are the following results:
Jboss 4
"file:/C:/path/to/my/WarFile.war/"
Jboss 6
"file:/C:/jboss6/bin/a1k2347-kpm5pr-hjfoi81u-1-hjfoj582-dz/"
"/ a1k2347-kpm5pr-hjfoi81u-1-hjfoj582-dz /" does not even exist.
I have the feeling that I did not configure my jboss6 correctly or that I missed another important thing here. Any ideas what could happen? Or maybe even someone who can explain what I'm doing wrong?
source share