JasperReports NoClassDefFoundError exception on ne

2019-01-13 16:18发布

问题:

When trying to export on WebLogic 11g, it throws NoClassDefFound exception. I checked the application WAR and jasperreports-3.7.4.jar is included in WEB-INF/lib folder. What is the error?

StackTrace

java.lang.NoClassDefFoundError: net/sf/jasperreports/engine/util/JRStyledTextParser at net.sf.jasperreports.engine.fill.JRBaseFiller.(JRBaseFiller.java:181) at net.sf.jasperreports.engine.fill.JRVerticalFiller.(JRVerticalFiller.java:76) at net.sf.jasperreports.engine.fill.JRVerticalFiller.(JRVerticalFiller.java:86) at net.sf.jasperreports.engine.fill.JRVerticalFiller.(JRVerticalFiller.java:56) at net.sf.jasperreports.engine.fill.JRFiller.createFiller(JRFiller.java:142) at net.sf.jasperreports.engine.fill.JRFiller.fillReport(JRFiller.java:78) at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:624) at org.springframework.web.servlet.view.jasperreports.AbstractJasperReportsView.fillReport(AbstractJasperReportsView.java:676) at

回答1:

Finally, I've got it working. I detected the root Exception, which was thrown before NoClassDefFoundError:net/sf/jasperreports/engine/util/JRStyledTextParser :

java.lang.NoClassDefFoundError: sun/awt/X11GraphicsEnvironment

The Sun AWT classes on Unix and Linux have a dependence on the X Window System. When you use these classes, they expect to load X client libraries and be able to talk to an X display server. This makes sense if your client has a GUI; unfortunately, it's required even if your client uses AWT but does not have a GUI (which is my case, generating a report from a web application)

The way to bypass this, is setting a system property java.awt.headless=true on system startup.



回答2:

I experienced the same issue and we've solved it by installing the xorg fonts packages along with the ttf fonts.



回答3:

Text Parsing Exception means the font not have been recognized. I spent an whole day trying to understand why, then finally I fix this problem using text SansSerif. On Linux only a few font can be parsed. Hoping has helped, best regards



回答4:

We had similar issue. we resolved it by using the jasper java flow jar file. the

java.awt.headless=true

didn't work for us.



回答5:

You get the same error if there is no enough space. I had the same error and it was because there was 0KB free space on server's hard drive.



回答6:

I had the same issue and it was resolved by reducing the /tmp space. It was 100% (/tmp folder). I reduced it to 86% and restarted the server and the noclassdefinitionerror was gone and issue was resolved.



回答7:

Faced this issue multiple times and I have got the solution. This error comes due to lack of memory space on disk... You can try below things to solve : (i) Make enough space in tmp folder (ii) Delete some unnecessary files on the disk to make some space.

Good luck..Hope.. it should solve your issue