Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7579475
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T17:41:24+00:00 2026-05-30T17:41:24+00:00

I do not use JasperServer, instead I created a webapp using JasperReport 4.0.2 directly.

  • 0

I do not use JasperServer, instead I created a webapp using JasperReport 4.0.2 directly.

Templates are not in the default classloader, there are added, using a ContextClassLoader before calling JasperReport.

In recent version of Jasper Report font management changed as indicated in this document. Therefore I need to provide the Font JARs, which works when I put them in the WEB-INF/lib directory directly.

However, for modularity reasons I would like to add them to the classpath using the same ContextClassloader as done with the templates, but in that case, texts are not rendered with the correct font.

I do think this has something to do with the way JasperReport loads the Font.
Using a debugger I could track it back to the net.sf.jasperreports.engine.util.getFontInfo(...) method that does not return the same result.

This is due to the fact that ExtensionsEnvironment.getExtensionsRegistry().getExtensions(FontFamily.class) does not returns the same family list in both cases. Extensions are only loaded when JARs are place in WEB-INF/lib.

Does someone knows how the net.sf.jasperreports.extensions.getExtensionsRegistry() could be adapted to retrieve threadRegistry instance instead? (must be initialized somehow I guess).

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T17:41:26+00:00Added an answer on May 30, 2026 at 5:41 pm

    This issue seems to be a duplicate of http://jasperforge.org/plugins/espforum/view.php?group_id=102&forumid=103&topicid=76180

    When JasperReport load the extension (lazily, on first use) the font extension is uses JasperReport Classloader, not the context class loader.

     From JRLoader.getClassLoaderResources(String) line:
                Map<URL, ClassLoaderResource> resources =
                      new LinkedHashMap<URL, ClassLoaderResource>();
                collectResources(resource, JRLoader.class.getClassLoader(), resources);
    

    JRLoader.collectResources then get a list of all classloader by iterating on .getParent().

    Using Thread.currentThread().getContextClassLoader() instead an handling errors should provide the extended classloader (which need to have JRLoader.class.getClassLoader() set as parent).

    Changing the classloader used in JasperReport code fixes the issue but could however have side effects on other use cases.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Duplicate: Tables instead of DIVs and Why not use tables for layout in HTML?
Why would a language NOT use Short-circuit evaluation ? Are there any benefits of
Our current project does not use Hibernate (for various reasons) and we are using
Possible Duplicate: Why not use tables for layout in HTML? i know that using
My gridview does not use controls, because it is populated using expressions <asp:TemplateField HeaderText=As
Is there anyway we can use Google App Engine but do not use google's
Although it would be nice to not use PDF, we are using a legacy
I want to not use the built in Websphere 7 jpa plugin, instead use
It seems phonegap does not use GPS satellite instead geolocation from cellular network. I
If I use object initializers in using-block I get Code Analysis warning about not

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.