48_test Analysis of an advanced problem of the Class Loader, 48 Loading

Source: Internet
Author: User

48_test Analysis of an advanced problem of the Class Loader, 48 Loading

 

This is an experiment, source code link: http://pan.baidu.com/s/1c0ix9UK password: ssvd

1. Let tomcat load MyServlet

Http: // localhost: 8080/itcastweb/servlet/MyServlet

 

2. Let jvm load MyServlet

Export MyServlet. class to D: \ Program Files \ Java \ jdk1.8.0 \ jre \ lib \ ext \ itcast_web.jar,

ThenExtClassLoaderThe MyServlet. class is loaded,

AndThe classes related to MyServlet must also be loaded by ExtClassLoader.,

And D: \ Program Files \ Java \ jdk1.8.0 \ jre \ lib \ ext path, there is no servlet-api.jar,

If the father BootStrap cannot find and the son ExtClassLoader cannot find HttpSerlvet, an error is thrown.

Http: // localhost: 8080/itcastweb/servlet/MyServlet

Set tomcat_home \Lib \ servlet-api.jarCopy to D: \ Program Files \ Java \Jdk1.8.0 \ jre \ lib \ extMedium,

To let the JVM ExtClassLoader load MySerlvet and related HttpServlet classes.

 

Access again: http: // localhost: 8080/itcastweb/servlet/MyServlet

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.