JasperReports NoClassDefFoundError exception on net.sf.jasperreports.engine.util.JRStyledTextParser

后端 未结 11 1481
旧巷少年郎
旧巷少年郎 2020-12-01 06:26

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

11条回答
  •  长情又很酷
    2020-12-01 07:16

    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.

提交回复
热议问题