Welcome to Our Blog

Rebel Labs Tutorial: Do You Really Get Classloaders?

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.

Oliver White

The Head of Rebel Labs for ZeroTurnaround, Oliver was turned from a marketing droid into a real boy in mid-2010 when he joined the team. While not a developer himself, he likes to simply gaze at code when not writing nine-thousand emails a day. Back when he had free time, Oliver liked books, films, dogs, large steaks, staring at large world maps and strolling through the deeply-forested parks of the Czech Republic, where he lives. You can connect with Oliver on LinkedIn.

More Posts - Website - Twitter

  • Sivakumar Kailasam

    Insightful. Great report. Wish you guys would make more such posts.

  • arhan

    Thanks! We will come up with more posts for sure! You might want to check out the Scala adoption guide and Continuous Delivery report released in the same style

  • http://www.facebook.com/hotarugirl Nikki Tomoe

    A fantastic read; well written and easy to understand.
    Classloader problems are like a baptism of fire for Java programmers, it’s nice to have someone explain their fickle nature in a well-presented manner.

  • sandeepbh

    Some developers get confused with ClassNotFoundException which is different from NoClassDefFoundError. This article can be used as reference for the difference between the two. some readers who are new to class loader stuff may want to see:
    various types class loaders

  • JAX Innovation Awards | Most Innovative Java Technology
  • 19th Annual Jolt Productivity Award
  • 2011 Duke's Choice Award
  • EAS Innovator 2011 Competition Winner
  • 2012 Eclipse Community | New Product Showcase Winner
  • 2012 SD Times 100
  • ITL | Breakthrough of the Year