12 June 2018

-Djava.awt.headless=true

There is a common issue when creating PDF in WebLogic Server:


<[ServletContext@26791009[app:foo-rest module:foo-rest.war path:null spec-version:3.0]] Root cause of ServletException.
java.lang.NoClassDefFoundError: Could not initialize class net.sf.jasperreports.engine.util.JRStyledTextParser
                at net.sf.jasperreports.engine.fill.JRBaseFiller.(JRBaseFiller.java:108)
                at net.sf.jasperreports.engine.fill.JRVerticalFiller.(JRVerticalFiller.java:69)
                at net.sf.jasperreports.engine.fill.JRVerticalFiller.(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)
                Truncated. see log file for complete stacktrace

...
...
<[ServletContext@1852380706[app:bar module:bar.war path:null spec-version:3.0]] Root cause of ServletException.
java.lang.NoClassDefFoundError: Could not initialize class sun.awt.X11GraphicsEnvironment
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:195)
        at java.awt.GraphicsEnvironment.createGE(GraphicsEnvironment.java:102)
        at java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment(GraphicsEnvironment.java:81)
        at net.sf.jasperreports.engine.util.JRStyledTextParser.(JRStyledTextParser.java:94)
        at net.sf.jasperreports.engine.fill.JRBaseFiller.(JRBaseFiller.java:108)
        at net.sf.jasperreports.engine.fill.JRVerticalFiller.(JRVerticalFiller.java:69)
        at net.sf.jasperreports.engine.fill.JRVerticalFiller.(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)
        at cl.ejemplo.common.reporteria.service.impl.ReporteriaServiceJasperImpl.construirBarFooReporte(ReporteriaServiceJasperImpl.java:306)
        at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)


This is solved by adding the following argument to WLS script:

 -Djava.awt.headless=true

No comments :

My Blog List

Blog Archive

Disclaimer

The views expressed on this blog are my own and do not necessarily reflect the views of Oracle.