톰캣 클래스로더 계층 구조

서블릿 안에다가

ClassLoader contextCL = Thread.currentThread().getContextClassLoader();
System.out.println(“=============== Thread ClassLoader ================”);
System.out.println(“ContextClassLoader: ” + contextCL);
System.out.println(“Parent Of ContextClassLaoder: ” + contextCL.getParent());
System.out.println(“GrandParent Of ContextClassLaoder: ” + contextCL.getParent().getParent());

System.out.println(“=============== System ClassLoader ================”);
ClassLoader parentCL = ClassLoader.getSystemClassLoader();
System.out.println(“SystemClassLoader: ” + parentCL);
System.out.println(“Parent Of SystemClassLoader: ” + parentCL.getParent());
System.out.println(“GrandParent Of SystemClassLoader: ” + parentCL.getParent().getParent());

이렇게 찍었다. 역시 최고의 디버깅은 sout이지.

결과는..

=============== Thread ClassLoader ================
ContextClassLoader: WebappClassLoader
context:
delegate: false
repositories:
/WEB-INF/classes/
———-> Parent Classloader:
org.apache.catalina.loader.StandardClassLoader@28d47c65

Parent Of ContextClassLaoder: org.apache.catalina.loader.StandardClassLoader@28d47c65
GrandParent Of ContextClassLaoder: sun.misc.Launcher$AppClassLoader@247973e4
=============== System ClassLoader ================
SystemClassLoader: sun.misc.Launcher$AppClassLoader@247973e4
Parent Of SystemClassLoader: sun.misc.Launcher$ExtClassLoader@21a79071
GrandParent Of SystemClassLoader: null

그러하다. 자세한 설명은 생략.

One thought on “톰캣 클래스로더 계층 구조”

Leave a Reply

Your email address will not be published. Required fields are marked *