NoClassDefFoundError:无法初始化类sun.awt.X11GraphicsEnvironment

时间:2014-10-10 13:49:24

标签: java linux simplecaptcha iplanet

我正在尝试使用simplecaptcha-1.2.1.jar。它抛出异常。 rt.jarsun.awt.X11GraphicsEnvironment个班级。 simplecaptcha-1.2.1.jar在Windows平台(Server Weblogic)上工作正常。

java.lang.NoClassDefFoundError: Could not initialize class sun.awt.X11GraphicsEnvironment
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:169)
    at java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment(GraphicsEnvironment.java:68)
    at java.awt.image.BufferedImage.createGraphics(BufferedImage.java:1135)
    at nl.captcha.text.renderer.DefaultWordRenderer.render(DefaultWordRenderer.java:53)
    at nl.captcha.Captcha$Builder.addText(Captcha.java:136)
    at nl.captcha.Captcha$Builder.addText(Captcha.java:121)
    at nl.captcha.Captcha$Builder.addText(Captcha.java:111)
    at nl.captcha.servlet.SimpleCaptchaServlet.doGet(Unknown Source)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:697)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
    at org.apache.catalina.core.ApplicationFilterChain.servletService(ApplicationFilterChain.java:398)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:277)
    at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:255)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:188)
    at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:586)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:556)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:187)
    at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:586)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:556)
    at com.sun.webserver.connector.nsapi.NSAPIProcessor.service(NSAPIProcessor.java:160)

其他细节:

  • 服务器:iPlanet
  • Java version jdk 1.6
  • 操作系统:Linux

1 个答案:

答案 0 :(得分:0)

尝试添加java参数-DJava.awt.headless=true