java调用awt做图片验证码显示的问题解决

作者: 2hei 发表于2008年8月25日 21:40
版权声明: 可以转载, 转载时务必以超链形式标明文章原始出处和作者信息及版权声明
http://www.2hei.net/mt/2008/08/java-awt-display.html
错误症状:

500 Servlet Exception
java.lang.InternalError: Can't connect to X11 window server using 'localhost:0.0'
as the value of the DISPLAY variable.
    at sun.awt.X11GraphicsEnvironment.initDisplay(Native Method)
    at sun.awt.X11GraphicsEnvironment.<clinit>(X11GraphicsEnvironment.java:134)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:141)
    at java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment(GraphicsEnvironment.java:62)
    at java.awt.image.BufferedImage.createGraphics(BufferedImage.java:1041)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:103)
    at java.lang.Thread.run(Thread.java:534)

google了半天,试过了安装xorg-x11-Xvfb包,export DISPLAY=:0等等,无奈,没有解决。
最后终于找到了解决方案:
可以在java的jvm上 加入参数   –Djava.awt.headless=true

| | Comments (0) | TrackBacks (0)

发表一个评论

关于这篇文章

这篇文章由2hei2008年8月25日 21:40发布.

上一篇:mysql OLD_PASSWORD's problem

下一篇:python socket exception

回到首页 或者查看归档文章

  • Powered by FeedBurner
  • Add to Google Reader or Homepage
  • Add to My AOL
  • Subscribe in NewsGator Online
  • del.icio.us/2heidel.icio.us/2hei
  • Subscribe to feed feeds