You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by indu ss <in...@yahoo.com> on 2004/11/16 16:10:35 UTC

java.awt.HeadlessException

Hi,

I'm using Tomcat 5.0.12,J2sdk1.5 on Linux Fedora 2 .

I need to have a servlet which displays jpg images
without using Xserver. 
I get this error  even after starting tomcat with
CATALINA_OPTS="-Djava.awt.headless=true" 
and also with Xvfb running.

java.awt.HeadlessException
	at
java.awt.GraphicsEnvironment.checkHeadless(GraphicsEnvironment.java:159)
	at java.awt.Window.<init>(Window.java:310)
	at java.awt.Frame.<init>(Frame.java:419)
	at java.awt.Frame.<init>(Frame.java:384) ......





		
__________________________________ 
Do you Yahoo!? 
The all-new My Yahoo! - Get yours free! 
http://my.yahoo.com 
 


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


RE: java.awt.HeadlessException

Posted by Mike Curwen <g_...@globallyboundless.com>.
Hi,

We have found that in order to get headless to work properly, you need the
xlib libraries installed. You don't need an xserver _running_, but you need
the libraries, because I think java.awt.* uses them.
 
Here's a link:
http://javatechniques.com/public/java/docs/hosting/headless-java-x11-librari
es.html

We've also found that JAVA needs help finding them, by adding the following
line to catalina.sh: 
export LD_LIBRARY_PATH="/usr/X11/lib" 
 
Also of note is that the error message you get for this condition changes
after the first occurrence.

The very first time you try to generate an image dynamically, you'll get
something like:
  
org.apache.jasper.JasperException: 
/usr/local/applications/j2sdk-1_4_2_04/jre/lib/i386/libawt.so: libXp.so.6: 
cannot open shared object file: No such file or directory 
 
All subsequent times, it will be a different message, something like:
java.lang.NoClassDefFoundError
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:141)
        at java.awt.Toolkit$2.run(Toolkit.java:748)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.awt.Toolkit.getDefaultToolkit(Toolkit.java:739)


Maybe you knew all this, and xvfb (whatever that is) was meant to get around
this.  But all of the above works for us.



> -----Original Message-----
> From: indu ss [mailto:ind1_us@yahoo.com] 
> Sent: Tuesday, November 16, 2004 9:11 AM
> To: tomcat-user@jakarta.apache.org
> Subject: java.awt.HeadlessException
> 
> 
> Hi,
> 
> I'm using Tomcat 5.0.12,J2sdk1.5 on Linux Fedora 2 .
> 
> I need to have a servlet which displays jpg images
> without using Xserver. 
> I get this error  even after starting tomcat with 
> CATALINA_OPTS="-Djava.awt.headless=true" 
> and also with Xvfb running.
> 
> java.awt.HeadlessException
> 	at
> java.awt.GraphicsEnvironment.checkHeadless(GraphicsEnvironment
> .java:159)
> 	at java.awt.Window.<init>(Window.java:310)
> 	at java.awt.Frame.<init>(Frame.java:419)
> 	at java.awt.Frame.<init>(Frame.java:384) ......
> 
> 
> 
> 
> 
> 		
> __________________________________ 
> Do you Yahoo!? 
> The all-new My Yahoo! - Get yours free! 
> http://my.yahoo.com 
>  
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org