• Post Reply Bookmark Topic Watch Topic
  • New Topic

java.awt.HeadlessException: while running my application in Linux

 
malli
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi...
in My application we are displaying a pie chart using JFreeChart.It work fine in my local system but its not working in Linux machine. i am getting the error message in my tomcat...

java.awt.HeadlessException:
No X11 DISPLAY variable was set, but this program performed an operation which requires it.
at java.awt.GraphicsEnvironment.checkHeadless(GraphicsEnvironment.java:159)
at java.awt.Window.<init>(Window.java:317)
at java.awt.Frame.<init>(Frame.java:419)
at javax.swing.JFrame.<init>(JFrame.java:194)
at org.jfree.chart.ChartFrame.<init>(ChartFrame.java:78)
at org.jfree.chart.ChartFrame.<init>(ChartFrame.java:66)
at org.icrisat.lims.startup.login.SummaryAction.execute(SummaryAction.java:68)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:868)
at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:663)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
at java.lang.Thread.run(Thread.java:595)
Exceptionjava.awt.HeadlessException:
No X11 DISPLAY variable was set, but this program performed an operation which requires it.
 
Rob Spoor
Sheriff
Posts: 20819
68
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"malli",

Please read your private messages regarding an important message.


As for your problem, what window manager are you using? Because you can't start a ChartFrame without a window manager.

Perhaps you can check JFreeChart to see if they have some components available for servlets. Because you can't add Swing / AWT components to servlets just like that.
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is a window manager really necessary? I was under the impression that the availability of the X11 libraries was sufficient. (Since the stack frame mentions Struts -in other words, it's web app- I'm assuming that you're not actually trying to show a Java GUI, obviously.)

This step would also be necessary.
 
Rob Spoor
Sheriff
Posts: 20819
68
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well he/she is trying to create a frame - that makes me think that showing a GUI is exactly what this code is trying to do.

You're right about not needing a window manager (or more precisely, an X11 / Xorg session) - unless you're trying to show a GUI.
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
he/she is trying to create a frame - that makes me think that showing a GUI is exactly what this code is trying to do.

Not necessarily. JFreeChart (and similar libraries) will create GUI objects for creating charts that are then saved to disk or streamed to the browser. So this might be a legitimate operation to do. In that case, the switch I posted before will take care of the problem.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!