0

I am trying to migrate application from Jboss 4.2.3 to Jboss 6.0.1.in our application i have to access a resource (image) from war folder.

WAR

|__ logo.jpg

|__images/icons

|__WEB_INF

     |__classes

     |__jps

     |__logo.jpg

I would like to access logo.jpg. in JBoss 4.2.3 this.getClassLoader().getResource("logo.jpg") --> will return path/handle of logo.jpg in war folder

but in Jboss 6.0.1, same code returns null & i am not able to access any resource in war folder.

Please help me how to access logo.jpg in war folder & logo.jpg in WEB_INF folder dynamically in JBoss6.0.1.

Karthikeyan
  • 506
  • 2
  • 8
  • 20

1 Answers1

0

Looks like you are using the wrong classloader as explained here:

How to load resource from jar file packaged in a war file?

Using this.getClassLoader() will only be able to access resources under WEB-INF/classes. Also you should use getResourceAsStream().

Community
  • 1
  • 1
weaselflink
  • 244
  • 2
  • 7