Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Struts2:NoClassDefFoundError for pdf parsing using itext

 
Poonam Vetal
Greenhorn
Posts: 8
Eclipse IDE Hibernate Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 9279
10
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Poonam Vetal
Greenhorn
Posts: 8
Eclipse IDE Hibernate Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 9279
10
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Then your problem is either packaging or deploying the application. How are you accomplishing that?
 
Poonam Vetal
Greenhorn
Posts: 8
Eclipse IDE Hibernate Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 9279
10
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 8
Eclipse IDE Hibernate Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 9279
10
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 8
Eclipse IDE Hibernate Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic