For a J2EE bean I am reusing code that was developed for a java swing application. JOptionPane.showMessageDialog() is unfortunately commonly used. Most occurenc
JOptionPane.showMessageDialog()
Make sure the server is started with
java -Djava.awt.headless=true
Most servers should be started that way by default. Then you can check:
boolean headless_check = GraphicsEnvironment.isHeadless();
More details on headless available here: