Classloaders are at the core of the Java language. Java EE containers, OSGi, various web frameworks and other tools use classloaders (aka class loaders) heavily. Yet, when something goes wrong with classloading, would you know how to solve it?
Back in 2008, when ZeroTurnaround’s CEO and Founder Jevgeni Kabanov was still long-haired and far less sociable than he is now ;-), a question of Java classloaders and, to put it bluntly, why they cause so many headaches for developers, was starting to get researched and explored. It took about a year to create the beginning content.
Starting in 2009, Jevgeni began presenting “Do You Really Get Classloaders?” at Java conferences worldwide, and has given this talk over 30 times in a dozen countries. Jevgeni has a hard time holding back the excitement of presenting not only the inner workings of Java Classloaders to a large audience of Java developers, but the conceptual side of reloading classes on the JVM.
What you’ll find in “Do You Really Get Classloaders?”
“Do You Really Get Classloaders” represents a culmination of the research and content that Jevgeni and the team at ZeroTurnaround (especially our developers working on JRebel, which 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.