-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 Hi Alan.
> 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. The code was the same for both: ClassLoader loader = new ModuleClassLoader(configuration); After your mail I changed it for the second layer so it uses the first layer's ModuleClassLoader. Now everything works like a charm. Thx! Follow up question: In this case I constructed the first layer myself and only used one class loader for it, which I hence had readily available to pass to the second layer. What happens if this is not the case? I know about 'Layer.findLoader' but how would I choose a loader for the second layer? E.g. if I used several loaders or the first layer or did not even create it myself and have no idea which and how many loaders it contains. > 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. That makes sense, thanks. so long ... Nicolai On 12.10.2015 23:24, Alan Bateman wrote: > > > 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. > > -Alan. > - -- PGP Key: http://keys.gnupg.net/pks/lookup?op=vindex&search=0xCA3BAD2E9CCCD509 Web: http://codefx.org a blog about software development http://do-foss.de Free and Open Source Software for the City of Dortmund Twitter: https://twitter.com/nipafx Diaspora: n...@pod.geraspora.de -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJWHMfUAAoJEMo7rS6czNUJ0Z8QAJkl/y86G7mUj6cSnruuFmIl 54bME/aAWN5ljpQW6/Zexdy7CgRtSOipQBo2uxYUzO56mU17l7b+sigBtDTj7h/3 i1I4e6cyubKWTWWZ3tJFltRJJXEnz5v5Ey15v7mopepm9v0dsP3HDjDHzTJSpOmX BvHIdUSS7qmqU+U3IePPI51sTPGv/JjgC/chYxCZgZ1Nzl6j+Rp4vuUSRbzAbNg6 jyVNId8MRr32LRumgmcdQhOe6unrzNLaqElu89CyKkx/M885T2xaYpLTlqIPxAEV dFRzvVGcM/vKX/iuqG42yUyqkI133T4YFp1yZxTjT3/9HajJ6uepFPR5UaILIawY /VTg1n1ibawxzv2Lv0CEc/qq9qGJmEDe+wIDmYLfNhgNn9ZmNMrHEuFGjCp/DxBE lBhtPu4/3/aNvAxWPAUTn0pxGCBsefZOz8EoeJJTwvwick8TuuN+DS7YBUucwoCZ Cq8i8wJS/ygwIzQy3TzBd/CKfnn4r8AHc/Iabg3vYtwB4rxBniafXsSXjdk2Uot+ ycis3qNrv5dFi8YPBqM29mKQdHbstYOr0EPGIMBdyPDDfG+nX9qZ5uN4411xsQf7 4bzfEUvz5sCcorE28dV63e+QVsNyPQ6mjya8dPULJhRY61A3TQXZRUuGmd+9YVFM FnGcuzoCyR95qj4NQt7p =K4+T -----END PGP SIGNATURE-----