commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Aaron Hughes <>
Subject [discovery] Discovery assumes/requires .class file must be present in order to get default Class?
Date Sat, 18 Jun 2005 00:55:26 GMT

  It appears that Discovery assumes [requires] that the corresponding
.class file be available from the ClassLoader to obtain a default


  When a DefaultClassHolder is created by passing a (String)
defaultName to the constructor, and a subsequent call to
getDefaultClass(SPInterface spi, ClassLoaders loaders) is made, it
procedes to use DiscoverClasses to try and find the appropriate Class
file to return.

  Unfortunately, DiscoverClasses uses
DiscoverClasses.findResourceClasses(final String className) to find
the class using:

  URL url = loader.getResource(resourceName);

  The problem is that loader.getResource(String name) searches for the
actual .class file residing somewhere accessable to the ClassLoader.
If the Class is available, resolvable, etc... but no .class file
(resource) is available this whole process fails.


  loader.loadClass(className) can return a Class object

  loader.getResource(className) can return null.

  I'm not familiar enough with the code base to know if there is
something special about why loader.getResource() is being used as
opposed to loadClass().

  Does anyone have any insight to this? 

  I've made local modifications to
DefaultClassHolder.getDefaultClass() so that after attempting a find
using loader.getResource(), it iterates through the loaders, and uses
loader.loadClass(). I'm just not sure if this is the correct means, or
location to resolve the issue.

 Any insight would be greatly appreciated.


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message