-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 Hi,
I am currently experimenting with layers and running into NoClassDefFoundErrors. Maybe someone on the list can help me out. I create one layer on top of the boot layer and a second one on top of the first. The second contains code that references a class from the first. As I understand SOTMS[1] this should work. But it doesn't and when I execute code in the second layer I get a NoClassDefFoundError. In a little more detail... I verified that all classes that are accessed across module boundaries are exported. The individual modules correctly state their dependencies on other modules. This is how I create both layers (inspired by the Javadoc on java.lang.reflect.Layer): ModuleFinder finder = ModuleFinder.of(modulePaths); Configuration configuration = Configuration.resolve( ModuleFinder.empty(), parentLayer, finder, moduleNames); ClassLoader loader = new ModuleClassLoader(configuration); return Layer.create( configuration, moduleName -> loader); For the first layer 'parentLayer' is 'Layer.boot()', for the second it's the first. 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"). Where did I get it wrong? Thanks in advance Nicolai [1] last paragraph: http://openjdk.java.net/projects/jigsaw/spec/sotms/#layers - -- 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 iQIcBAEBCAAGBQJWHBuyAAoJEMo7rS6czNUJ230QAL4D/cYqOUJONErKVt6Kya6c V/Z0fWUVjkyiy+PMLqukQK9XxHUeg41g/SYbJZ7WoXSwletqQNrkd2G3PyQiV5pQ ZLOQVYfxiOcKvntaCSeOV82nvkGT2kdvcsixIxUFhC6HRBs6tp0ktd06VdWAc3Eb FGxwCLuOLj+aT8Hw+Pot3O4SbIa+eGK7Gxf86ao1mnm+1VygxeUwKGymQCSKRUu5 zItHjOIU1lVG6BOM3H+hICxGc3tjkqRU0T1yugeehh1Le83kScaeO1TaFR/x9lcO BRr+IxwHTzhd/78H6e6baBnYCOdw2/99o+Ok61sGBIAwcwtV5VjGWuiDOfczi/ww jH4yusQEX9cV2WmfLXCXhOSAhlUvPWzeFK6SYDAkJnyS0CVs649x3frSx0n4yJDt U0GIkT0erZ6nSvBLEhcKPyK4bO6bCaGgalnzMaFmrwbxQOmwuQZgySw1tu/9Tjz/ eVB8xuhH1CjzJ3To+nx0tneYxQ6ZlUXAmrMvXWMbndVJA87e8zQIrxF8Rtq00y+x 9cYqqc5DU7ZNqTukWEZfXlsnoIb6kRTAhNxWcrmcnunI697+qBPQekM8fT5yHhT+ URXjDpId0Q7SWB7OjfAzr6Jse8KksBoxGbHW5sUwSJL3bIONRKunJpD2gPOOWTZG iOyfwvPotmlUOTOkhypg =ecE9 -----END PGP SIGNATURE-----