Now at a point when they are describing about webappX classloader they say:
‘As mentioned above, the web application class loader diverges from the default Java delegation model (in accordance with the recommendations in the Servlet Specification, version 2.4, section 9.7.2 Web Application Classloader). When a request to load a class from the web application's WebappX class loader is processed, this class loader will look in the local repositories first, instead of delegating before looking. ‘
So as per my understanding when ever any class within a web application tried to load a resource present within the war file by the means of :
would ask the webappX classloader to load the respective resource , which in turn would look in its repository first (i.e. in the war file ) before asking its parent to look for it. Which I totally understand.
But just couple of lines down in the same document , they say
Therefore, from the perspective of a web application, class or resource loading looks in the following repositories, in this order:
• Bootstrap classes of your JVM
• System class loader classes (described above)
• /WEB-INF/classes of your web application
• /WEB-INF/lib/*.jar of your web application
• Common class loader classes (described above)
Now, I get confused here. How a class loading can have first step as bootstrap. I would be assuming from the perspective of web application class or resource loading should have first step of
/WEB-INF/classes of your web application
And then look into jars and then start going backward.
I am sure Apache document would be right.
Could you someone please clear the confusion I am having .
I think what they are saying is that if you load a class in Tomcat, the WAR's classes in WEB-INF will be scanned before the TOMCAT_HOME/lib classes and therefore override the TOMCAT classes in case of conflict.
In any event, actually obtaining the classloader in a webapp isn't something I'd generally recommend. The request getResource functions are usually a lot simpler to work with.
Customer surveys are for companies who didn't pay proper attention to begin with.