This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 118020 - System (thread context) class loader should refuse to load classes of ambiguous origin
Summary: System (thread context) class loader should refuse to load classes of ambiguo...
Alias: None
Product: platform
Classification: Unclassified
Component: Module System (show other bugs)
Version: 6.x
Hardware: All All
: P3 blocker (vote)
Assignee: Jesse Glick
: 22508 (view as bug list)
Depends on:
Reported: 2007-10-06 23:26 UTC by Jesse Glick
Modified: 2008-12-23 14:22 UTC (History)
4 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Note You need to log in before you can comment on or make changes to this bug.
Description Jesse Glick 2007-10-06 23:26:07 UTC
In the interests of failing early and predictably with a helpful diagnostic message, rather than behaving erratically,
the NB "system" class loader (the default thread context class loader), which is capable of loading classes (and
resources) from all modules, should simply refuse to load a class (or resource) when there would be more than one choice
of module (parent class loader) to load it from. This would save people from cryptic class linkage errors etc. in cases
where a library is present (possibly in different versions) in multiple modules, and some code is calling Thread.gCCL to
load something from this library. Background information is given in wiki (see URL), which would be a good detail
message for the exception. (ClassNotFoundException?)
Comment 1 Jesse Glick 2007-10-16 01:31:50 UTC
Probably too risky to change this behavior in 6.0.
Comment 2 Antonin Nebuzelsky 2008-05-13 15:39:08 UTC
To be evaluated for 6.5.
Comment 3 Jesse Glick 2008-05-14 02:15:22 UTC
Implemented in #a0c528f7976a.
Comment 4 Quality Engineering 2008-05-20 05:21:42 UTC
Integrated into 'main-golden', available in NB_Trunk_Production #206 build
User: Jesse Glick <>
Log: #118020: forbid ambiguous delegation to parent class loaders.
Comment 5 Petr Nejedly 2008-05-20 07:33:50 UTC
You implemented it for all class loaders, not only for the system one, right?
So maybe you'd better guard the additional attempts with an assert to not slow down class loading, though the startup
cache might downplay the impact (for a slight size growth).
Keep in mind that parts of openide are loaded this way...
Comment 6 Jesse Glick 2008-05-20 17:42:30 UTC
There are only a few packages which in fact overlap. Anyway the error is believed not to be thrown in the standard NB
IDE so the main purpose is to assist diagnosis for people using third-party modules, which are most likely to be running
atop an IDE release in which assertions are disabled.
Comment 7 Jesse Glick 2008-06-11 03:02:11 UTC
*** Issue 22508 has been marked as a duplicate of this issue. ***
Comment 8 Quality Engineering 2008-12-23 14:22:37 UTC
This issue had *4 votes* before move to platform component