JasperReports NoClassDefFoundError exception on net.sf.jasperreports.engine.util.JRStyledTextParser

后端 未结 11 1442
旧巷少年郎
旧巷少年郎 2020-12-01 06:26

When trying to export on WebLogic 11g, it throws NoClassDefFound exception. I checked the application WAR and jasperreports-3.7.4.jar is included in WEB-INF/lib folder. What

相关标签:
11条回答
  • 2020-12-01 06:52

    I had the same issue and it was resolved by reducing the /tmp space. It was 100% (/tmp folder). I reduced it to 86% and restarted the server and the noclassdefinitionerror was gone and issue was resolved.

    0 讨论(0)
  • 2020-12-01 07:06

    Text Parsing Exception means the font not have been recognized. I spent an whole day trying to understand why, then finally I fix this problem using text SansSerif. On Linux only a few font can be parsed. Hoping has helped, best regards

    0 讨论(0)
  • 2020-12-01 07:09

    Once you have this problem, googling will bring you here. For me the problem was Jdk 11.2.

    Caused by: java.lang.reflect.InvocationTargetException
            at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
            at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
            at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
            at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
            at java.desktop/sun.font.FontManagerFactory$1.run(FontManagerFactory.java:84)
            ... 85 more
    Caused by: java.lang.NullPointerException
            at java.desktop/sun.awt.FontConfiguration.getVersion(FontConfiguration.java:1262)
            at java.desktop/sun.awt.FontConfiguration.readFontConfigFile(FontConfiguration.java:225)
            at java.desktop/sun.awt.FontConfiguration.init(FontConfiguration.java:107)
            at java.desktop/sun.awt.X11FontManager.createFontConfiguration(X11FontManager.java:719)
            at java.desktop/sun.font.SunFontManager$2.run(SunFontManager.java:367)
            at java.base/java.security.AccessController.doPrivileged(Native Method)
            at java.desktop/sun.font.SunFontManager.<init>(SunFontManager.java:312)
            at java.desktop/sun.awt.FcFontManager.<init>(FcFontManager.java:35)
            at java.desktop/sun.awt.X11FontManager.<init>(X11FontManager.java:56)
            ... 90 more
    java.lang.InternalError: java.lang.reflect.InvocationTargetException
            at java.desktop/sun.font.FontManagerFactory$1.run(FontManagerFactory.java:86)
            at java.base/java.security.AccessController.doPrivileged(Native Method)
            at java.desktop/sun.font.FontManagerFactory.getInstance(FontManagerFactory.java:74)
            at java.desktop/sun.java2d.SunGraphicsEnvironment.getFontManagerForSGE(SunGraphicsEnvironment.java:189)
            at java.desktop/sun.java2d.SunGraphicsEnvironment.getAvailableFontFamilyNames(SunGraphicsEnvironment.java:223)
            at java.desktop/sun.java2d.SunGraphicsEnvironment.getAvailableFontFamilyNames(SunGraphicsEnvironment.java:251)
            at java.desktop/sun.java2d.HeadlessGraphicsEnvironment.getAvailableFontFamilyNames(HeadlessGraphicsEnvironment.java:75)
            at net.sf.jasperreports.engine.util.JRStyledTextParser.<clinit>(JRStyledTextParser.java:94)
            at net.sf.jasperreports.engine.fill.JRBaseFiller.<init>(JRBaseFiller.java:110)
            at net.sf.jasperreports.engine.fill.JRVerticalFiller.<init>(JRVerticalFiller.java:69)
            at net.sf.jasperreports.engine.fill.JRVerticalFiller.<init>(JRVerticalFiller.java:57)
            at net.sf.jasperreports.engine.fill.JRFiller.createBandReportFiller(JRFiller.java:200)
            at net.sf.jasperreports.engine.fill.JRFiller.createReportFiller(JRFiller.java:215)
            at net.sf.jasperreports.engine.fill.JRFiller.fill(JRFiller.java:115)
            at net.sf.jasperreports.engine.JasperFillManager.fill(JasperFillManager.java:667)
    

    Solutions tried

    • Ran locally with JDK 11.02. No problems. Because the problems happens on linux 64 systems
    • Ran on server -Djava-awt.headeless=true as suggested by some users . Problem still remains.

    Reason this problem occurs is because support of certain fonts have been removed

    From Oracle release notes https://www.oracle.com/technetwork/java/javase/11-relnote-issues-5012449.html#Removed

    Removal of Lucida Fonts from Oracle JDK Oracle JDK no longer ships any fonts and relies entirely on fonts installed on the operating system.

    This means that fonts in the Bigelow & Holmes Lucida family (Lucida Sans, Lucida Bright, and Lucida Typewriter) are no longer available to applications from the JDK.

    If applications rely on fonts shipped in the JDK, they may need to be updated.

    If system adminstrators are running Java server applications that rely on fonts shipped in the JDK rather than on system font packages, then the applications may fail to run until the system font packages are installed.

    Go back to previous version of JDK or you can try upgrading Jasper.

    0 讨论(0)
  • 2020-12-01 07:13

    We had similar issue. we resolved it by using the jasper java flow jar file. the

    java.awt.headless=true
    

    didn't work for us.

    0 讨论(0)
  • 2020-12-01 07:15

    Faced this issue multiple times and I have got the solution. This error comes due to lack of memory space on disk... You can try below things to solve : (i) Make enough space in tmp folder (ii) Delete some unnecessary files on the disk to make some space.

    Good luck..Hope.. it should solve your issue

    0 讨论(0)
  • 2020-12-01 07:16

    Finally, I've got it working. I detected the root Exception, which was thrown before NoClassDefFoundError:net/sf/jasperreports/engine/util/JRStyledTextParser :

    java.lang.NoClassDefFoundError: sun/awt/X11GraphicsEnvironment
    

    The Sun AWT classes on Unix and Linux have a dependence on the X Window System. When you use these classes, they expect to load X client libraries and be able to talk to an X display server. This makes sense if your client has a GUI; unfortunately, it's required even if your client uses AWT but does not have a GUI (which is my case, generating a report from a web application)

    The way to bypass this, is setting a system property java.awt.headless=true on system startup.

    0 讨论(0)
提交回复
热议问题