java.awt.HeadlessException showing Swing Application

1.3k views Asked by At

I have 2 applications. One is web app. another is Java standalone app. Here I am calling Java app. through Servlet app. In stand alone app., I am using JFrame, JPanel etc. like Swing, AWT API. Here I am getting:

java.awt.HeadlessException
at java.awt.GraphicsEnvironment.checkHeadless(GraphicsEnvironment.java:159)
at java.awt.Window.<init>(Window.java:432)
at java.awt.Frame.<init>(Frame.java:403)
at java.awt.Frame.<init>(Frame.java:368)
at javax.swing.JFrame.<init>(JFrame.java:158)

For this I have set in Servlet app. is:

  System.setProperty("java.awt.headless", "false");

But Still I am getting same Issue. I am Glassfish Server. Can you guys please suggest me what I have to do?

1

There are 1 answers

0
Abdo Bmz On

I have already passed this problem before , Just Switch from GlassFish to Tomcat , And then your problem has been solved.