java.lang.NullPointerException

ZK-Tracker | hawk | 3 years ago
tip
Your exception is missing from the Samebug knowledge base.
Here are the best solutions we found on the Internet.
Click on the to mark the helpful solution and get rewards for you help.
  1. 0

    h2. Steps to Reproduce # put the library property below in zk.xml {code} <library-property> <name>org.zkoss.zss.chart.title.font</name> <value>sansserif, bold, 30</value> </library-property> {code} # run zssapp # load demo_sample.xlsx # export to pdf h3. Actual Result *Exception thrown in 3.6* {code} ExceptionConverter: java.io.IOException: The document has no pages. at com.lowagie.text.pdf.PdfPages.writePageTree(Unknown Source) at com.lowagie.text.pdf.PdfWriter.close(Unknown Source) at com.lowagie.text.pdf.PdfDocument.close(Unknown Source) at com.lowagie.text.Document.close(Unknown Source) at org.zkoss.zss.model.impl.pdf.PdfExporter.export(PdfExporter.java:263 ) at org.zkoss.zss.api.impl.ExporterImpl.export(ExporterImpl.java:49 ) at org.zkoss.zss.essential.ExportPdfComposer.doExport(ExportPdfComposer.java:41) at sun.reflect.NativeMethodAccessorImpl.invoke0( Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39 ) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25 ) at java.lang.reflect.Method.invoke( Method.java:597) at org.zkoss.zk.ui.select.Selectors$ComposerEventListener.onEvent(Selectors.java:681) at org.zkoss.zk.ui.AbstractComponent.onEvent(AbstractComponent.java:2752 ) at org.zkoss.zk.ui.AbstractComponent.service(AbstractComponent.java:2723 ) at org.zkoss.zk.ui.AbstractComponent.service(AbstractComponent.java:2664 ) at org.zkoss.zk.ui.impl.EventProcessor.process(EventProcessor.java:136 ) at org.zkoss.zk.ui.impl.UiEngineImpl.processEvent(UiEngineImpl.java:1765 ) at org.zkoss.zk.ui.impl.UiEngineImpl.process(UiEngineImpl.java:1550 ) at org.zkoss.zk.ui.impl.UiEngineImpl.execUpdate(UiEngineImpl.java:1260 ) at org.zkoss.zk.au.http.DHtmlUpdateServlet.process(DHtmlUpdateServlet.java:603 ) at org.zkoss.zk.au.http.DHtmlUpdateServlet.doGet(DHtmlUpdateServlet.java:485 ) at org.zkoss.zk.au.http.DHtmlUpdateServlet.doPost(DHtmlUpdateServlet.java:494 ) {code} *Exception thrown in 3.5* {code} java.lang.NullPointerException at org.zkoss.zssex.util.ZssChartExportEngine.drawJFreeChart(ZssChartExportEngine.java:99) at org.zkoss.zssex.util.ChartHelper.drawJFreeChart(ChartHelper.java:78) at org.zkoss.zss.model.impl.pdf.PdfExporter.layoutCharts(PdfExporter.java:999) at org.zkoss.zss.model.impl.pdf.PdfExporter.access$1500(PdfExporter.java:86) at org.zkoss.zss.model.impl.pdf.PdfExporter$PdfHeaderFooter.onEndPage(PdfExporter.java:1613) at com.lowagie.text.pdf.PdfDocument.newPage(Unknown Source) at com.lowagie.text.Document.newPage(Unknown Source) at org.zkoss.zss.model.impl.pdf.PdfExporter.printColumns(PdfExporter.java:581) at org.zkoss.zss.model.impl.pdf.PdfExporter.exportSheet(PdfExporter.java:302) at org.zkoss.zss.model.impl.pdf.PdfExporter.export(PdfExporter.java:182) at org.zkoss.zss.api.impl.ExporterImpl.export(ExporterImpl.java:49) at org.zkoss.zss.essential.ExportPdfComposer.doExport(ExportPdfComposer.java:57) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.zkoss.zk.ui.select.Selectors$ComposerEventListener.onEvent(Selectors.java:681) at org.zkoss.zk.ui.AbstractComponent.onEvent(AbstractComponent.java:2746) at org.zkoss.zk.ui.AbstractComponent.service(AbstractComponent.java:2717) at org.zkoss.zk.ui.AbstractComponent.service(AbstractComponent.java:2658) at org.zkoss.zk.ui.impl.EventProcessor.process(EventProcessor.java:136) at org.zkoss.zk.ui.impl.UiEngineImpl.processEvent(UiEngineImpl.java:1765) at org.zkoss.zk.ui.impl.UiEngineImpl.process(UiEngineImpl.java:1550) at org.zkoss.zk.ui.impl.UiEngineImpl.execUpdate(UiEngineImpl.java:1260) at org.zkoss.zk.au.http.DHtmlUpdateServlet.process(DHtmlUpdateServlet.java:603) at org.zkoss.zk.au.http.DHtmlUpdateServlet.doGet(DHtmlUpdateServlet.java:485) at org.zkoss.zk.au.http.DHtmlUpdateServlet.doPost(DHtmlUpdateServlet.java:494) at javax.servlet.http.HttpServlet.service(HttpServlet.java:727) at javax.servlet.http.HttpServlet.service(HttpServlet.java:820) at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511) at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:401) at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216) at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182) at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:766) at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:450) at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152) at org.mortbay.jetty.Server.handle(Server.java:326) at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542) at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:945) at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:756) at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:218) at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404) at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:410) at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582) {code} h2. Debug Information From exception thrown in 3.5, I think root cause is in ZssChartExportEngine {code} final Font tfont = ChartHelper.getCustomFont(ChartHelper.TITLE_FONT_PROPERTY_KEY); if (tfont != null) { jfchart.getTitle().setFont(tfont); } {code} because chart title might be null.

    ZK-Tracker | 3 years ago | hawk
    java.lang.NullPointerException
  2. 0

    h2. Steps to Reproduce # put the library property below in zk.xml {code} <library-property> <name>org.zkoss.zss.chart.title.font</name> <value>sansserif, bold, 30</value> </library-property> {code} # run zssapp # load demo_sample.xlsx # export to pdf h3. Actual Result *Exception thrown in 3.6* {code} ExceptionConverter: java.io.IOException: The document has no pages. at com.lowagie.text.pdf.PdfPages.writePageTree(Unknown Source) at com.lowagie.text.pdf.PdfWriter.close(Unknown Source) at com.lowagie.text.pdf.PdfDocument.close(Unknown Source) at com.lowagie.text.Document.close(Unknown Source) at org.zkoss.zss.model.impl.pdf.PdfExporter.export(PdfExporter.java:263 ) at org.zkoss.zss.api.impl.ExporterImpl.export(ExporterImpl.java:49 ) at org.zkoss.zss.essential.ExportPdfComposer.doExport(ExportPdfComposer.java:41) at sun.reflect.NativeMethodAccessorImpl.invoke0( Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39 ) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25 ) at java.lang.reflect.Method.invoke( Method.java:597) at org.zkoss.zk.ui.select.Selectors$ComposerEventListener.onEvent(Selectors.java:681) at org.zkoss.zk.ui.AbstractComponent.onEvent(AbstractComponent.java:2752 ) at org.zkoss.zk.ui.AbstractComponent.service(AbstractComponent.java:2723 ) at org.zkoss.zk.ui.AbstractComponent.service(AbstractComponent.java:2664 ) at org.zkoss.zk.ui.impl.EventProcessor.process(EventProcessor.java:136 ) at org.zkoss.zk.ui.impl.UiEngineImpl.processEvent(UiEngineImpl.java:1765 ) at org.zkoss.zk.ui.impl.UiEngineImpl.process(UiEngineImpl.java:1550 ) at org.zkoss.zk.ui.impl.UiEngineImpl.execUpdate(UiEngineImpl.java:1260 ) at org.zkoss.zk.au.http.DHtmlUpdateServlet.process(DHtmlUpdateServlet.java:603 ) at org.zkoss.zk.au.http.DHtmlUpdateServlet.doGet(DHtmlUpdateServlet.java:485 ) at org.zkoss.zk.au.http.DHtmlUpdateServlet.doPost(DHtmlUpdateServlet.java:494 ) {code} *Exception thrown in 3.5* {code} java.lang.NullPointerException at org.zkoss.zssex.util.ZssChartExportEngine.drawJFreeChart(ZssChartExportEngine.java:99) at org.zkoss.zssex.util.ChartHelper.drawJFreeChart(ChartHelper.java:78) at org.zkoss.zss.model.impl.pdf.PdfExporter.layoutCharts(PdfExporter.java:999) at org.zkoss.zss.model.impl.pdf.PdfExporter.access$1500(PdfExporter.java:86) at org.zkoss.zss.model.impl.pdf.PdfExporter$PdfHeaderFooter.onEndPage(PdfExporter.java:1613) at com.lowagie.text.pdf.PdfDocument.newPage(Unknown Source) at com.lowagie.text.Document.newPage(Unknown Source) at org.zkoss.zss.model.impl.pdf.PdfExporter.printColumns(PdfExporter.java:581) at org.zkoss.zss.model.impl.pdf.PdfExporter.exportSheet(PdfExporter.java:302) at org.zkoss.zss.model.impl.pdf.PdfExporter.export(PdfExporter.java:182) at org.zkoss.zss.api.impl.ExporterImpl.export(ExporterImpl.java:49) at org.zkoss.zss.essential.ExportPdfComposer.doExport(ExportPdfComposer.java:57) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.zkoss.zk.ui.select.Selectors$ComposerEventListener.onEvent(Selectors.java:681) at org.zkoss.zk.ui.AbstractComponent.onEvent(AbstractComponent.java:2746) at org.zkoss.zk.ui.AbstractComponent.service(AbstractComponent.java:2717) at org.zkoss.zk.ui.AbstractComponent.service(AbstractComponent.java:2658) at org.zkoss.zk.ui.impl.EventProcessor.process(EventProcessor.java:136) at org.zkoss.zk.ui.impl.UiEngineImpl.processEvent(UiEngineImpl.java:1765) at org.zkoss.zk.ui.impl.UiEngineImpl.process(UiEngineImpl.java:1550) at org.zkoss.zk.ui.impl.UiEngineImpl.execUpdate(UiEngineImpl.java:1260) at org.zkoss.zk.au.http.DHtmlUpdateServlet.process(DHtmlUpdateServlet.java:603) at org.zkoss.zk.au.http.DHtmlUpdateServlet.doGet(DHtmlUpdateServlet.java:485) at org.zkoss.zk.au.http.DHtmlUpdateServlet.doPost(DHtmlUpdateServlet.java:494) at javax.servlet.http.HttpServlet.service(HttpServlet.java:727) at javax.servlet.http.HttpServlet.service(HttpServlet.java:820) at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511) at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:401) at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216) at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182) at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:766) at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:450) at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152) at org.mortbay.jetty.Server.handle(Server.java:326) at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542) at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:945) at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:756) at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:218) at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404) at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:410) at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582) {code} h2. Debug Information From exception thrown in 3.5, I think root cause is in ZssChartExportEngine {code} final Font tfont = ChartHelper.getCustomFont(ChartHelper.TITLE_FONT_PROPERTY_KEY); if (tfont != null) { jfchart.getTitle().setFont(tfont); } {code} because chart title might be null.

    ZK-Tracker | 3 years ago | hawk
    java.lang.NullPointerException

    Root Cause Analysis

    1. java.lang.NullPointerException

      No message provided

      at org.zkoss.zssex.util.ZssChartExportEngine.drawJFreeChart()
    2. org.zkoss.zssex
      ChartHelper.drawJFreeChart
      1. org.zkoss.zssex.util.ZssChartExportEngine.drawJFreeChart(ZssChartExportEngine.java:99)
      2. org.zkoss.zssex.util.ChartHelper.drawJFreeChart(ChartHelper.java:78)
      2 frames
    3. org.zkoss.zss
      PdfExporter$PdfHeaderFooter.onEndPage
      1. org.zkoss.zss.model.impl.pdf.PdfExporter.layoutCharts(PdfExporter.java:999)
      2. org.zkoss.zss.model.impl.pdf.PdfExporter.access$1500(PdfExporter.java:86)
      3. org.zkoss.zss.model.impl.pdf.PdfExporter$PdfHeaderFooter.onEndPage(PdfExporter.java:1613)
      3 frames
    4. iText-4.2.1
      Document.newPage
      1. com.lowagie.text.pdf.PdfDocument.newPage(Unknown Source)
      2. com.lowagie.text.Document.newPage(Unknown Source)
      2 frames
    5. org.zkoss.zss
      ExportPdfComposer.doExport
      1. org.zkoss.zss.model.impl.pdf.PdfExporter.printColumns(PdfExporter.java:581)
      2. org.zkoss.zss.model.impl.pdf.PdfExporter.exportSheet(PdfExporter.java:302)
      3. org.zkoss.zss.model.impl.pdf.PdfExporter.export(PdfExporter.java:182)
      4. org.zkoss.zss.api.impl.ExporterImpl.export(ExporterImpl.java:49)
      5. org.zkoss.zss.essential.ExportPdfComposer.doExport(ExportPdfComposer.java:57)
      5 frames
    6. Java RT
      Method.invoke
      1. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      2. sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      3. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      4. java.lang.reflect.Method.invoke(Method.java:597)
      4 frames
    7. ZK Kernel
      DHtmlUpdateServlet.doPost
      1. org.zkoss.zk.ui.select.Selectors$ComposerEventListener.onEvent(Selectors.java:681)
      2. org.zkoss.zk.ui.AbstractComponent.onEvent(AbstractComponent.java:2746)
      3. org.zkoss.zk.ui.AbstractComponent.service(AbstractComponent.java:2717)
      4. org.zkoss.zk.ui.AbstractComponent.service(AbstractComponent.java:2658)
      5. org.zkoss.zk.ui.impl.EventProcessor.process(EventProcessor.java:136)
      6. org.zkoss.zk.ui.impl.UiEngineImpl.processEvent(UiEngineImpl.java:1765)
      7. org.zkoss.zk.ui.impl.UiEngineImpl.process(UiEngineImpl.java:1550)
      8. org.zkoss.zk.ui.impl.UiEngineImpl.execUpdate(UiEngineImpl.java:1260)
      9. org.zkoss.zk.au.http.DHtmlUpdateServlet.process(DHtmlUpdateServlet.java:603)
      10. org.zkoss.zk.au.http.DHtmlUpdateServlet.doGet(DHtmlUpdateServlet.java:485)
      11. org.zkoss.zk.au.http.DHtmlUpdateServlet.doPost(DHtmlUpdateServlet.java:494)
      11 frames
    8. JavaServlet
      HttpServlet.service
      1. javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
      2. javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
      2 frames
    9. Jetty Server
      SelectChannelEndPoint.run
      1. org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511)
      2. org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:401)
      3. org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
      4. org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
      5. org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:766)
      6. org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:450)
      7. org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
      8. org.mortbay.jetty.Server.handle(Server.java:326)
      9. org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542)
      10. org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:945)
      11. org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:756)
      12. org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:218)
      13. org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
      14. org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:410)
      14 frames
    10. Jetty Util
      QueuedThreadPool$PoolThread.run
      1. org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582)
      1 frame