tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mike Fowler <>
Subject Re: Tomcat + Linux Server + Jasper Reports problem
Date Wed, 08 Feb 2006 11:20:41 GMT

Though I generally do not reply to people who repost their own questions 
daily, I did miss your original post and I spent some considerable time 
trying to solve this problem myself.

Checking the JavaDoc for HeadlessException you should note that it is 
"thrown when code that is dependent on a keyboard, display, or mouse is 
called in an environment that does not support a keyboard, display, or 
mouse.", which when you run headless is the case. Looking at your stack 
trace your construction of the JasperViewer object relies on creating a 
JFrame, and as per the exception documentation, you can't do. Therefore 
running headless is not your solution.

IMHO your solution should be to change what you are invoking so that you 
are not reliant on the JasperViewer and therefore the JFrame as Swing 
and AWT don't make sense in a server environment. However, if this is 
not possible you will need a correctly configured X environment and the 
DISPLAY environment variable set. Assuming a BASH shell, you can set the 
display variable with:

export DISPLAY=hostname:0

repacing hostname with your machine's real hostname.

Best wishes,

Mike Fowler
Registered Linux user: 379787

"I could be a genius if I just put my mind to it, and I,
I could do anything, if only I could get 'round to it"
-PULP 'Glory Days'

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message