Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

why do we need user defined classloader in java

Tags:

java

why tomcat has its own classloader. what is the advantage of having user defined classloader

like image 425
Dead Programmer Avatar asked Aug 23 '10 17:08

Dead Programmer


1 Answers

It isolates the various webapplications deployed into the container; that is, the behaviour of a webapplication will not be affected by (un)deploying another webapplication.

Each webapp only sees its own classes, not those provided by the other applications. This allows different webapps to use different versions of the same class. Deploying several webapplications would be a nightmare without that isolation.

Similarly, OSGI bundles get their own class loaders so different bundles can use different versions of the same plugin. Again, this isolation makes it less likely that adding a plugin (with its depedent libraries) will affect the other plugins in the system.

like image 127
meriton Avatar answered Sep 23 '22 13:09

meriton