java - 怎么获得tomcat中类加载器的实例
PHPz
PHPz 2017-04-17 17:47:57
0
1
191

<?xml version="1.0" encoding="GBK"?>
<Context>
<Loader className="org.apache.catalina.loader.VirtualWebappLoader" virtualClasspath="../yydcontextlib/*.jar"/>
</Context>

比如这里配置了一个用于加载第三方库的加载器,我怎么能获得这个类加载器的实例?

<?xml version="1.0" encoding="GBK"?>
<Context>
<Loader className="org.apache.catalina.loader.VirtualWebappLoader" virtualClasspath="../gnntcontextlib/*.jar"/>
<Loader loaderClass="yyd.classloader.MyClassLoader"/>
</Context>

PHPz
PHPz

学习是最好的投资!

reply all(1)
PHPzhong

You can new any class in that third-party library, and then use Class.getClassLoader() of that class to get the class loader that loads this class.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template