`
xiaguangme
  • 浏览: 72849 次
  • 性别: Icon_minigender_1
  • 来自: 南京
社区版块
存档分类
最新评论

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

阅读更多

 引自stackoverflow

JAVA_OPTS="$JAVA_OPTS -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djava.awt.headless=true"
 

http://stackoverflow.com/questions/3628302/jasperreports-noclassdeffounderror-exception-on-net-sf-jasperreports-engine-util

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

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.

在tomcat 可以修改catalina.sh 类似:


JAVA_OPTS="$JAVA_OPTS -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djava.awt.headless=true"

 

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics