Fix CentOS 7 under Tomcat font exception font ' Arial ' is not available to the JVM

Source: Internet
Author: User
Tags log4j



Error message:


SEVERE:Servlet.service () for the Servlet [example] in the context with path [/MyProject]threw exception [Request processing failed; nested exception is Net.sf.jasperreports.engine.util.JRFontNotFoundException:Font ' song body ' is not available to the JVM. See the Javadoc for more details.] With root cause
Net.sf.jasperreports.engine.util.JRFontNotFoundException:Font ' song Body ' is not available to the JVM. See the Javadoc for more details.
At Net.sf.jasperreports.engine.fonts.FontUtil.checkAwtFont (fontutil.java:356)
At Net.sf.jasperreports.engine.fill.SimpleTextLineWrapper.loadFont (simpletextlinewrapper.java:368)
At Net.sf.jasperreports.engine.fill.SimpleTextLineWrapper.getGeneralFontInfo (simpletextlinewrapper.java:338)
At Net.sf.jasperreports.engine.fill.SimpleTextLineWrapper.createFontInfo (simpletextlinewrapper.java:278)
At Net.sf.jasperreports.engine.fill.SimpleTextLineWrapper.start (simpletextlinewrapper.java:240)
At Net.sf.jasperreports.engine.fill.TextMeasurer.measure (textmeasurer.java:536)
At Net.sf.jasperreports.engine.fill.JRFillTextElement.chopTextElement (jrfilltextelement.java:670)
At Net.sf.jasperreports.engine.fill.JRFillTextField.prepare (jrfilltextfield.java:767)
At Net.sf.jasperreports.engine.fill.JRFillElementContainer.prepareElements (jrfillelementcontainer.java:330)
At Net.sf.jasperreports.engine.fill.JRFillBand.fill (jrfillband.java:382)
At Net.sf.jasperreports.engine.fill.JRFillBand.fill (jrfillband.java:357)
At Net.sf.jasperreports.engine.fill.JRVerticalFiller.fillBandNoOverflow (jrverticalfiller.java:433)
At Net.sf.jasperreports.engine.fill.JRVerticalFiller.fillPageHeader (jrverticalfiller.java:396)
At Net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReportStart (jrverticalfiller.java:257)
At Net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReport (jrverticalfiller.java:123)
At Net.sf.jasperreports.engine.fill.JRBaseFiller.fill (jrbasefiller.java:539)
At Net.sf.jasperreports.engine.fill.BaseReportFiller.fill (basereportfiller.java:411)
At Net.sf.jasperreports.engine.fill.JRFiller.fill (jrfiller.java:115)
At Net.sf.jasperreports.engine.JasperFillManager.fill (jasperfillmanager.java:667)
At Net.sf.jasperreports.engine.JasperFillManager.fillReport (jasperfillmanager.java:983)
At Org.springframework.web.servlet.view.jasperreports.AbstractJasperReportsView.fillReport ( abstractjasperreportsview.java:676)
At Com.opensourcedata.admin.controller.ApplicationIReportView.fillReport (applicationireportview.java:28)
At Org.springframework.web.servlet.view.jasperreports.AbstractJasperReportsView.renderMergedOutputModel ( abstractjasperreportsview.java:561)
At Org.springframework.web.servlet.view.AbstractView.render (abstractview.java:267)
At Org.springframework.web.servlet.DispatcherServlet.render (dispatcherservlet.java:1221)
At Org.springframework.web.servlet.DispatcherServlet.processDispatchResult (dispatcherservlet.java:1005)
At Org.springframework.web.servlet.DispatcherServlet.doDispatch (dispatcherservlet.java:952)
At Org.springframework.web.servlet.DispatcherServlet.doService (dispatcherservlet.java:870)
At Org.springframework.web.servlet.FrameworkServlet.processRequest (frameworkservlet.java:961)
At Org.springframework.web.servlet.FrameworkServlet.doPost (frameworkservlet.java:863)
At Javax.servlet.http.HttpServlet.service (httpservlet.java:650)
At Org.springframework.web.servlet.FrameworkServlet.service (frameworkservlet.java:837)
At Javax.servlet.http.HttpServlet.service (httpservlet.java:731)
At Org.apache.catalina.core.ApplicationFilterChain.internalDoFilter (applicationfilterchain.java:303)
At Org.apache.catalina.core.ApplicationFilterChain.doFilter (applicationfilterchain.java:208)
At Org.apache.tomcat.websocket.server.WsFilter.doFilter (wsfilter.java:52)
At Org.apache.catalina.core.ApplicationFilterChain.internalDoFilter (applicationfilterchain.java:241)
At Org.apache.catalina.core.ApplicationFilterChain.doFilter (applicationfilterchain.java:208)
At Com.opensourcedata.filter.SessionFilter.doFilterInternal (sessionfilter.java:62)
At Org.springframework.web.filter.OncePerRequestFilter.doFilter (onceperrequestfilter.java:107)
At Org.apache.catalina.core.ApplicationFilterChain.internalDoFilter (applicationfilterchain.java:241)
At Org.apache.catalina.core.ApplicationFilterChain.doFilter (applicationfilterchain.java:208)
At Org.apache.catalina.core.StandardWrapperValve.invoke (standardwrappervalve.java:220)
At Org.apache.catalina.core.StandardContextValve.invoke (standardcontextvalve.java:122)
At Org.apache.catalina.authenticator.AuthenticatorBase.invoke (authenticatorbase.java:505)
At Org.apache.catalina.core.StandardHostValve.invoke (standardhostvalve.java:169)
At Org.apache.catalina.valves.ErrorReportValve.invoke (errorreportvalve.java:103)
At Org.apache.catalina.valves.AccessLogValve.invoke (accesslogvalve.java:956)
At Org.apache.catalina.core.StandardEngineValve.invoke (standardenginevalve.java:116)
At Org.apache.catalina.connector.CoyoteAdapter.service (coyoteadapter.java:436)
At Org.apache.coyote.http11.AbstractHttp11Processor.process (abstracthttp11processor.java:1078)
At Org.apache.coyote.abstractprotocol$abstractconnectionhandler.process (abstractprotocol.java:625)
At Org.apache.tomcat.util.net.jioendpoint$socketprocessor.run (jioendpoint.java:316)
At Java.util.concurrent.ThreadPoolExecutor.runWorker (threadpoolexecutor.java:1142)
At Java.util.concurrent.threadpoolexecutor$worker.run (threadpoolexecutor.java:617)
At Org.apache.tomcat.util.threads.taskthread$wrappingrunnable.run (taskthread.java:61)
At Java.lang.Thread.run (thread.java:745)
Solution:


1. Conform to the font file under Windows, because the missing is the song body, then the song body, copied to the server






2. Enter the JSP project under the classes directory
[Email protected] ~]# cd/usr/share/tomcat/webapps/myproject/web-inf/classes/
[[email protected] classes]# ls
Applicationcontext.xml com config.properties ehcache-hibernate.xml log4j.xml



3. Copy the font file you just uploaded to this directory
[email protected] classes]# CP ~/simsunb. TTF.
L[[email protected] classes]# ls
Applicationcontext.xml com config.properties ehcache-hibernate.xml log4j.xml Simsunb. TTF



4. Edit a jasperreports.properties file
[Email protected] classes]# vim jasperreports.properties
Enter the following in the file:


net.sf.jasperreports.awt.ignore.missing.font=true 



5. Restart the Tomcat service



[Email protected] ~]# systemctl restart Tomcat.service



Fix CentOS 7 under Tomcat font exception font ' Arial ' is not available to the JVM


Related Article

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.