September 24, 201510 yr Hi everybody I have an error using scriptmaster 4.42 release when I try to convert a pdf file into text. I have no problem with 4.201 release. The function reurns ERROR and SMLastError is set as "java.lang.NoClassDefFoundError: org/bouncycastle/cms/Recipient" My function is defined as "import java.io.IOException" & ¶ &"import com.itextpdf.text.pdf.PdfReader" & ¶ &"import com.itextpdf.text.pdf.parser.PdfTextExtractor" & ¶ &¶ &"if( fm_filePath == null ){ throw new Exception(\"File path required !\")}" & ¶ &"if (new File( fm_filePath ).exists()){" & ¶ &" try{" & ¶ &" reader = new PdfReader(fm_filePath)" & ¶ &" sb = new StringBuffer()" & ¶ &" for (int i = 1; i <= reader.numberOfPages; i++) {" & ¶ &" sb.append(PdfTextExtractor.getTextFromPage(reader, i))" & ¶ &" }" & ¶ &" return sb " & ¶ &" } catch (IOException e) {" & ¶ &" e.printStackTrace()" & ¶ &" return \"IO ERROR.\"" & ¶ &" } catch (Exception e) {" & ¶ &" e.printStackTrace()" & ¶ &" return \"ERROR.\"" & ¶ &" }" & ¶ &"}" Starting from SMLastError I added bouncycastle jar in my filemaker solution. No change, so I tried to add as well such as import steps : "import java.io.*" & ¶ &"import java.util.*" & ¶ &"import java.security.*" & ¶ & "import org.bouncycastle.jce.provider.BouncyCastleProvider" & ¶ & I found these steps on other forums, but without any documentation, it looks like fishing... One thing changes : when I use "import org.bouncycastle.jce.provider.BouncyCastleProvider" SMLastError becomes java.lang.NoClassDefFoundError: org/bouncycastle/cms/RecipientId instead of java.lang.NoClassDefFoundError: org/bouncycastle/cms/Recipient Thanks in advance Olivier
September 24, 201510 yr Olivier, this is showing up in ScriptMaster 4.42 because we updated to a newer version of Groovy in newer versions. If you include both the provider jar and the CMS jar (bcprov-jdk15on-152.jar and bcpkix-jdk15on-152.jar), which you can download from https://www.bouncycastle.org/latest_releases.html , this should work correctly. Let me know if you have any trouble!
September 24, 201510 yr You don't need to alter the code to explicitly call the bouncy castle jars, it is just that PdfReader uses them to check for user passwords and a couple do father things so they have a dependancy on them being loaded. As Evan says, previously the build of ScriptMaster included a version of Groovy that already had them in the JVM be more groovy... for ( i in 1..reader.numberOfPages )
September 25, 201510 yr Author Hi, It works fin adding both bcprov-jdk15on-152.jar and bcpkix-jdk15on-152.jar Shall I close the topic ? Thanks and regards Olivier Edited September 25, 201510 yr by Olivier Chenot
Create an account or sign in to comment