Dependencies to a root modules when creating a dynamic module layer

Alan Bateman Alan.Bateman at oracle.com
Mon May 1 11:41:30 UTC 2017


On 01/05/2017 10:48, Remi Forax wrote:

> Hi all,
> i try to load a kind of dynamic plugin using a ModuleLayer,
> the plugin is wrapped in a module which is loaded dynamically.
> This module has a requires directive to "java.sql" which is part of the 'root' modules.
>
> The problem is that my application do not requires "java.sql" because it do not need it,
> so "java.sql" is not part of the module loaded when the VM is booted,
> then when i load the plugin module
> - either it fails to find the required module java.sql [1]
> - or i try to load java.sql from the ModuleLayer and get an exception because java.sql can not be loaded by the boot classloader
>
>
> I'm sure i've missed something ?
>
There isn't general support for dynamically augmenting the platform 
modules. There is partial support to allow the jdk.management.agent and 
java.instrument modules be dynamically loaded but that's all at this time.

One thing to point out is `--add-modules ALL-DEFAULT` in JEP 261. This 
is motivated by the scenario where a container needs to load 
applications that require additional modules.

-Alan.


More information about the jigsaw-dev mailing list