• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Class Loaders?

 
Ranch Hand
Posts: 10198
3
Mac PPC Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Guys,

Can anyone please let me know what exactly is a "Web application class loader" and what it exactly does?
 
Joe San
Ranch Hand
Posts: 10198
3
Mac PPC Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Any thoughts on my post guys???
 
author and cow tipper
Posts: 5009
1
Hibernate Spring Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Here's a little snippet on classloaders.

You can find more information here:

Understanding J2EE Classloaders

Enjoy!

-Cameron McKenzie



Web Modules and the CompoundClassLoader

By default, web modules do not share the same classloader instance as the other modules inside of an ear. Web modules get their own, private instance of the CompoundClassLoader, which will only load classes that exist within the web module. War files have their own private classloader, ensuring that none of the other modules can peek inside the war file for classes they might need.


The classloader instance used by the web module is a sibling of the instance used by the ear. As a result, a web module can see files inside other jars in an ear. However, other modules cannot see classes inside a war. Child classloaders can see classes on the classpath of the parent. A parent cannot see classes on the classpath of a child.
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Are you familiar with the concept of class loaders in general - what they do, and where it makes sense to use a special one?

In servlet containers, each web app gets its own class loader. That ensures that class "X" in web app "A" is different from class "X" in web app "B". That means, amongst other things, that any static field of class "X" you set in web app "A" is not reflected in class "X" in web app "B".
 
Joe San
Ranch Hand
Posts: 10198
3
Mac PPC Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks guys!
reply
    Bookmark Topic Watch Topic
  • New Topic