Reading a PDF file using Java Code activity implementing Adobe APIs does not work.
book
Article ID: KB0091192
calendar_today
Updated On:
Products
Versions
TIBCO ActiveMatrix BusinessWorks
-
Not Applicable
-
Description
Description: Reading PDF file in Java activity with Adobe APIs works fine with TIBCO
Businessworks (BW) 5.9.2 and backward versions but fails with java.net.MalformedURLException in TIBCO Businessworks
(BW) 5.9.3 and newer versions. Symptoms: Steps to reproduce:
1). Download the attached jar file and the project. 2). Set the alias library in the AdobeUtilities/AlliasLibrary folder. 3). Set the full path of a sample pdf file in the input tab of the Java code activity. 4). Run the "read pdf from-file" process. 5). The process will run fine with BW 5.9.2, but will fail with the
following exception with BW 5.9.3 and newer. The exception happens while
executing doc.exportAnnotations() method in the Java code.
2013 Feb 06 12:19:44:780 GMT -8 BW.PDFReader Debug [BW-Core] Job-22000
Error in [read pdf form - file.process/read pdf file] While executing
[invoke] encountered [com.adobe.pdf.exceptions.XFDFException] :
[java.net.MalformedURLException at
com.adobe.pdf.impl.PDFDocumentImpl.exportAnnotations(Unknown Source)] 2013 Feb 06 12:19:44:783 GMT -8 BW.PDFReader Debug [BW-Core] <= read
pdf form - file.process/read pdf file.eval(Job-22000) returned ERROR 2013 Feb 06 12:19:44:784 GMT -8 BW.PDFReader Error [BW_Plugin]
BW-JAVA-100001 Job-22000 Error in [read pdf form - file.process/read pdf
file] While executing [invoke] encountered
[com.adobe.pdf.exceptions.XFDFException] :
[java.net.MalformedURLException at
com.adobe.pdf.impl.PDFDocumentImpl.exportAnnotations(Unknown Source)] at com.tibco.plugin.java.JavaActivity.eval(JavaActivity.java:420) at com.tibco.pe.plugin.Activity.eval(Activity.java:240) at com.tibco.pe.core.TaskImpl.eval(TaskImpl.java:775) at com.tibco.pe.core.Job.step(Job.java:729) at com.tibco.pe.core.Job.checkStep(Job.java:518) at com.tibco.pe.core.JobDispatcher$JobCourier.runx(JobDispatcher.java:249) at com.tibco.pe.core.JobDispatcher$JobCourier.run(JobDispatcher.java:200) <?xml version="1.0" encoding="UTF-8"?>
<Data> <ns0:InvocationException xmlns:ns0="http://schemas.tibco.com/bw/plugins/java/5.0/javaExceptions"> <msg>While executing [invoke] encountered
[com.adobe.pdf.exceptions.XFDFException] :
[java.net.MalformedURLException at
com.adobe.pdf.impl.PDFDocumentImpl.exportAnnotations(Unknown
Source)]</msg> <msgCode>BW-JAVA-100001</msgCode> <methodName>invoke</methodName> <exceptionClassName>com.adobe.pdf.exceptions.XFDFException</exceptionClassName> <exceptionMessage>java.net.MalformedURLException at
com.adobe.pdf.impl.PDFDocumentImpl.exportAnnotations(Unknown
Source)</exceptionMessage> </ns0:InvocationException> </Data>
Cause: The issue is due to jar xmlparsers.jar which provides the object of
TransformFactoryImpl concrete class. It was changed starting with BW
5.9.3 for a security fix related to XML parsing. If you copy the
engine.jar from BW 5.9.2 to the hotfix/lib directory of BW 5.9.3, the
project will work fine even with BW 5.9.3.
Issue/Introduction
Reading a PDF file using Java Code activity implementing Adobe APIs does not work.
Resolution
1). Adding the following line into the beginning of your Java code: System.setProperty("javax.xml.transform.TransformerFactory", "net.sf.saxon.TransformerFactoryImpl");
2). Adding the following line into your Java code: System.setProperty("javax.xml.transform.TransformerFactory","com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl");
3). Disable the XML parser security feature introduced in BW 5.9.3 in the application’s tra (runtime) or designer.tra (design time) file, so that it will work like BW 5.9.2 and prior versions:
java.property.com.tibco.xml.parsers.disabled true
Attachments
Reading a PDF file using Java Code activity implementing Adobe APIs does not work.
get_app
Reading a PDF file using Java Code activity implementing Adobe APIs does not work.
get_app