The description of the problem is not very clear But I can briefly explain the class loading to you a.Bootstrap ClassLoader/Boot class loader It is mainly responsible for the core api in the jdk_home/lib directory or the jar package specified by the -Xbootclasspath option. b.Extension ClassLoader/Extension Class Loader Mainly responsible for the jar package in the jdk_home/lib/ext directory or the jar package in the directory specified by -Djava.ext.dirs c.System ClassLoader/System Class Loader Mainly responsible for java -classpath/-The classes and jar packages in the directory pointed to by Djava.class.path are included in the work. d.User Custom ClassLoader/User-defined class loader (a subclass of java.lang.ClassLoader) When the program is running During this period, the class file is dynamically loaded through the subclass of java.lang.ClassLoader, reflecting the dynamic real-time class loading feature of java
Tomcat uses WebappClassLoader to load the app, but I don’t see server.xml opening this interface. If you want to replace it, you need to modify the tomcat source code.
There is also a better solution, use java agent to dynamically replace the class, so that the class can be encrypted and decrypted.
The description of the problem is not very clear
But I can briefly explain the class loading to you
a.Bootstrap ClassLoader/Boot class loader
It is mainly responsible for the core api in the jdk_home/lib directory or the jar package specified by the -Xbootclasspath option.
b.Extension ClassLoader/Extension Class Loader
Mainly responsible for the jar package in the jdk_home/lib/ext directory or the jar package in the directory specified by -Djava.ext.dirs
c.System ClassLoader/System Class Loader
Mainly responsible for java -classpath/-The classes and jar packages in the directory pointed to by Djava.class.path are included in the work.
d.User Custom ClassLoader/User-defined class loader (a subclass of java.lang.ClassLoader)
When the program is running During this period, the class file is dynamically loaded through the subclass of java.lang.ClassLoader, reflecting the dynamic real-time class loading feature of java
Tomcat uses WebappClassLoader to load the app, but I don’t see server.xml opening this interface. If you want to replace it, you need to modify the tomcat source code.
There is also a better solution, use java agent to dynamically replace the class, so that the class can be encrypted and decrypted.