Starting in 2009, Jevgeni Kabanov, CEO and Founder of ZeroTurnaround, began presenting "Do You Really Get Classloaders?" at Java conferences worldwide, and has given this talk over 30 times in a dozen countries.
In this revised tutorial from Rebel Labs, "Do You Really Get Classloaders" represents a culmination of the research and content that Jevgeni and the team at ZeroTurnaround (especially the developers working on JRebel, a JVM plugin that cleverly loopholes classloaders in order to reload all sorts of code changes without restarting anything) have uncovered in the last 4 years.
In this tour of the Java classloading mechanism, we examine things both from the JVM and developer point-of-view. We will look at typical problems related to classloading and how to solve them. NoClassDefFoundError, LinkageError and many others are symptoms of specific things going wrong that you can usually find and fix. For each problem, we’ll go through an example with a corresponding solution. We’ll also take a look at how and why classloaders leak and how can that be remedied.
And for dessert, we will review how to reload a Java class using a dynamic classloader. To get there we'll see how objects, classes and classloaders are tied to each other and the process required to make changes. We begin with a bird's eye view of the problem, explain the reloading process, and then proceed to a specific example to illustrate typical problems and solutions.