I use -Djava.awt.headless=true to create graphs on the fly and never get
this exception. 

-----Original Message-----
From: Simon Brooke [mailto:[EMAIL PROTECTED] 
Sent: Monday, September 08, 2003 1:48 PM
To: Tomcat Users List
Subject: HeadlessException: The chickens come home to roost!


-----BEGIN PGP SIGNED MESSAGE-----

Long, long ago I spent a lot of time writing a Servlet which allowed 
drill-through graphs and charts to be built on the fly, server side. I
was 
very proud of it, but getting it working on an X11 platform was such a
bloody 
swine that I actually documented how to do it here:
<URL:http://www.weft.co.uk/library/jacquard/documentation/uk/co/weft/htf
orm/Graphic.html>

Now I need to use this functionality in a new project, and can I get it
to 
work? No, I *&*%$ can't. And the problem is a new one:

java.awt.HeadlessException

I get this whether or not I have
CATALINA_OPTS="-Djava.awt.headless=true" 
defined in /etc/default/tomcat4, and whether or not I have Xvfb running,
with 
the DISPLAY environment variable pointing in the right place, and all X 
security off.

Specifically I get:

  java.awt.HeadlessException at
 
java.awt.GraphicsEnvironment.checkHeadless(GraphicsEnvironment.java:121)
    at java.awt.Window.(Window.java:266) at
java.awt.Frame.(Frame.java:398) at
    java.awt.Frame.(Frame.java:363) at
    uk.co.weft.htform.MappedImage.(MappedImage.java:156) at
 
uk.co.weft.htform.ExampleMappedImage.(ExampleMappedImageServlet.java:28)

which is to say when I first try to create a java.awt.Frame

I'm using tomcat 4.0.4 as packaged in Debian package tomcat4_4.0.4-4 on
Debian 
3.0  with Sun Java 1.4.0 and Sun Java 1.4.1; I also have, and could try
if 
people think it would help, IBM Java 1.3.0

The last time this issue was discussed on this list was on 20th March
this 
year; I've tried all the proposed solutions which were discussed at that

time, including the eTeks PJA toolkit, which sounds a very clever
solution 
but which unfortunately failed with a NullPointerException

java.lang.NullPointerException
        at 
com.eteks.awt.servlet.PJARedirectServlet.servicePJA(PJARedirectServlet.j
ava:195)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav
a:39)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor
Impl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:324)
        at 
com.eteks.awt.servlet.PJAServlet.HttpMethodInvoke(PJAServlet.java:793)
        at com.eteks.awt.servlet.PJAServlet.service(PJAServlet.java:775)

Any further suggestions gratefully received.

Simon

- -- 
[EMAIL PROTECTED] (Simon Brooke) http://www.jasmine.org.uk/~simon/

    ;; MS Windows: A thirty-two bit extension ... to a sixteen bit
    ;; patch to an eight bit operating system originally coded for a
    ;; four bit microprocessor and sold by a two-bit company that
    ;; can't stand one bit of competition -- anonymous

-----BEGIN PGP SIGNATURE-----
Version: 2.6.3ia
Charset: noconv

iQCVAwUBP1zdAHr1UrYJMbiJAQHSUAP/RoR0DwfzilZ3EySyin3kXFzPkLQopTM9
l1yHrFdLnFFW6MV9rIuoKxNS2U1vPJ9zlqfeJt8hJszKKYO3b5WII6IJ0sz3fOIL
YaItN0wTGmgpDtOMSFHsv4hXrzHBVdzNXYuQaJ6Fo/alKcRMGdfKliYzNAR3PaeH
zlgRCXecWio=
=z/Pq
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to