[ https://issues.apache.org/jira/browse/PDFBOX-5958?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Jason Harrop updated PDFBOX-5958: --------------------------------- Description: This is probably an Eclipse issue more than a PDF Box issue, but I think it is triggered by PDF Box not being properly set up for JPMS (eg no module-info files). In Eclipse at run time (ie running code via a run configuration), I get: {noformat} Exception in thread "main" java.lang.NoSuchMethodError: 'org.apache.fontbox.ttf.TrueTypeFont org.apache.fontbox.ttf.TTFParser.parse(org.apache.pdfbox.io.RandomAccessRead)' at org.apache.pdfbox@3.0.3/org.apache.pdfbox.pdmodel.font.FontMapperImpl.<init>(FontMapperImpl.java:128) at org.apache.pdfbox@3.0.3/org.apache.pdfbox.pdmodel.font.FontMappers$DefaultFontMapper.<clinit>(FontMappers.java:36) at org.apache.pdfbox@3.0.3/org.apache.pdfbox.pdmodel.font.FontMappers.instance(FontMappers.java:48) at org.apache.pdfbox@3.0.3/org.apache.pdfbox.pdmodel.font.PDType1Font.<init>(PDType1Font.java:126) at openhtmltopdf.pdfbox@1.1.24/com.openhtmltopdf.pdfboxout.fontstore.AbstractFontStore$BuiltinFontStore.addCourier(AbstractFontStore.java:55){noformat} The error occurs in Eclipse at run time, because "maven dependencies" are on the classpath, not the modulepath (and there is no obvious way to reconfigure that). The same code runs fine outside Eclipse (with mvn exec:java), since org.apache.pdfbox.io has an Automatic-Module-Name in MANIFEST.MF in the jar, and from that Maven puts it on the modulepath. was: This is probably an Eclipse issue more than a PDF Box issue, but I think it is triggered by PDF Box not being properly set up for JPMS (eg no module-info files). In Eclipse at run time (ie running code via a run configuration), I get: {noformat} Exception in thread "main" java.lang.NoSuchMethodError: 'org.apache.fontbox.ttf.TrueTypeFont org.apache.fontbox.ttf.TTFParser.parse(org.apache.pdfbox.io.RandomAccessRead)' at org.apache.pdfbox@3.0.3/org.apache.pdfbox.pdmodel.font.FontMapperImpl.<init>(FontMapperImpl.java:128) at org.apache.pdfbox@3.0.3/org.apache.pdfbox.pdmodel.font.FontMappers$DefaultFontMapper.<clinit>(FontMappers.java:36) at org.apache.pdfbox@3.0.3/org.apache.pdfbox.pdmodel.font.FontMappers.instance(FontMappers.java:48) at org.apache.pdfbox@3.0.3/org.apache.pdfbox.pdmodel.font.PDType1Font.<init>(PDType1Font.java:126) at openhtmltopdf.pdfbox@1.1.24/com.openhtmltopdf.pdfboxout.fontstore.AbstractFontStore$BuiltinFontStore.addCourier(AbstractFontStore.java:55){noformat} The error occurs in Eclipse at run time, because "maven dependencies" are on the classpath, not the modulepath. The same code runs fine outside Eclipse (with mvn exec:java), since org.apache.pdfbox.io has an Automatic-Module-Name in MANIFEST.MF in the jar, and from that Maven puts it on the modulepath. > pdfbox.io NoSuchMethodError at runtime in Eclipse (with Maven) > -------------------------------------------------------------- > > Key: PDFBOX-5958 > URL: https://issues.apache.org/jira/browse/PDFBOX-5958 > Project: PDFBox > Issue Type: Bug > Components: IO > Affects Versions: 3.0.3 PDFBox > Environment: Eclipse 2024-06 > Reporter: Jason Harrop > Priority: Minor > > This is probably an Eclipse issue more than a PDF Box issue, but I think it > is triggered by PDF Box not being properly set up for JPMS (eg no module-info > files). > In Eclipse at run time (ie running code via a run configuration), I get: > > {noformat} > Exception in thread "main" java.lang.NoSuchMethodError: > 'org.apache.fontbox.ttf.TrueTypeFont > org.apache.fontbox.ttf.TTFParser.parse(org.apache.pdfbox.io.RandomAccessRead)' > at > org.apache.pdfbox@3.0.3/org.apache.pdfbox.pdmodel.font.FontMapperImpl.<init>(FontMapperImpl.java:128) > at > org.apache.pdfbox@3.0.3/org.apache.pdfbox.pdmodel.font.FontMappers$DefaultFontMapper.<clinit>(FontMappers.java:36) > at > org.apache.pdfbox@3.0.3/org.apache.pdfbox.pdmodel.font.FontMappers.instance(FontMappers.java:48) > at > org.apache.pdfbox@3.0.3/org.apache.pdfbox.pdmodel.font.PDType1Font.<init>(PDType1Font.java:126) > at > openhtmltopdf.pdfbox@1.1.24/com.openhtmltopdf.pdfboxout.fontstore.AbstractFontStore$BuiltinFontStore.addCourier(AbstractFontStore.java:55){noformat} > > The error occurs in Eclipse at run time, because "maven dependencies" are on > the classpath, not the modulepath (and there is no obvious way to reconfigure > that). > The same code runs fine outside Eclipse (with mvn exec:java), since > org.apache.pdfbox.io has an Automatic-Module-Name in MANIFEST.MF in the jar, > and from that Maven puts it on the modulepath. > > -- This message was sent by Atlassian Jira (v8.20.10#820010) --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@pdfbox.apache.org For additional commands, e-mail: dev-h...@pdfbox.apache.org