Layers and NoClassDefFoundError

Alan Bateman Alan.Bateman at oracle.com
Tue Oct 13 13:29:17 UTC 2015



On 13/10/2015 13:49, Peter Levart wrote:
>
> I don't know for sure, but I see a Layer as a combination of 2 aspects 
> that have to be soundly aligned:
>
> - readability graph of modules
> - delegation of class-loaders
Yes, that's right and getting the readability and visibility aligned is 
very much the sophisticated application.

I expect in time that the API will improve to make it easier for the 
common-case, this might mean ModuleClassLoader goes away and maybe 
Layer.create will just create the class loader or pool of loaders as 
needed. Pointy-heads will still need to map modules to class loaders 
with their own class loaders of course.


> :
>
> For example. You could choose extension class-loader as the parent of 
> your child loader in the child of boot layer, but then modules loaded 
> by child loader would not be able to depend on modules loaded by 
> system class loader (the app class loader).
Just on this example then I should mention (and I realize it's off-topic 
for this thread) that the class loaders that comprise the boot layer do 
direct delegation for types in named modules. So if you ask the 
extension loader to load a type in a module defined to the app class 
loader then it will be loaded with the app class loader as the defining 
loader. The main use case for this is upgradeable modules but it gives 
us a bit of flexibility when mapping platform modules to loaders too. 
The traditional parent-first delegation continues to work as before for 
unnamed modules (class path, -Xbootclasspath/a).

-Alan


More information about the jigsaw-dev mailing list