PDFtk throws a Java Exception when attempting to use 'fill_form' function
<p>I have a PHP application that fills out a form from a database call. At present I am putting this together using PDFtk, I am able to run a number of PDFtk commands with no issue and I am currently working out the desired command at command line. </p>

<p>My call is currently this:</p>

<pre><code>pdftk /var/www/html/CSR/template/job_card.pdf fill_form /var/www/html/CSR/template/wwwwu7mMH.fdf output /var/www/html/CSR/template/filled4.pdf
</code></pre>

<p>This exact call run multiple times generates this error sometimes:</p>

<pre><code>    Unhandled Java Exception in create_output():
java.lang.ClassCastException: pdftk.com.lowagie.text.pdf.PdfNull cannot be cast to pdftk.com.lowagie.text.pdf.PdfDictionary
   at pdftk.com.lowagie.text.pdf.FdfReader.readFields(pdftk)
   at pdftk.com.lowagie.text.pdf.FdfReader.readPdf(pdftk)
   at pdftk.com.lowagie.text.pdf.PdfReader.&lt;init&gt;(pdftk)
   at pdftk.com.lowagie.text.pdf.PdfReader.&lt;init&gt;(pdftk)
   at pdftk.com.lowagie.text.pdf.FdfReader.&lt;init&gt;(pdftk)
</code></pre>

<p>and this error sometimes:</p>

<pre><code>Unhandled Java Exception in create_output():
Unhandled Java Exception in main():
java.lang.NullPointerException
   at gnu.gcj.runtime.NameFinder.lookup(libgcj.so.10)
   at java.lang.Throwable.getStackTrace(libgcj.so.10)
   at java.lang.Throwable.stackTraceString(libgcj.so.10)
   at java.lang.Throwable.printStackTrace(libgcj.so.10)
   at java.lang.Throwable.printStackTrace(libgcj.so.10)
</code></pre>

<p>The error message alternates but the command never works and the form is never filled. As I say though, the PDFtk works with other commands, I have been able to generate encrypted PDFs and run the fixed commands succesfully. </p>

<p>My question is what is causing this error and how do I fix it?</p>