java.io.exception with  PdfReader reader = new PdfReader(.....
352822Oct 30 2006 — edited Nov 15 2006I have a java stored procedure:
import com.lowagie.text.pdf.AcroFields;
import com.lowagie.text.pdf.PdfReader;
import com.lowagie.text.pdf.PdfStamper;
import java.io.FileOutputStream;
import java.sql.*;
import java.text.SimpleDateFormat;
/**
* Fill in a simple registration form.
*/
public class readTemplatePDF {
/**
* Reads a form and fills in the fields.
* @param args no arguments needed
*/
public static void main(String[] args) {
readTemplatePDF d = new readTemplatePDF();
d.write(null); 
}
public static String write(oracle.sql.ARRAY parms) {
String result = "0 -- Successfull";
String[] values = null;
int arraySize = 0;
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd' 'HH:mm:ss.SS' '");
try {
values = (String[])parms.getArray();
arraySize = parms.length();
}
catch (java.sql.SQLException ex) {
System.out.println(sdf.format(new java.util.Date()) + " readTemplatePDF >> " + ex.toString());
}
try {
// we create a reader to read the template PDF file
PdfReader reader = new PdfReader("PORA$DATA:[PORADATA.PDF]" + values[0]);
// PdfReader reader = new PdfReader("TORA$DATA:[TORADATA.PDF]" + values[0]);
int n = reader.getNumberOfPages();
PdfStamper stamp1 = new PdfStamper(reader, new FileOutputStream("PORA$DATA:[PORADATA.PDF]" + values[1]));
// PdfStamper stamp1 = new PdfStamper(reader, new FileOutputStream("TORA$DATA:[TORADATA.PDF]" + values[1]));
AcroFields form1 = stamp1.getAcroFields();
int i = 2;
while (i < arraySize) {
form1.setField(values, values[i+1]);
i++;
i++;
}
stamp1.setFormFlattening(true);
stamp1.close();
result = "0 -- Successfull";
} catch (Exception ex) {
System.out.println(sdf.format(new java.util.Date()) + " readTemplatePDF >> " + ex.toString());
result = "9 -- Failed";
}
return result;
}
}
and a Function that publishes it:
FUNCTION createPdfFromTemplate (p_cmd in STRARRAY) RETURN VARCHAR2
AS
language java
name 'readTemplatePDF.write(oracle.sql.ARRAY) return String';
and at the SQL prompt I run the following:
declare
vRetCode varchar2(4000);
myArray A_SFA.STRARRAY:=A_SFA.STRARRAY();
BEGIN
myArray.EXTEND;
myArray(1):='GuestVpnTemplate.pdf';
myArray.EXTEND;
myArray(2):='pattesting.pdf';
myArray.EXTEND;
myArray(3):='beg_date';
myArray.EXTEND;
myArray(4):='27-oct-2006';
myArray.EXTEND;
myArray(5):='end_date';
myArray.EXTEND;
myArray(6):='27-dec-2006';
myArray.EXTEND;
myArray(7):='username';
myArray.EXTEND;
myArray(8):='myUsername';
myArray.EXTEND;
myArray(9):='password';
myArray.EXTEND;
myArray(10):='123456';
myArray.EXTEND;
myArray(11):='name';
myArray.EXTEND;
myArray(12):='Pat Thurman';
myArray.EXTEND;
myArray(13):='email';
myArray.EXTEND;
myArray(14):='myEmail@domain.edu';
myArray.EXTEND;
myArray(15):='phone';
myArray.EXTEND;
myArray(16):='999-999-9999';
vRetCode:=A_SFA.createPdfFromTemplate(myArray);
end;
I get a java.io.exception . I also have this working in my test environment. I cannot make it work in Production! I think there is a permissions problem. What is required in the Oracle database? I know the template file is on the disk in the right place and the OS(OpenVMS) security is correct. Thanks in advance for any suggestions.