问题描述
尝试在WebLogic 11g上导出时,会抛出NoClassDefFound异常。我检查了应用程序WAR,jasperreports-3.7.4.jar包含在WEB-INF / lib文件夹中。错误是什么?
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
推荐答案
最后,我已经开始工作了。我检测到根Exception,它在NoClassDefFoundError之前抛出:net / sf / jasperreports / engine / util / JRStyledTextParser:
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
Unix和Linux上的Sun AWT类依赖于X Window系统。当您使用这些类时,他们希望加载X客户端库并能够与X显示服务器通信。如果您的客户端有GUI,这是有意义的;不幸的是,即使您的客户使用AWT但没有GUI(这是我的情况,从Web应用程序生成报告),它也是必需的。
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)
绕过这个的方法,正在系统启动时设置系统属性 java.awt.headless = true
。
The way to bypass this, is setting a system property java.awt.headless=true
on system startup.
这篇关于net.sf.jasperreports.engine.util.JRStyledTextParser上的JasperReports NoClassDefFoundError异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!