java - 怎么让tomcat使用我自定义的类加载器?
PHP中文网
PHP中文网 2017-04-17 17:44:59
0
2
337

要对web项目的class文件进行混淆,请问在哪配置可以让tomcat先使用自定义的类加载器?

PHP中文网
PHP中文网

认证高级PHP讲师

reply all(2)
洪涛

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.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!