gdcc / exporter-ddipdf

Provides a PDF format for the DDI metadata
Apache License 2.0
0 stars 2 forks source link

Export fails with NoClassDefFoundError: org/apache/fop/apps/FopFactory #3

Open vera opened 2 months ago

vera commented 2 months ago

When I try to reexport a dataset's metadata after installing the ddipdf exporter jar, the export is not created and I get the following error in the Dataverse log:

dev_dataverse> [#|2024-08-13T10:13:32.165+0000|INFO|Payara 6.2024.6|edu.harvard.iq.dataverse.DatasetServiceBean|_ThreadID=269;_ThreadName=__ejb-thread-pool1;_TimeMillis=1723544012165;_LevelValue=800;|
dev_dataverse>   Error exporting dataset: ...; org/apache/fop/apps/FopFactory
dev_dataverse> jakarta.ejb.EJBException: org/apache/fop/apps/FopFactory
dev_dataverse>  at com.sun.ejb.containers.EJBContainerTransactionManager.processSystemException(EJBContainerTransactionManager.java:723)
dev_dataverse>  at com.sun.ejb.containers.EJBContainerTransactionManager.completeNewTx(EJBContainerTransactionManager.java:652)
dev_dataverse>  at com.sun.ejb.containers.EJBContainerTransactionManager.postInvokeTx(EJBContainerTransactionManager.java:492)
dev_dataverse>  at com.sun.ejb.containers.BaseContainer.postInvokeTx(BaseContainer.java:4601)
dev_dataverse>  at com.sun.ejb.containers.BaseContainer.postInvoke(BaseContainer.java:2134)
dev_dataverse>  at com.sun.ejb.containers.BaseContainer.postInvoke(BaseContainer.java:2104)
dev_dataverse>  at com.sun.ejb.containers.EJBLocalObjectInvocationHandler.invoke(EJBLocalObjectInvocationHandler.java:220)
dev_dataverse>  at com.sun.ejb.containers.EJBLocalObjectInvocationHandlerDelegate.invoke(EJBLocalObjectInvocationHandlerDelegate.java:90)
dev_dataverse>  at jdk.proxy73/jdk.proxy73.$Proxy417.exportAllFormatsInNewTransaction(Unknown Source)
dev_dataverse>  at edu.harvard.iq.dataverse.harvest.server.__EJB31_Generated__OAIRecordServiceBean__Intf____Bean__.exportAllFormatsInNewTransaction(Unknown Source)
dev_dataverse>  at edu.harvard.iq.dataverse.DatasetServiceBean.exportDataset(DatasetServiceBean.java:785)
dev_dataverse>  at edu.harvard.iq.dataverse.DatasetServiceBean.reExportDatasetAsync(DatasetServiceBean.java:770)
...
dev_dataverse> Caused by: java.lang.NoClassDefFoundError: org/apache/fop/apps/FopFactory
dev_dataverse>  at io.gdcc.export.ddipdf.DdiPdfExportUtil.datasetPdfDDI(DdiPdfExportUtil.java:34)

Dataverse is running in Docker (mvn -Pct clean package docker:run). Not sure if I made a mistake installing the jar. Thanks in advance for your assistance

qqmyers commented 2 months ago

FWIW: Looks like somewhere in the pom file changes we lost including the dependency on fop in the final jar.

pdurbin commented 2 months ago

I'm getting a different error:

dev_dataverse> [#|2024-08-23T18:41:58.868+0000|INFO|Payara 6.2024.6|io.gdcc.export.ddipdf.FileResolver|_ThreadID=128;_ThreadName=http-thread-pool::http-listener-1(5);_TimeMillis=1724438518868;_LevelValue=800;|
dev_dataverse>   In File Resolver: file:/io/gdcc/spi/export/ddipdf/i18n.inc.xsl null|#]
dev_dataverse> 
dev_dataverse> [#|2024-08-23T18:41:58.894+0000|SEVERE|Payara 6.2024.6|io.gdcc.export.ddipdf.DdiPdfExportUtil|_ThreadID=128;_ThreadName=http-thread-pool::http-listener-1(5);_TimeMillis=1724438518894;_LevelValue=1000;|
dev_dataverse>   Cannot invoke "String.length()" because "<parameter2>" is null|#]

In Firefox, it looks like an empty PDF is created? I'm not sure:

Screenshot 2024-08-23 at 2 42 27 PM

I had to build the JAR myself. It would be nice to have a link to a released JAR like we do for other exporters instead of "TBD": https://github.com/gdcc/dataverse-exporters#list-of-known-exporters

qqmyers commented 1 week ago

FWIW: If I build using mvn assembly:assembly -DdescriptorId=jar-with-dependencies, I get a ./target/ddi-pdf-1.1.0-SNAPSHOT-jar-with-dependencies.jar file (building from PR #4) Just doing a mvn deploy only created a ddi-pdf-1.1.0-SNAPSHOT.jar w/o the classes from the dependencies.

So - I guess a 'fix' for this would be to document the build process in the README