Solve the problem of an error when deploying jasperreport in centos. Error: net. SF. jasperreports. Engine. util. jrfontnotfoundexception: font

Source: Internet
Author: User

 

An error occurred while deploying jasperreport in centos:

 

Net. SF. jasperreports. Engine. util. jrfontnotfoundexception: font 'body' is not available to the JVM. See the javadoc for more details.

 

Cause: the default Operating System language is English. Modify it to Chinese and copy the font of windows to the Linux system and apply it. Stop Tomcat and other web servers and delete the cache (Tomcat is the work directory under the Tomcat directory.

Method:

Modify the default system language:

Vim/etc/sysconfig/i18n

Content:

Lang = "en_US.UTF-8"

Copy Font:

Run "C: \ WINDOWS \ fonts" (download simsun. TTF from the Internet. The name "Le" is not included in the self-contained "Le "file in Windows ).
Copy the font to/usr/share/fonts/Chinese (My is centos6, and my own Chinese directory under the fonts directory)

Execute the following commands in sequence

CD/usr/share/fonts/Chinese

Mkfontscale Mkfontdir FC-Cache


Go to the Tomcat directory, stop the Tomcat service, and delete the work directory.

Restart the system: reboot

Test. OK!

 

 

After testing, the above method cannot solve the problem forever.

The following methods help solve my problem conveniently and quickly:

 

 

Solution:

1. Copy the required font (c: \ windows \ fonts can be copied directly) to the classpath of the current project, which is generally under the classes directory.

2. Add the jasperreports. properties attribute file to classpath.

File Content:

Net. SF. jasperreports. AWT. Ignore. Missing. font = true

You can solve this problem.

 

 

 

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.