2

I'm very confused about the JBoss class loader. Can any one describe in details how the class loader works, exactly? I only have to do one thing...

If a WAR doesn't find a class with its own classloader, he delegates the search to its parent classloader which must be the EAR's.

What changes should I have to do in my application for the above?

Please reply as soon as possible.

Thank you.

Tomislav Nakic-Alfirevic
  • 10,017
  • 5
  • 38
  • 51
Lokesh Paunikar
  • 1,679
  • 5
  • 21
  • 26
  • The JBoss classloader is rather confusing but you really haven't told us what your problem is just that you don't understand the classloader. When looking for a class it SHOULD look for it in libraries or classes in your WAR or EAR. If it cannot find these here it will look for the classes in a JBoss plugin or public library within the JBoss installation. Then it will look on the system classpath and finally within lib/ext of the JRE. – maple_shaft May 17 '11 at 11:30
  • hi, actually I have an EAR which contains a WAR. And a .jar file which is present in both ear/lib and WEB-INF/lib, when I remove this .jar file from WEB-INF/lib and deployed EAR in jboss, the deployment is failed due to .jar file not find in WEB-INF/lib. But it should be loaded with it's parent class loader i.e. EAR's and ear/lib contains this .jar file. And when I paste the .jar file in WEB-INF/lib every thing is working properly. But I don't have to put .jar file in WEB-INF/lib. How I can do this? please reply me. – Lokesh Paunikar May 17 '11 at 12:58

1 Answers1

0

In continuation of our discussion in the comments, I noticed the following JBoss feature request.

https://issues.jboss.org/browse/JBAS-4037

It looks like JBoss 4 is not fully Java EE5 compatible, however later versions of JBoss should have fixed this issue.

What version of JBoss are you running?

maple_shaft
  • 10,435
  • 6
  • 46
  • 74
  • Hi, thanks for the reply. I m using jboss version 4.2.3.GA .Can you tell me how I can specify for a .jar file to use this particular class loader. Actually I got a classCastException for the same class, due to different class loader loads the same class. can you tell me how I can solve this type of issue. please reply me as soon as possible. thanks once again. And I can not change my jboss version. – Lokesh Paunikar May 19 '11 at 09:15
  • I am not sure what you are asking, but the 4.2.3 version of jBoss is not fully Java EE5 compatible so there is no classloader for .jar files in `ear/lib`. If you cannot upgrade your version of jBoss then to work around this you will need to move your jar files from `ear/lib` to `WEB-INF/lib` – maple_shaft May 19 '11 at 10:58