HTML to PDF / DOCX / RTF Java converter library › Forums › PD4ML v3 Archived Forums (Read Only) › HTML/CSS rendering issues › Null Pointer Exception While Rendering A tomcat URL
- This topic has 1 reply, 2 voices, and was last updated Aug 05, 2009
03:58:28 by PD4ML.
-
AuthorPosts
-
July 2, 2009 at 08:37#26218
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????
August 5, 2009 at 03:58#27354As 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?
-
AuthorPosts
The forum ‘HTML/CSS rendering issues’ is closed to new topics and replies.