Java.lang.NoClassDefFoundError:Could not initialize class Org.jfree.chart.JFreeChart

Source: Internet
Author: User

Recently in the use of Jfreechart to generate the chart, found that the project is running well locally, a deployment to the server (Linux system) does not, reported the error: Java.lang.NoClassDefFoundError:Could not Initialize class Org.jfree.chart.JFreeChart, later after the search to solve, see as follows:

1. First, this is related to the Linux system on the server, because the Linux system itself is no graphical interface, so in jfreechart chart = Chartfactory.createbarchart3d ("Outgoing result", "", "value", DataSet, Plotorientation.vertical,false, True, false); The Times made a mistake.

The 2.Tomcat changes are as follows:

After you open the%tomcat_home%/bin/catalina.sh file in-djava.io.tmpdir= "$CATALINA _tmpdir", the script that launches Tomcat is added:-djava.awt.headless= True \

"$_runjava" $JAVA _opts $CATALINA _opts
-djava.endorsed.dirs= "$JAVA _endorsed_dirs"
-classpath "$CLASSPATH"
-dcatalina.base= "$CATALINA _base"
-dcatalina.home= "$CATALINA _home"
-djava.io.tmpdir= "$CATALINA _tmpdir"
  -djava.awt.headless=true

Once saved, the graphics can be processed by restarting.

The 3.headless mode itself is a system pattern, which is a system configuration when a display, keyboard, or mouse is missing. It sounds incredible, but in fact you can do different things in this mode, even with graphical data. Where can I use this mode? Think of your app to generate a picture, for example, to generate a certified image each time a user logs in. When creating a picture, you need to apply neither the monitor nor the keyboard. Let's assume that your application now has a master architecture or a proprietary server, but this service does not have a monitor, keyboard or mouse. The ideal decision is to use the vast amount of visual computing power of the environment rather than the non-visual nature. Images generated in headless mode can be passed to the headful system for deeper rendering.

Java.lang.NoClassDefFoundError:Could not initialize class Org.jfree.chart.JFreeChart

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.