Filtering Classloader for Java Version Isolation

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

The existing Java classloader hierarchy restricts application developers from using different versions of third-party JARs for different applications, as it follows a delegation model that requires class loaders to first ask their parent before loading a class, limiting flexibility and causing potential linkage errors when different versions are used.

Innovation Solution

A filtering classloader is introduced between the system and application classloaders, which throws a 'class not found exception' for specified patterns, allowing the application classloader to load classes independently, thus overriding retrieval from the system classloader and enabling the use of different class versions.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Reliability

If the delegation model is used where classloaders must ask parent classloaders before loading classes, then class loading consistency and avoidance of multiple copies are improved, but application flexibility and ability to use different versions of third-party JARs are worsened

Engineering Contradiction:
Improveclass loading consistencyVSAvoidapplication flexibility
Core Design Contradiction:
ReliabilityVSAdaptability or versatility

Solution Approach 1:

A filtering classloader is introduced as an intermediary between the system classloader and application classloader. This filtering classloader receives class loading requests from the application classloader and selectively blocks requests for specific patterns (e.g., third-party JAR classes), allowing the application to use different versions of these classes without violating the delegation model's consistency requirements.

Inventive Principle:
Principle #24Intermediary (Mediator)

2Adaptability or versatility

If a filtering classloader is introduced to allow different class versions, then application flexibility is improved, but classloader hierarchy complexity is worsened

Engineering Contradiction:
Improveapplication flexibilityVSAvoidclassloader hierarchy complexity
Core Design Contradiction:
Adaptability or versatilityVSDevice complexity

Solution Approach 1:

The filtering classloader is implemented as a separate, independent component within the classloader hierarchy. It segments the class loading function by handling only specific patterns of class requests, while allowing other requests to pass through to the system classloader. This segmentation enables flexibility without requiring complete redesign of the entire classloader hierarchy.

Inventive Principle:
Principle #1Segmentation

Data Source

PatentUS8196128B2System and method for providing a filtering classloader in a computer environment
Publication Date: 2012.06.05 ORACLE INT CORP
  • US8196128B2 patent drawing
  • US8196128B2 patent drawing
  • US8196128B2 patent drawing

AI summary

A system and method for providing a filtering classloader within a Java-based or other application environment. In one embodiment, a filtering classloader is placed between two other classloaders, e.g. between the system classloader and the application classloader. The filtering classloader is provided with a set of patterns which throw a “class not found exception” if an application makes a request for that class or package. The exception leads the application classloader to believe (perhaps correctly) that there is no class with that name in the system classloader. The application classloader then loads the class itself. The class may or may not exist in the system classloader; the filtering classloader in essence overrides any retrieval from that classloader in favor of the application classloader, for certain specified patterns of request.