aspose file tools
The moose likes Struts and the fly likes Struts2:NoClassDefFoundError for pdf parsing using itext Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Reply Bookmark "Struts2:NoClassDefFoundError for pdf parsing using itext " Watch "Struts2:NoClassDefFoundError for pdf parsing using itext " New topic
Author

Struts2:NoClassDefFoundError for pdf parsing using itext

Poonam Vetal
Greenhorn

Joined: Feb 18, 2012
Posts: 8

Hi all,

I am trying to Parse a PDF file to text file and store it into the MySQL database using Struts2 and Hibernate.
For PDF parsing I am using itext API.Its not running Showing java.lang.NoClassDefFoundError: com/itextpdf/text/pdf/parser/RenderListener

jars used are-
iText-2.1.5
itextpdf-5.1.1
itextpdf-5.1.1-javadoc
itextpdf-5.1.1-sources
itext-xtra-5.1.1
itext-xtra-5.1.1-javadoc
itext-xtra-5.1.1-sources

Now I'm just trying to convert Pdf to text file the code is-
Question.java


QuestionDTO.java

QuestionDAO.java


QuestionDAOImpl.java


QuestionService.java




QuestionServiceImpl.java



GenericDAO.java


AbstractGenericDaoImpl.java


pdfAction.java


Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8265

Why are you using both iText-2.1.5 and itextpdf-5.1.1 ?
You probably don't need the *-javadoc and -sources JAR files.


"blabbing like a narcissistic fool with a superiority complex" ~ N.A.
[How To Ask Questions On JavaRanch]
Poonam Vetal
Greenhorn

Joined: Feb 18, 2012
Posts: 8

Joe Ess wrote:Why are you using both iText-2.1.5 and itextpdf-5.1.1 ?
You probably don't need the *-javadoc and -sources JAR files.

Thanks Joe, I removed the itext-2.1.5 n *-javadoc and -sources JAR files
still showing same error java.lang.NoClassDefFoundError: com/itextpdf/text/pdf/parser/RenderListener
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8265

Then your problem is either packaging or deploying the application. How are you accomplishing that?
Poonam Vetal
Greenhorn

Joined: Feb 18, 2012
Posts: 8

Joe Ess wrote:Then your problem is either packaging or deploying the application. How are you accomplishing that?

Sorry Joe, I'm not getting what you have asked? I'm deploying application using tomcat server 6.0 on port 8080 and MySQL as http://localhost:8080/project name/

and packaging Hierarchy is like,

edu.cummins.cts.domain
Question.java
edu.cummins.cts.dto
QuestionDTO.java
edu.cummins.cts.persistence
GenericDAO.java
QuestionDAO.java
edu.cummins.cts.persistence.impl
AbstractGenericDaoImpl.java
QuestionDAOImpl.java
edu.cummins.cts.service
QuestionService.java
edu.cummins.cts.service.impl
QuestionDAOImpl.java
edu.cummins.cts.web
QuestionDAOImpl.java
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8265

How are you getting your web app on the server? Do you create a WAR and copy it somewhere the server can see it?
You would probably get a lot out of reading the Tomcat Application Developer's Guide.
Poonam Vetal
Greenhorn

Joined: Feb 18, 2012
Posts: 8

Joe Ess wrote:How are you getting your web app on the server? Do you create a WAR and copy it somewhere the server can see it?
You would probably get a lot out of reading the Tomcat Application Developer's Guide.

Hi Joe,

I'm using the Ant script for the WAR files.
The scripting is like this,
build.xml


build.properties
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8265

Assuming that you have the iText.jar file in WEB-INF/lib, that looks fine.
What is the contents of WEB-INF/lib?
What is the complete stack trace from the server log? I suspect that you may be missing an iText dependency.
Poonam Vetal
Greenhorn

Joined: Feb 18, 2012
Posts: 8

Joe Ess wrote:Assuming that you have the iText.jar file in WEB-INF/lib, that looks fine.
What is the contents of WEB-INF/lib?
What is the complete stack trace from the server log? I suspect that you may be missing an iText dependency.

Hi Joe,

Thank You so much.I was so stupid I have just included the itext JARs as a Externel Jar in classpath and haven't included in WEB-INF/lib.

Now the error is gone but still not getting the output but thank you so much.gn
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: Struts2:NoClassDefFoundError for pdf parsing using itext
 
Similar Threads
Insert new records in database without deleting existing records
Spring,Hibernate Integration Question?
Issue with Vaanilla Struts 2/Hibernate CRUD example
Help me for Joinin two tables.
Hibernate Query