5

I can run my IBM Notes agent locally without error, however when I run the agent on the server I get the following error.

LS2J Error: Threw java.lang.NoClassDefFoundError: org.apache.pdfbox.pdmodel.PDDocument in procedure GETTEMPLATE, line 79

My LotusScript agent calls a java class using LS2J. The java class using the following libraries:

import java.io.File;
import org.apache.pdfbox.pdmodel.PDDocument;
import org.apache.pdfbox.pdmodel.PDDocumentCatalog;
import org.apache.pdfbox.pdmodel.interactive.form.PDAcroForm;
import org.apache.pdfbox.pdmodel.interactive.form.PDField;
import org.w3c.dom.Document;
import org.w3c.dom.*;

import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.DocumentBuilder;
import org.xml.sax.SAXException;
import org.xml.sax.SAXParseException; 

I have had the following JAR files added to to Domino server, and had it restarted.

pdfbox-1.8.jar,
commons-lang-2.1.jar,
commons-logging-1.2.jar

Are there other JAR files I need copied to: \notes\jvm\lib\ext or is there something else wrong?

Knut Herrmann
  • 30,880
  • 4
  • 31
  • 67
PN03
  • 85
  • 9

1 Answers1

1

There are two ways to get it to run on server:

  • specify variable JavaUserClasses (or JavaUserClassesExt) in server's notes.ini like
    JavaUserClasses=C:\...\jvm\lib\ext
    and restart server or
  • create a Script Library of type Java, import the jars as Archives and "use" the Script Library in Lotus Script code
    Use "pdfBox"

    enter image description here

Knut Herrmann
  • 30,880
  • 4
  • 31
  • 67
  • I added the following jars (imported archive, then attached source) to my java script library (which also includes the java class I am using to process the PDFs) **commons-logging-1.2.jar, fontbox-1.8.8.jar and pdfbox-app-1.8.9.jar**. however now I get a different error.. '**Agent error: java.lang.NoClassDefFoundError: org.apache.pdfbox.pdmodel.font.PDType1Font (initialization failure)**' – PN03 May 28 '15 at 14:27
  • You have to include **pdfbox-1.8.9.jar** (probably instead of pdfbox-app-1.8.9.jar) – Knut Herrmann May 28 '15 at 14:50
  • I added the jar files, including pdfbox-1.8.9. jar to the web-inf/lib folder in the .NSF. then right clicked them and to add them to the build path. I am getting error **LS2J Error: Threw java.lang.NoClassDefFoundError: org.apache.pdfbox.pdmodel.PDDocument** – PN03 May 28 '15 at 16:04
  • You have to add pdfbox-1.8.9.jar to Java Scriptlibrary's Archive section like shown in picture above. – Knut Herrmann May 28 '15 at 16:11
  • BTW web-inf/lib folder is ignored by Java agents (or LotusScript agents calling Java parts by LS2J). It's only used by XPages Java code. – Knut Herrmann May 28 '15 at 16:13
  • @KnutHerrmann same problem here, with pdfbox-2.0.25 and fontbox-2.0.25 (and commons-logging). What am I missing? – D.Bugger Jan 23 '23 at 13:47
  • This seems related: https://mvnrepository.com/artifact/org.apache.pdfbox/fontbox/2.0.14 – D.Bugger Jan 23 '23 at 14:27