• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

classloader and deployment descriptor.

 
Andles Jurgen
Ranch Hand
Posts: 67
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
RE: The following statement from the servlet specs
The web application classloader must load classes from the WEB-INF/Classes first, then from library jars in WEB-INF/lib.
Can somebody please explain the main implications of this "order of loading".
Also, are all the classes loaded as soon as the applcation starts? Surely not.
I think I am missing the whole point of classloading here.
Thanks in advance.
Andles
SCJP2
 
Axel Janssen
Ranch Hand
Posts: 2166
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Andles Jurgen:
RE: The following statement from the servlet specs
The web application classloader must load classes from the WEB-INF/Classes first, then from library jars in WEB-INF/lib.

Hi Andles,
the order in which classes are loaded is important, if you have classes with the same fully qualified name but with different content in your classes and your lib directory. In that case jvm takes the first.

Axel
 
Peter den Haan
author
Ranch Hand
Posts: 3252
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There's another - slightly more subtle and vastly more useful - consequence. If any of the jars contains a .properties file with configuration information, you can override this .properties file by dropping a copy in the classes directory.
- Peter
 
Andles Jurgen
Ranch Hand
Posts: 67
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks guys - that clears that one up nice and easy.
Thanks.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic