<[WebAppServletContext(6641934,sxecase,/sxecase)] Servlet failed with Exception java.lang.InternalError: Can't connect to X11 window server using ':0.0' as the value of the DISPLAY variable. at sun.awt.X11GraphicsEnvironment.initDisplay(Native Method) at sun.awt.X11GraphicsEnvironment.<clinit>(X11GraphicsEnvironment.java:63) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Unknown Source) at java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment(GraphicsEnvironment.java:58) at java.awt.image.BufferedImage.createGraphics(BufferedImage.java:1011) at com.sitech.graphic.CakeImage.<init>(CakeImage.java:105) at com.sitech.graphic.CityCakeChartServlet.doGet(CityCakeChartServlet.java:105) at javax.servlet.http.HttpServlet.service(HttpServlet.java:740) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:265) at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:200) at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:2546) at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2260) at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
wguzgg
2003-10-24 16:04
这个错误是因为xwindow本身的权限验证造成的,java在unix系统上是利用xwindow来实现图形功能的,但jdk1.4.1之后支持一个启动参数 java.awt.headless=true,即可不依赖xwindow了. 如果有问题的话,可以使用Xvfb来代替xwindow来实现图形功能, X virtual framebuffer,可以用来模拟xwindow 我在项目中用这两种方式都成功的解决了java的servlet在linux下的图形问题