PDF Generating Tool Support Forum

HOME   Login   Register    Search




  Subject: Null Pointer Exception While Rendering A tomcat URL
   PostPosted: 02 Jul 2009, 10:37 
Hi,

I am using a web Application on TOmcat 6.0.14. I passed the URL into the render function.
The code is as follows.


public void generatePdfInvoice(HttpServletRequest request , HttpServletResponse response) throws Exception{
StringBuffer filename = request.getRequestURL();

System.out.println("The request URL is: " + filename.toString());
String file = filename.toString();
File outputPDFFile = new File("D://Stored_Invoices/Inv_no_" + this.getInvoiceID() + ".pdf");
String inputHTMLFileName = file + "?cmd=print&invoice_id=" + this.getInvoiceID();
//URL url = new URL("filename");
Dimension format = PD4Constants.A4;
java.io.FileOutputStream fos = new java.io.FileOutputStream(outputPDFFile);
PD4ML pd4ml = new PD4ML();
pd4ml.setPageInsets(new Insets(20, 10, 10, 10));
pd4ml.setHtmlWidth(1000);
pd4ml.setPageSize(pd4ml.changePageOrientation(format));
pd4ml.enableDebugInfo();
pd4ml.render(inputHTMLFileName, fos);

It is giving the following error:

java.io.IOException: Server returned HTTP response code: 500 for URL: http://localhost:8084/ManglamProj/vtsInvoice2.jsp?cmd=print&invoice_id=980
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at sun.net.www.protocol.http.HttpURLConnection$6.run(HttpURLConnection.java:1298)
at java.security.AccessController.doPrivileged(Native Method)
at sun.net.www.protocol.http.HttpURLConnection.getChainedException(HttpURLConnection.java:1292)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:948)
at org.zefer.cache.c.getResourceAsBytes(Unknown Source)
at org.zefer.html.doc.PD4MLHtmlParser.parse(Unknown Source)
at org.zefer.html.doc.PD4MLHtmlParser.buildDocument(Unknown Source)
at org.zefer.pd4ml.PD4ML.o00000(Unknown Source)
at org.zefer.pd4ml.PD4ML.render(Unknown Source)
at org.zefer.pd4ml.PD4ML.render(Unknown Source)


What to do????


  Subject: Re: Null Pointer Exception While Rendering A tomcat URL
   PostPosted: 05 Aug 2009, 05:58 
As I see from the exception stack trace, an attempt to load source HTML from

http://localhost:8084/ManglamProj/vtsInvoice2.jsp?cmd=print&invoice_id=980

failed with error code 500. It is a problem of vtsInvoice2.jsp.

Does the URL work if you open it with a web browser?


Last bumped by Anonymous on 05 Aug 2009, 05:58.



[Reply]     [ 2 posts ] 

cron
Copyright ©2004-10 zefer|org. All rights reserved. Bookmark and Share