Force JPMS to add module to boot layer

Alan Bateman Alan.Bateman at oracle.com
Tue Jun 23 16:01:49 UTC 2020


On 22/06/2020 18:15, Alex Orlov wrote:
> Hi Alan,
> Thank you very much for your answer. In order to be concrete a test 
> project was created
> and it is here https://github.com/PashaTurok/hibernate-h2-test4
> Besides, if it is not very difficult for you, could you answer 
> separately to
> each questions (# 1 and #2). So, I repeat them again:
> 1) Is it possible to force JPMS to add modules even if it think that 
> they won’t be used
> (by the way — nobody asks it).
> 2) As I understand this problem doesn’t appear when we create child 
> layer and add any jars to it.
> In this case JPMS doesn’t ignore any modules. Is this statement right?
>
java.lang.NoClassDefFoundError: 
net/bytebuddy/NamingStrategy$SuffixingRandom$BaseNameResolver
     at 
org.hibernate.cfg.Environment.buildBytecodeProvider(Environment.java:345) 
~[hibernate-core-5.4.15.Final.jar:?]
     at 
org.hibernate.cfg.Environment.buildBytecodeProvider(Environment.java:337) 
~[hibernate-core-5.4.15.Final.jar:?]
     at org.hibernate.cfg.Environment.<clinit>(Environment.java:230) 
~[hibernate-core-5.4.15.Final.jar:?]

 From what I can establish, org.hibernate.orm.core is an automatic 
module so it doesn't have any way to `requires net.bytebuddy` (an 
explicit module). You'll have to help out by adding `--add-modules 
net.bytebuddy` to the command line that surefire or failsafe uses.

I can't explain why you don't see issues when you use module layers. It 
is possible that you've specified "net.bytebuddy" in the list of root 
modules that you specify to the resolve method?

-Alan


More information about the jigsaw-dev mailing list