Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Problems using Jfreechart: Unable to display the chart on client machine and Tomcat crash

Posted on 2004-11-24
17
Medium Priority
?
285 Views
Last Modified: 2013-11-24
Hello,
I am running JDK1.4 on solaris with Tomcat. Implemented Jfreecharts from http://www.jfree.org/jfreechart/
I have 2 issues:

1. I am unable to display the chart on the browser unless I do the following 2 things:
a. set display to my pc
b. Start xwindows on pc.
This both will be impossible to do when I want to implement my code to production for public. How can I work around this issue. Please send sample config file code if I can work around with webserver settings.

2. My tomcat seems to crash regulrly when I do as above and access the chart url. I tried it on different servers(different tomcat) and same issue. Not sure if the peoblem is related to the display problem above.

Thank you.
0
Comment
Question by:makam_75
  • 7
  • 6
  • 3
16 Comments
 
LVL 19

Assisted Solution

by:ramazanyich
ramazanyich earned 1000 total points
ID: 12670510
to avoid problems with graphics without Xserver you can start Tomcat with folowing JVM property:
-Djava.awt.headless=true
0
 

Author Comment

by:makam_75
ID: 12670533
I read this but not understanding where to add this in the tomcat config file. can u post a sample. thanks.
0
 

Author Comment

by:makam_75
ID: 12670538
Also, I will be moving to Sunone webserver soon. Is there a similar config for Sunone?
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 19

Expert Comment

by:ramazanyich
ID: 12670586
It is a parameter for JVM. So if your webserver will use java then it is the same. NOTE: that parameter works only beginning with JDK 1.4, for JDK1.3 it doesn't work.
0
 
LVL 92

Accepted Solution

by:
objects earned 1000 total points
ID: 12670702
> where to add this in the tomcat config file.

Add it to the environment variable JAVA_OPTS, something like the following (depending on your shell):

setenv JAVA_OPTS -Djava.awt.headless=true

Include that in the startup script for the user that tomcat is run as
0
 
LVL 19

Expert Comment

by:ramazanyich
ID: 12670722
for tomcat set in your startup.sh:
setenv JAVA_OPTS -Djava.awt.headless=true
0
 
LVL 92

Expert Comment

by:objects
ID: 12670768
Don't set it in startup.sh, set it in the users startup script as I suggested above.
0
 

Author Comment

by:makam_75
ID: 12670820
What is the disadvantge in setting this in tomcat start up script?
Where is the users start up script?

I read on the web to do
 setenv CATALINA_OPTS -Djava.awt.headless=true

Is CATALINA_OPTS same as JAVA_OPTS ?

0
 
LVL 92

Expert Comment

by:objects
ID: 12670858
> What is the disadvantge in setting this in tomcat start up script?

You don't want to be changing the startup script.
If you install a new version you will have to redo the change.
Also you may want to run tomcat with different setting depending on who's running it.

Thats why they allow you to specify options via environment variables.

> Is CATALINA_OPTS same as JAVA_OPTS ?

Basically yes, JAVA_OPTs are passed before CATALINA_OPTS in the command line.
0
 

Author Comment

by:makam_75
ID: 12670884
Thanks, And where is the users start up script?
Is there a script or did you mean I should type it in the command line each time i start tomcat?
0
 
LVL 92

Expert Comment

by:objects
ID: 12670897
In there home directory, name depends on the shell you are running
0
 
LVL 92

Expert Comment

by:objects
ID: 12670900
Perhaps just set it on the command line first to test it works.
0
 

Author Comment

by:makam_75
ID: 12670927
Will do, Thanks!
0
 

Author Comment

by:makam_75
ID: 12670945
Sorry I meant to choose objects answer as "Accepted Ans" since he gave me the complete syntax.
0
 
LVL 92

Expert Comment

by:objects
ID: 12670963
thats ok :)
0
 

Author Comment

by:makam_75
ID: 12671098
I have posted a community support qn. hopefully it gets responded.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
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 learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.
Suggested Courses
Course of the Month20 days, 16 hours left to enroll

864 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