Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Generating jpg on linux with no display error.

0 views
Skip to first unread message

camt...@my-deja.com

unread,
Jan 9, 2001, 10:39:38 AM1/9/01
to
Hello,

I am running a servlet on jdk1.3 and Linux that displays a jpg image to
the web browser. The problem is, it only works when I logon to the
machine and restart tomcat (servlet engine). It does not work right
after a reboot, even though tomcat is being started automatically in
the runlevel. Everything else about tomcat works fine, following is
the error I get when trying to access the image. It is obviously
something to do with createGraphics(), but I am not displaying any
graphics, as you can see it is a BufferedImage,

Thanks in advance.

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.
(X11GraphicsEnvironment.java:58)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:120)
at java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment
(GraphicsEnvironment.java:58)
at java.awt.image.BufferedImage.createGraphics
(BufferedImage.java:1011)
at com.im.image.ChartRenderer.createChart(ChartRenderer.java:68)
at com.im.servlets.image.PieChart.doGet(PieChart.java:33)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.tomcat.core.ServletWrapper.handleRequest
(ServletWrapper.java:503)
at org.apache.tomcat.core.ServletWrapper.handleRequest
(ServletWrapper.java:597)
at org.apache.tomcat.servlets.InvokerServlet.service
(InvokerServlet.java:257)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.tomcat.core.ServletWrapper.handleRequest
(ServletWrapper.java:503)
at org.apache.tomcat.core.ContextManager.service
(ContextManager.java:559)
at
org.apache.tomcat.service.http.HttpConnectionHandler.processConnection
(HttpConnectionHandler.java:160)
at org.apache.tomcat.service.TcpConnectionThread.run
(SimpleTcpEndpoint.java:338)
at java.lang.Thread.run(Thread.java:484)

Sent via Deja.com
http://www.deja.com/

camt...@my-deja.com

unread,
Jan 9, 2001, 10:38:39 AM1/9/01
to

Nils O. Selåsdal

unread,
Jan 9, 2001, 11:24:55 AM1/9/01
to
You cannot/shouldnot do such grapics things in a server,
when you create som Graphics, some AWT, or Swing Components on the server
it ofcourse connects to the grapically display on the server. Which you
shouldnt do....
..and which requires the X - server to be running.


Marc Prud'hommeaux

unread,
Jan 9, 2001, 9:15:10 PM1/9/01
to
In article <93fb9u$qcs$1...@nnrp1.deja.com>, camt...@my-deja.com wrote:
> I am running a servlet on jdk1.3 and Linux that displays a jpg image to
> the web browser. The problem is, it only works when I logon to the
> machine and restart tomcat (servlet engine). It does not work right
> after a reboot, even though tomcat is being started automatically in the
> runlevel. Everything else about tomcat works fine, following is the
> error I get when trying to access the image. It is obviously something
> to do with createGraphics(), but I am not displaying any graphics, as
> you can see it is a BufferedImage,

Its a bug in the JDK -- see
http://developer.java.sun.com/developer/bugParade/bugs/4281163.html

They claim to have fixed it, but apparantly not. They say the only
workaround is to run an X Server and set your DISPLAY variable correctly.

Jon Skeet

unread,
Jan 10, 2001, 3:59:17 AM1/10/01
to
ma...@apocalypse.org wrote:
> Its a bug in the JDK -- see
> http://developer.java.sun.com/developer/bugParade/bugs/4281163.html
>
> They claim to have fixed it, but apparantly not.

Read it more carefully: it's fixed in a non-public release. Unless you
*have* a non-public release, you can't know whether or not it's actually
been fixed.

--
Jon Skeet - sk...@pobox.com
http://www.pobox.com/~skeet

Jon Skeet

unread,
Jan 10, 2001, 4:00:26 AM1/10/01
to
nose...@frisurf.no wrote:
> You cannot/shouldnot do such grapics things in a server

Why not? There are any number of good reasons why you may wish to create
graphics on the fly.

> when you create som Graphics, some AWT, or Swing Components on the server
> it ofcourse connects to the grapically display on the server. Which you
> shouldnt do....
> ..and which requires the X - server to be running.

Or requires Xvfb or a similar thing...

Of course, in 1.4 this will all change.

Why do you think you *shouldn't* dynamically generate graphics on a
server?

0 new messages