Results 1 to 3 of 3
- 01-25-2011, 05:33 AM #1
Member
- Join Date
- Dec 2010
- Posts
- 14
- Rep Power
- 0
generate pdf in servlet using itext library
Hi,
When i use itext library to generate pdf in servlet, i got an exception.
---------------------------------------------------------------------
java.lang.NoClassDefFoundError: com/lowagie/text/DocumentException
java.lang.Class.getDeclaredConstructors0(Native Method)
java.lang.Class.privateGetDeclaredConstructors(Cla ss.java:2389)
java.lang.Class.getConstructor0(Class.java:2699)
java.lang.Class.newInstance0(Class.java:326)
java.lang.Class.newInstance(Class.java:308)
banking.ControllerServlet.doGet(ControllerServlet. java:74)
javax.servlet.http.HttpServlet.service(HttpServlet .java:617)
javax.servlet.http.HttpServlet.service(HttpServlet .java:717)
---------------------------------------------------------------------
I added the itext jar files. Still i am getting the same exception. Any one please Help Me..
My servlet code is added below:
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
response.setContentType("application/pdf");
Document document = new Document();
try{
PdfWriter.getInstance(document, response.getOutputStream());
document.open();
PdfPTable table = new PdfPTable(2);
table.addCell("1");
table.addCell("2");
table.addCell("3");
table.addCell("4");
table.addCell("5");
table.addCell("6");
document.add(table);
document.close();
}catch(DocumentException e){
e.printStackTrace();
}
}
------------------------------------------------------------------
- 01-25-2011, 09:24 AM #2
Moderator
- Join Date
- Apr 2009
- Posts
- 10,481
- Rep Power
- 16
Is the jar on the Runtime classpath?
In other words, is it in your WEB-INF/lib directory when deployed to the server?
- 01-25-2011, 11:48 AM #3
Similar Threads
-
Merge 2 pdf files with itext and preview on servlet
By xampos20 in forum New To JavaReplies: 1Last Post: 05-11-2010, 11:49 PM -
Itext
By anilhk@gmail.com in forum Advanced JavaReplies: 0Last Post: 04-14-2010, 05:03 AM -
I want to put the native library in library path in mac os x
By Hussain Ali in forum Advanced JavaReplies: 2Last Post: 02-24-2010, 07:55 AM -
Tell me jar file for library library org.bouncycastle.cms
By 82rathi.angara in forum New To JavaReplies: 10Last Post: 09-09-2008, 05:11 AM -
iText 2.1.0
By Java Tip in forum Java SoftwareReplies: 0Last Post: 03-29-2008, 01:05 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks