You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Simon Brooke <si...@jasmine.org.uk> on 2003/09/08 21:48:15 UTC

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/htform/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.java:195)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.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

- -- 
simon@jasmine.org.uk (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-----

Re: HeadlessException: The chickens come home to roost!

Posted by Kwok Peng Tuck <pe...@makmal.net>.
Perhaps this might also ease the pain: http://cewolf.sourceforge.net/

Bill Barker wrote:

>Running headless means using awt-light.  In particular, one of the things
>you are forbidden from doing is creating heavy-weight components like
>Frames.  If you want to run headless, you will need to re-structure your
>servlet to only use light-wieght components (that, in particular, don't care
>that there isn't a mouse).
>
>"Simon Brooke" <si...@jasmine.org.uk> wrote in message
>news:200309082048.19429.simon@jasmine.org.uk...
>-----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/htform/
>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.java:
>195)
>        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>        at
>sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39
>)
>        at
>sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
>.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
>
>- -- 
>simon@jasmine.org.uk (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: tomcat-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>
>
>
>  
>


Re: HeadlessException: The chickens come home to roost!

Posted by Bill Barker <wb...@wilshire.com>.
Running headless means using awt-light.  In particular, one of the things
you are forbidden from doing is creating heavy-weight components like
Frames.  If you want to run headless, you will need to re-structure your
servlet to only use light-wieght components (that, in particular, don't care
that there isn't a mouse).

"Simon Brooke" <si...@jasmine.org.uk> wrote in message
news:200309082048.19429.simon@jasmine.org.uk...
-----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/htform/
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.java:
195)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39
)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
.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

- -- 
simon@jasmine.org.uk (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-----




RE: HeadlessException: The chickens come home to roost!

Posted by George Sexton <gs...@mhsoftware.com>.
I use -Djava.awt.headless=true to create graphs on the fly and never get
this exception. 

-----Original Message-----
From: Simon Brooke [mailto:simon@jasmine.org.uk] 
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

- -- 
simon@jasmine.org.uk (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: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org