0

Situation: I have a Java file in my project that uses the features of the iTextPDF library. The project compiles properly. I use JDK 1.7, Tomcat 7.45 and Eclipse Neon.3 Release (4.6.3).

Problem: While starting the server via Eclipse, I get an error: java.lang.ClassNotFoundException: com.itextpdf.text.Element

What I've tried so far:

  1. Ensured that only 1 version of iTextPdf 5.4.jar is available in the entire project. It's there in WEB-INF/lib folder. It's not there in any of the externally referenced libraries.

  2. I updated my Eclipse.

Any help will be greatly appreciated.

1 Answer 1

1

Well, as a starting point- try and expanding the JAR, and see if you can search for or manually find com.itextpdf.text.Element class.

if it's not found there, you know there's nothing wrong with your eclipse or project settings, and nothing wrong with your jar imports.

You should then determine between 3 options:

  1. Is the JAR even on the classpath? it's possible everything is present there, but the project does not even consider looking in it.
  2. Should this class be in the JAR? is it available on other versions of this JAR?
  3. Is this class neccesasry for you application? why is eclipse looking for it, where in the code it is referecened? can you live without it? or, can you manullay replace it with a class file you can find online? (this will take some debug time, and some more research on your part)
Sign up to request clarification or add additional context in comments.

2 Comments

iText employee here. If it's a Maven project and the dependency com.itextpdf:itextpdf:5.5.13 was defined in pom.xml and the jar file was automatically downloaded from Maven Central, then com.itextpdf.text.Element is most definitely a class in the jar file. See also the Javadocs: itextsupport.com/apidocs/itext5/5.5.13/com/itextpdf/text/…. I would rather look in the direction of the jar not being on the clas path.
I'm receiving same error with a couple of itext classes. In my context (ibm i rpgiv wrapper) it could be pointing to a different issue: improper use or traslation of such class (in my context, I need to define a rule of transcription for constructors and methods. If it does not describe the method/constructor accurately, it is the response in runtime)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.