Thread: how tomcat will get reference of the system classloader?

Forum : Miscellaneous   01-12-2016 12:00:00 AM
User Image
Narayana4037

Newbie

Joined: Apr 20, 2017

Points: 100

Threads: 1

Posts: 3

how tomcat will get reference of the system classloader?

| Quote Date : Dec 1, 2016    Views:778    

we are all know custorm class loader design.but see the code here we pass system classloader reference by using Test class.but my question is how tomcat can get the reference ? [code] package com.ccl.beans; public class Test { public static void main(String[] args) throws ClassNotFoundException { // TODO Auto-generated method stub ClassLoader sysloader=Test.class.getClassLoader(); CustomClassloader ccl1=new CustomClassloader(sysloader); Class.forName("com.ccl.beans.Toy",true,ccl1); } } [|code]

tags: java

Comments

User Image
Ranjit3981

Newbie

Joined : Apr 20, 2017

Points : 110

Threads: 4

Posts: 34

Re: how tomcat will get reference of the system classloader?

Reply Date : Dec 1, 2016

[$java] Tomcat have own custom class loaders and all are default child of system class loader and custom class loader can see its own parent class by holding the reference of ClassLoader [:$java]

User Image
Ranjit3981

Newbie

Joined : Apr 20, 2017

Points : 110

Threads: 4

Posts: 34

Re: how tomcat will get reference of the system classloader?

Reply Date : Dec 1, 2016

Hey Narayana.. Tomcat have own custom class loaders and all are by default child of system class loader and custom class loader can see its own parent class by holding the reference of ClassLoader.

User Image
yasmin3935

Newbie

Joined : Apr 20, 2017

Points : 100

Threads: 0

Posts: 35

Re: how tomcat will get reference of the system classloader?

Reply Date : Dec 2, 2016

all the server vendors have provided their own class loaders and all the class loaders provided by servers willbe the child of the sysytem class loaders including our custom class loader also.. and every class loader will hold the reference of its parent class loader ..thats why we deploy our app at a specific place from where the class loader is able to load our class..so in tomcat we place it it webapps folder

Load More

No More Comments