Solved

java.awt.HeadlessException

Posted on 2003-11-13
5
528 Views
Last Modified: 2013-11-24
i have a servlet which was used to generate images on the fly.  Locally, the servlet worked fine.  However, once deployed on the app server, it crashes resulting in the stack trace below.  It seems the classes I'm using (ImageJ) to create the images, builds the image using a heavy-weight component (jframe) and an exception is thrown because that component requires a mouse, keyboard, monitor, etc... and apparently this server doesn't have any of that.

Does anyone knwo how I can 'get around' this exception?  I've read that setting the -Djava.awt.Headless=true option has worked for some, but many have said it did nothing for them.  I'm assuming that I can set this property via System.setProperty("java.awt.Headless", true) and it should have the same effect as command-line parameter, correct?

Please, anything you can offer I would appreciate.
0
Comment
Question by:sapientconceptions
  • 2
  • 2
5 Comments
 

Author Comment

by:sapientconceptions
ID: 9745517
Sorry, forgot the stack (or the relevant part anyway):

java.awt.HeadlessException
      at java.awt.GraphicsEnvironment.checkHeadless(GraphicsEnvironment.java:121)
      at java.awt.Window.(Window.java:251)
      at java.awt.Frame.(Frame.java:398)
      at java.awt.Frame.(Frame.java:363)
      at ij.process.ImageProcessor.setupFrame(ImageProcessor.java:688)
      at ij.process.ImageProcessor.getFontMetrics(ImageProcessor.java:797)
0
 
LVL 92

Expert Comment

by:objects
ID: 9745519
Depends what version of Java u are running on the server.
0
 
LVL 92

Expert Comment

by:objects
ID: 9745524
This may be an option:
http://www.eteks.com/pja/en/
0
 
LVL 35

Accepted Solution

by:
TimYates earned 250 total points
ID: 9746346
Try running tomcat with

-Djava.awt.headless=true

in the parameters (NOTE! small "h")

Tim
0
 
LVL 35

Expert Comment

by:TimYates
ID: 9746362
Ahhhh...just saw you are creating a JFrame...

Not sure what happens with that, but I'd try the headless param first...
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Exception after setting jdbc session management 2 52
create a gui in perl 3 72
servlet doXXX methods 3 37
Error in @AspectJ Based AOP with Spring 2 0
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now