Layers and NoClassDefFoundError

Alan Bateman Alan.Bateman at
Mon Oct 12 21:24:18 UTC 2015

On 12/10/2015 21:44, Nicolai Parlog wrote:
> :
> For the first layer 'parentLayer' is 'Layer.boot()', for the second
> it's the first.
Can you paste in the code that creates the ModuleClassLoader for the 
second Layer? I'm curious to see if you have used the 2-arg constructor 
to specify the first as the parent.

> Then I add a read edge from the module that runs all this to the one
> in the second layer that contains the code I actually want to execute.
> Finally I access the code I actually want to run (in the second layer)
> and invoke it. I then get a NoClassDefFoundError for a class that is
> present in the first layer.
> I tried adapting the 'parentLayer' to be used as the 'beforeFinder' in
> 'Configuration.resolve' instead of 'ModuleFinder.empty()' but that
> gave me a 'LayerInstantiationException' ("Module java.base is already
> defined").

The beforeFinder is for overriding a module with a different version. It 
sounds like you have ended up trying to override the modules in the boot 
layer and you probably don't want to do that.


More information about the jigsaw-dev mailing list