java.lang.NoClassDefFoundError: com/itextpdf/text/DocumentException

时光毁灭记忆、已成空白 提交于 2019-12-01 16:17:06

The previous answer told you that a jar was missing, which was not a bad guess because the error message clearly says one of the iText classes couldn't be found.

Unfortunately, that error message is misleading. Java also says it can't find a class if there's any ambiguity. This is the case if you have more than one iText jar in your CLASSPATH.

You've made the problem worse by adding yet another iText jar to your CLASSPATH. Now you have a problem that is caused by having two different versions of iText available for the JVM in your weblogic instance.

Search all the CLASSPATHs, don't forget the server CLASSPATH, and you'll discover that D:\itextpdf-5.3.4.jar isn't the only place where weblogic goes looking for the PdfWriter class. Remove all iText jars from your CLASSPATH until you have only one left.

You need to put in the classpath of your web application and not your systems classpath.

And the easiest way to put the jar files on the classpath so that your server can get it at run time is :

PUT THE itextpdf-5.3.4.jar inside the

YOUR_WEBAPP_ROOT --> WEB-INF --> lib folder

so now your jar file should appear here

YOUR_WEBAPP_ROOT --> WEB-INF --> lib --> itextpdf-5.3.4.jar

Add your libraries to your war, inside WEB-INF/lib folder.

In my case, iText v.2.1.7 worked, I tried 5.5.3 and 5.5.4 with no luck.

An excerpt from Primefaces V.5.0 user guide, p.12 "Dependencies"

"Listed versions(itext 2.1.7, apache poi 3.7) are tested and known to be working with PrimeFaces, other versions of these dependencies may also work but not tested."

I was having a similar issue. On one system it pdf generation was working fine and another system I was getting this exception. After doing a bit of investigation I found that th working server had the itext-2.1.7.js6.jar with size 1105KB and the one not working had 12Kb. I replaced the jar with one with small size and it started working fine. Not sure how I ended up with same version jar with two different sizes. Hope this helps

I have simple action to solve your mistake you have to make a new "plugin from existing jar file" you integrated this one in your run configurator and final use this plugin like librairie i check this solution and it work without probleme

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!