Avatar of makam_75
makam_75

asked on 

Problems using Jfreechart: Unable to set display - Sun One web server

Hello-
I am unable to make the charts display on the clients machine.
In iplanet UI, in the JVM Options, I have added -Djava.awt.headless=true

The error I get is

----- Root Cause -----   java.lang.NoClassDefFoundError   at PieChartBuilder.getPieChart(PieChartBuilder.java:160)   at PieChartBuilder.getPieChart(PieChartBuilder.java:107)   at org.jfree.chart.servlet.DisplayPie.service(DisplayPie.java:135)   at javax.servlet.http.HttpServlet.service(HttpServlet.java:908)   at org.apache.catalina.core.StandardWrapperValve.invokeServletService(StandardWrapperValve.java:771)   at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:322)   at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:509)   at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:212)   at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:509)   at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:209)   at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:509)   at com.iplanet.ias.web.connector.nsapi.NSAPIProcessor.process(NSAPIProcessor.java:161)   at com.iplanet.ias.web.WebContainer.service(WebContainer.java:586)    


The reason I believe this is because of the display setting is that I have seen similar error when I tried to do same thing in tomcat , and in tomcat when I would set the display, it would work fine.
Any thoughts. Thanks and this is urgent.
Java EEWeb ServersJava

Avatar of undefined
Last Comment
Mick Barry
SOLUTION
Avatar of CEHJ
CEHJ
Flag of United Kingdom of Great Britain and Northern Ireland image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of CEHJ
CEHJ
Flag of United Kingdom of Great Britain and Northern Ireland image

Sorry - WEB-INF/lib
Avatar of Mick Barry
Mick Barry
Flag of Australia image

whats line 160 in PieChartBuilder?
Avatar of makam_75
makam_75

ASKER

Yes, the jar files are in web-inf/lib

line 160 is       chart = new JFreeChart(chart_name,
                        JFreeChart.DEFAULT_TITLE_FONT, (Pie3DPlot) plot, true);

ASKER CERTIFIED SOLUTION
Avatar of Mick Barry
Mick Barry
Flag of Australia image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
Avatar of Mick Barry
Mick Barry
Flag of Australia image

add them to the app servers classpath.
Avatar of CEHJ
CEHJ
Flag of United Kingdom of Great Britain and Northern Ireland image

That shouldn't be necessary - they are being loaded by the web app
Avatar of makam_75
makam_75

ASKER

I have put the charts.jar in web-inf/lib directory and restarted the iplanet server.

Could it be that my webserver is not able to run servlets? could you give me a simple sample servlet that i could try and make sure it works.

( i have some jsp files calling java beans and connecting to database and all that works just fine)
I only have problem with this jfreechart.
Avatar of CEHJ
CEHJ
Flag of United Kingdom of Great Britain and Northern Ireland image

>>Could it be that my webserver is not able to run servlets?

There's every sign it's doing so OK
Avatar of CEHJ
CEHJ
Flag of United Kingdom of Great Britain and Northern Ireland image

>>i have some jsp files

These *are* servlets essentially
Avatar of Mick Barry
Mick Barry
Flag of Australia image

> Could it be that my webserver is not able to run servlets?

your servlet is getting run, it is not finding your freechart classes.
Add them to your iplanet classpath and see if that fixes it.
Avatar of CEHJ
CEHJ
Flag of United Kingdom of Great Britain and Northern Ireland image

>>I have put the charts.jar in web-inf/lib directory

It must be of the web app you're running and not any other. Make sure there aren't any other jars omitted too
Avatar of makam_75
makam_75

ASKER

I am not getting a page not found.
I am getting a server error. does that mean it is finding the class files?
Avatar of Mick Barry
Mick Barry
Flag of Australia image

> does that mean it is finding the class files?

No it means your servlet is executing, but it cannot find a class it requires.
Did you try changing the classpath yet?
Avatar of makam_75
makam_75

ASKER

The problm was one jar file i had on server was jcommon ver9.jar but in my local, i had jcommon8.jar and some methods were deprecated and not working in version9.
I replaced the jar file with jcommon8, and all is working fine.

Thanks both for pointing me in right direction - to look at the jars.
  I kept on thinking it is display issue for some reason and spent all my time finding differnet ways to set display.

Avatar of CEHJ
CEHJ
Flag of United Kingdom of Great Britain and Northern Ireland image

8-)
Avatar of Mick Barry
Mick Barry
Flag of Australia image

(:
Java
Java

Java is a platform-independent, object-oriented programming language and run-time environment, designed to have as few implementation dependencies as possible such that developers can write one set of code across all platforms using libraries. Most devices will not run Java natively, and require a run-time component to be installed in order to execute a Java program.

102K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo