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. There are exceptions. Classes which are part of the JRE base classes cannot be overridden. For some classes (such as the XML parser components in J2SE 1.4+), the J2SE 1.4 endorsed feature can be used. Last, any JAR file that contains Servlet API classes will be explicitly ignored by the classloader — Do not include such JARs in your web application. All other class loaders in Tomcat follow the usual delegation pattern.
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
- /WEB-INF/classes of your web application
- /WEB-INF/lib/*.jar of your web application
- System class loader classes (described above)
- Common class loader classes (described above)
If the web application class loader is configured with <Loader delegate="true"/>
then the order becomes:
- Bootstrap classes of your JVM
- System class loader classes (described above)
- Common class loader classes (described above)
- /WEB-INF/classes of your web application
- /WEB-INF/lib/*.jar of your web application
相关推荐
Tomcat研究之ClassLoader.pdf 请大家抓紧下载吧,呵呵
可以将CLASS文件加密,用反编译工具反编译不过来. 不是混淆器,是加密.比混淆器好很多. ...agentlib:c:\windows\classloader %JAVA_OPTS%,保存setenv.bat文件,重新启动Tomcat后就可以正确加载加密类了。
Tomcat's WebappClassLoader is currently not instrumentable, so Spring provides a custom ClassLoader that can be used by placing spring-instrument-tomcat.jar in $TOMCAT_HOME/lib and putting a loader ...
Java 虚拟机中ClassLoader 相关简介 双亲委托机制 Android 中ClassLoader 简介
661.659.JAVA基础教程_动态代理与Java8新特性-复习:ClassLoader(661).rar
3-7Tomcat中自定义类加载器的使用与源码实现(1).mp4
NULL 博文链接:https://davyjones2010.iteye.com/blog/2222811
NULL 博文链接:https://davyjones2010.iteye.com/blog/2226286
NULL 博文链接:https://yjhexy.iteye.com/blog/668334
FakeClassloader 替换classloader,完成全局代理,可代理接口、private方法、final方法及final类
Bootstrap ClassLoader是顶层的ClassLoader,它比较特殊,是用C++编写集成在JVM中的,是JVM启动的时候用来加载一些核心类的,比如:rt.jar,resources.jar,charsets.jar,jce.jar等,可以运行下面代码看都有哪些...
ClassLoader动态加载类 简单示例 包装tank.test; 导入java.util.Scanner; 导入tank.classloader.ClassLoaderManager; 导入tank.classloader.MyClassLoaderManager; 导入tank.classloader.SystemClassLoaderManager...