2

I have configured compiling Jasper Report in JSP page. I have done in connecting to database, collecting the JRXML file as well as the parameters for the report and given in below:

JasperDesign jasperDesign = JRXmlLoader.load(reportFile);
jasperDesign.setLanguage(language);
JasperReport jasperReport = JasperCompileManager.compileReport(jasperDesign);
JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport, jasperParameter, jdbcConnection); //line4

While the report is generating I get error in line 4.

What I get is:

 exception 
org.apache.jasper.JasperException: javax.servlet.ServletException: java.lang.ExceptionInInitializerError
    org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:549)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:455)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
root cause 
javax.servlet.ServletException: java.lang.ExceptionInInitializerError
    org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:930)
    org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:863)
    org.apache.jsp.QuaLIS.jasperReport_jsp._jspService(jasperReport_jsp.java:488)
    org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
root cause 
java.lang.ExceptionInInitializerError
    net.sf.jasperreports.engine.fill.JRBaseFiller.<init>(JRBaseFiller.java:121)
    net.sf.jasperreports.engine.fill.JRVerticalFiller.<init>(JRVerticalFiller.java:88)
    net.sf.jasperreports.engine.fill.JRVerticalFiller.<init>(JRVerticalFiller.java:103)
    net.sf.jasperreports.engine.fill.JRVerticalFiller.<init>(JRVerticalFiller.java:61)
    net.sf.jasperreports.engine.fill.JRFiller.createFiller(JRFiller.java:153)
    net.sf.jasperreports.engine.fill.JRFiller.fill(JRFiller.java:55)
    net.sf.jasperreports.engine.JasperFillManager.fill(JasperFillManager.java:446)
    net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:849)
    org.apache.jsp.QuaLIS.jasperReport_jsp._jspService(jasperReport_jsp.java:444)
    org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:722)

also says

java.lang.NoClassDefFoundError: Could not initialize class net.sf.jasperreports.engine.util.JRStyledTextParser

To brief you what i have done is:

  1. Gave startup property -Djava.awt.headless=true.
  2. Gave full access privileges to the jrxml files as well as the related JARS
  3. Checked whether temp folder exists in tomcat.
  4. Tried restarting the Tomcat/Server.
  5. The list of available JARS what I have is as listed below:
    jasper-compiler-jdt-5.5.23
    jasperreports-5.1.0
    jasperreports-chart-themes-4.5.0
    jasperreports-core-renderer
    jasperreports-extensions-3.5.3
    jasperreports-fonts-4.5.0
    jasperreports-htmlcomponent-4.1.1
    jasperreports-jtidy-r938

Looking forward for a solution. Thanks in advance!!!

Alex K
  • 22,315
  • 19
  • 108
  • 236
Ash Win
  • 115
  • 1
  • 10
  • Post the full stack trace. It looks like a JAR file is missing from the CLASSPATH. – Dave Jarvis Aug 10 '18 at 15:40
  • I read it as headless problem, probably it can't init the graphics context. – Petter Friberg Aug 10 '18 at 19:34
  • @Alex K, let me tell one more thing. Exactly the same set of deployment exists in another server which was copied from **THE** server which throws error, but the other server deployment works fine. Totally strange. Could there be any other cause for this problem. Considering you to remove the mark **Duplicate** and open the question again. – Ash Win Aug 11 '18 at 05:59
  • @PetterFriberg the headless problem was for other working environment like Linux,Unix. What i am using is Windows Server 2008. And yes i have also tried the headless and didn't work. Also mentioned it in a note of what all I have tried. – Ash Win Aug 11 '18 at 06:02
  • @AshWin the second dupe is good, try the solutions on that one also temp folder – Petter Friberg Aug 11 '18 at 08:16
  • `Exactly the same set of deployment exists in another server which was copied from THE server which throws error, but the other server deployment works fine.` - Is this docker/container? – Alex K Aug 11 '18 at 09:48
  • The server in which it is working right now is a VM of windows server 2012. One more thing ill brief about. The server in which I am facing the problem is physical server. The VM server is working without any issue. Few months ago I faced the same issue which was vice versa of current situation (i.e: Working in physical server, not working in VM server). Since it was VM, the server was revamped and magically the issue was resolved. But we can't revamp the physical server. So looking for the root cause of the problem. – Ash Win Aug 11 '18 at 10:31
  • Try to perform remote debug. BTW, did you try to reproduce this issue with standalone simple console application having similar classpath? – Alex K Aug 11 '18 at 19:23
  • Yes in standalone also this works well without problem. – Ash Win Aug 13 '18 at 09:47
  • I have seen the .tmp files in the temp folder are not created in the server causing the error, while the other server has .tmp files it. I have given all access privileges, checked the antivirus,checked the temp directory in the startup java options but still the file is not created. Any suggestion you got for this! – Ash Win Aug 13 '18 at 09:50

0 Answers0