I am trying to run a Java-11 application using fop from apache xmlgraphics.
The failure message
Error occurred during initialization of boot layer
java.lang.module.ResolutionException: Modules xml.apis and java.xml export package javax.xml.parsers to module junit
appears when I start the application with something like
java -p $modulepath -m module/package.App
My understanding of the message is: there are two required modules exporting the same package, which is not allowed. Right?
This is not the first time I got that message. Others I could repair by adding <exclusion/>
with regarding groupId and artifactId to dependency specifications in pom.xml. So far
<dependency>
<groupId>org.apache.xmlgraphics</groupId>
<artifactId>fop</artifactId>
<version>2.6</version>
<exclusions>
<exclusion>
<groupId>xalan</groupId>
<artifactId>serializer</artifactId>
</exclusion>
<exclusion>
<groupId>xalan</groupId>
<artifactId>xalan</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.xmlgraphics</groupId>
<artifactId>batik-script</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.xmlgraphics</groupId>
<artifactId>fop-util</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.xmlgraphics</groupId>
<artifactId>fop-core</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.xmlgraphics</groupId>
<artifactId>fop-events</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.xmlgraphics</groupId>
<artifactId>xmlgraphics-commons</artifactId>
<version>2.6</version>
</dependency>
But with this message I do not know how to find out, which of my dependencies drags xml.apis and java.xml to my application.
Is adding <exclusion/>
the right direction to go solving that problem?
If so, is there a way to find out recursively which of the applications dependencies exactly depends on java.xml and xml.apis?
Note: The Dependency Hierarchie of Eclipse/m2e does not show xml.apis or java.xml.
Full pom.xml