0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

JasperReportでJRFontNotFoundExceptionが発生

Last updated at Posted at 2019-07-11

不具合

  • JAVAアプリケーションからJasperReportでExcel帳票出力時に例外が発生
    • Caused by: net.sf.jasperreports.engine.util.JRFontNotFoundException: Font 'MS Pゴシック' is not available to the JVM. See the Javadoc for more details.

環境

  • WindowsServer 2012 R2(評価環境)
  • tomcat6
  • JDK8
  • Jasperreport Studio 6.6.0

調査

  • jasperファイルにfontを埋め込めば解決すると思われるが、デプロイするバイナリはできあがっており、同じ構成の運用環境では問題なく動作しているめ、バイナリは変更不可。
  • Linux等ではWindowsServerのjre/lib/fontsにMSGOTHIC.ttcファイルをコピーして動作したという報告もあり、試してみたが解決せず。
  • もともとWindowsでは、jdk\jre\lib\fontconfig.properties.src の設定でフォントの読み替えていて、"MS Pゴシック"と日本語で定義されていないことが問題かもと思ったが、他の環境では動作しているのでOS環境を疑ってみることにしました。
fontconfig.properties.src
...
proportional.MS_Gothic=MS PGothic
...
filename.MS_PGothic=MSGOTHIC.TTC
...

解決

  • そこで、UI全般が英語になっていたことに気づいて、OS環境を日本語化することいしました。
  • 結局、ユーザーアカウントの言語を日本語に変更し、システムアカウントにコピーすることで解決しました。
  • 原因は、WindowsServerのシステムアカウントの言語が英語になっていたためと思われます。(具体的な手順は、参考にWindows Serve 2012, 2012R2の日本語化手順の通りに操作しました)

参考

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?