Java Module system problem

307 views
Skip to first unread message

Joey Comhaire

unread,
Nov 18, 2019, 9:48:10 AM11/18/19
to Flying Saucer Users
Hi

I'm using Flying Saucer in one of my projects to generate pdf files. We are using Java 12 and I came across a modularity problem with the flying-saucer dependencies.

For some reason org.xhtmlrenderer.simple is exported by both flying.saucer.pdf.itext5 and flying.saucer.core.

Error:java: module java.xml.bind reads package org.xhtmlrenderer.simple from both flying.saucer.pdf.itext5 and flying.saucer.core

If you look in the pom of flying.saucer.pdf.itext5 you can find something like: 

<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<executions>
<execution>
<id>bundle-manifest</id>
<phase>process-classes</phase>
<goals>
<goal>manifest</goal>
</goals>
</execution>
</executions>
<configuration>
<instructions>
<Bundle-SymbolicName>org.xhtmlrenderer.flying.saucer.pdf.itext5</Bundle-SymbolicName>
<Bundle-Version>${project.version}</Bundle-Version>
<!-- Dependency resolution seems not to work properly with default
behavior of importing the exported packages. -->
<Import-Package>!org.xhtmlrenderer.*,*</Import-Package>
<!-- Do not export package org.xhtmlrenderer.simple as it is
already exported by flying-saucer-core and this would lead to a split package
without correctly marking it as such. -->
<Export-Package>!org.xhtmlrenderer.simple,org.xhtmlrenderer.*</Export-Package>
</instructions>
</configuration>
</plugin>

But looks like this doesn't help.


Any suggestions how to fix this?

Greetings.
Joey

Mary Bortes

unread,
Nov 29, 2019, 7:38:18 PM11/29/19
to Flying Saucer Users
Same issue using java 13:

Error occurred during initialization of boot layer
java.lang.module.ResolutionException: Modules flying.saucer.pdf.openpdf and flying.saucer.core export package org.xhtmlrenderer.simple to module org.slf4j.

The cause seems to be the unfortunate naming of the package containing the PDFRenderer class: org.xhtmlrenderer.simple. The org.xhtmlrenderer.simple package is used in flying-saucer-core to store various xhtml related rendering classes, while the PDFRenderer in the flying-saucer-pdf-*.jar seems to be just a wrapper over ITextRenderer.

Moving the PDFRenderer to the org.xhtmlrenderer.pdf package or removing it from the flying-saucer-pdf-*.jar (together with its containing package) would solve the issue.
Reply all
Reply to author
Forward
0 new messages