java.lang.NullPointerException at de.laures.

2008-09-14
2013-01-13
  • Arnie Morein
    Arnie Morein
    2008-09-14

    I have a working chart in a JSF application that I want to enhance the formatting of the lines. I created the class:

    public class ChartPlacementRetentionPostProcessor extends BaseBean {
        private static final long serialVersionUID = 1L;

        public void processChart(JFreeChart chart, Map params) {
            CategoryPlot plot = (CategoryPlot)chart.getPlot();
            plot.setRangeGridlinePaint(Color.BLACK);
            plot.setRangeGridlinePaint(Color.BLACK);
           
            LineAndShapeRenderer renderer = (LineAndShapeRenderer)plot.getRenderer();
            renderer.setBaseShapesVisible(true);
            renderer.setBaseShapesFilled(true);
        };
    }

    and tried making it available in the Session and Request scopes. The taglib mentioned that this has to be it the pageContext - isn't session sufficient?

    Anyway, the relevant part of my JSF/JSP is:

    <f:subview id="theChart">
        <f:verbatim>   
            <cewolf:chart
                id="placementRetention"
                type="line"
                xaxislabel="Anniversary"
                yaxislabel="Successfuls">
                <cewolf:data>
                    <cewolf:producer id="chartPlacementRetentionData"/>
                </cewolf:data>
                <cewolf:chartpostprocessor id="placementRetentionPostProcessor">
                </cewolf:chartpostprocessor>
            </cewolf:chart>
            <cewolf:img chartid="placementRetention" alt="Placement Retention Chart" 
                renderer="/cewolf" border="1" width="800" height="600"/>
        </f:verbatim>
    </f:subview>

    The whole setup with the chart works fine WITHOUT the chart-post-processor tag. I keep getting the following. Does anyone have any idea why this is happening?

    2008-09-13 20:50:41,727 DEBUG [de.laures.cewolf.taglib.tags.ProducerTag] setting data config on de.laures.cewolf.taglib.tags.SimpleChartTag@d71041
    2008-09-13 20:50:41,727 DEBUG [de.laures.cewolf.taglib.tags.ProducerTag] useCache = true
    2008-09-13 20:50:41,727 DEBUG [de.laures.cewolf.taglib.ChartImageDefinition] setDataProductionConfig
    2008-09-13 20:50:41,727 DEBUG [de.laures.cewolf.taglib.ChartImageDefinition] checking data actuality...com.logipath.gict.cts.charting.placementRetention.ChartPlacementRetentionData@c66150, {de.laures.cewolf.DatasetProducer.id=chartPlacementRetentionData}
    2008-09-13 20:50:41,732 DEBUG [de.laures.cewolf.taglib.ChartImageDefinition] com.logipath.gict.cts.charting.placementRetention.ChartPlacementRetentionData, 2076134496
    2008-09-13 20:50:41,732 DEBUG [de.laures.cewolf.taglib.ChartImageDefinition] useCache = true
    2008-09-13 20:50:41,735 DEBUG [de.laures.cewolf.taglib.util.DatasetProductionTimesKey] data key is 2076134496 producerId=com.logipath.gict.cts.charting.placementRetention.ChartPlacementRetentionData
    2008-09-13 20:50:41,741 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost].[/CtsReports].[jsp]] Servlet.service() for servlet jsp threw exception
    java.lang.NullPointerException
        at de.laures.cewolf.taglib.tags.ChartPostProcessorTag.doEndTag(ChartPostProcessorTag.java:45)
        at org.apache.jsp.pages.chart_002dplacement_002dretention.viewPlacementRetentionChart_jsp._jspx_meth_cewolf_chartpostprocessor_0(viewPlacementRetentionChart_jsp.java:701)
        at org.apache.jsp.pages.chart_002dplacement_002dretention.viewPlacementRetentionChart_jsp._jspx_meth_cewolf_chart_0(viewPlacementRetentionChart_jsp.java:609)
        at org.apache.jsp.pages.chart_002dplacement_002dretention.viewPlacementRetentionChart_jsp._jspx_meth_f_verbatim_0(viewPlacementRetentionChart_jsp.java:564)
        at org.apache.jsp.pages.chart_002dplacement_002dretention.viewPlacementRetentionChart_jsp._jspx_meth_f_subview_0(viewPlacementRetentionChart_jsp.java:533)
        at org.apache.jsp.pages.chart_002dplacement_002dretention.viewPlacementRetentionChart_jsp._jspx_meth_h_panelGroup_1(viewPlacementRetentionChart_jsp.java:499)
        at org.apache.jsp.pages.chart_002dplacement_002dretention.viewPlacementRetentionChart_jsp._jspx_meth_h_panelGrid_1(viewPlacementRetentionChart_jsp.java:438)
        at org.apache.jsp.pages.chart_002dplacement_002dretention.viewPlacementRetentionChart_jsp._jspx_meth_h_form_0(viewPlacementRetentionChart_jsp.java:309)
        at org.apache.jsp.pages.chart_002dplacement_002dretention.viewPlacementRetentionChart_jsp._jspx_meth_f_view_0(viewPlacementRetentionChart_jsp.java:201)
        at org.apache.jsp.pages.chart_002dplacement_002dretention.viewPlacementRetentionChart_jsp._jspService(viewPlacementRetentionChart_jsp.java:118)
        at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
        at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:334)
        at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
        at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
        at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:672)
        at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:463)
        at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:398)
        at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:301)
        at org.apache.myfaces.context.servlet.ServletExternalContextImpl.dispatch(ServletExternalContextImpl.java:419)
        at org.apache.myfaces.application.jsp.JspViewHandlerImpl.renderView(JspViewHandlerImpl.java:211)
        at org.apache.myfaces.lifecycle.RenderResponseExecutor.execute(RenderResponseExecutor.java:41)
        at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:132)
        at javax.faces.webapp.FacesServlet.service(FacesServlet.java:140)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
        at org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:147)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
        at com.logipath.gict.cts.reporting.AuthorizationFilter.doFilter(AuthorizationFilter.java:58)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
        at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
        at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
        at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
        at org.jboss.web.tomcat.tc5.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
        at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
        at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
        at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
        at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
        at java.lang.Thread.run(Thread.java:613)
    2008-09-13 20:50:41,745 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost].[/CtsReports].[faces]] Servlet.service() for servlet faces threw exception
    javax.faces.FacesException: org.apache.jasper.JasperException
        at org.apache.myfaces.context.servlet.ServletExternalContextImpl.dispatch(ServletExternalContextImpl.java:429)
        at org.apache.myfaces.application.jsp.JspViewHandlerImpl.renderView(JspViewHandlerImpl.java:211)
        at org.apache.myfaces.lifecycle.RenderResponseExecutor.execute(RenderResponseExecutor.java:41)
        at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:132)
        at javax.faces.webapp.FacesServlet.service(FacesServlet.java:140)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
        at org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:147)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
        at com.logipath.gict.cts.reporting.AuthorizationFilter.doFilter(AuthorizationFilter.java:58)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
        at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
        at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
        at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
        at org.jboss.web.tomcat.tc5.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
        at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
        at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
        at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
        at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
        at java.lang.Thread.run(Thread.java:613)
    Caused by: org.apache.jasper.JasperException
        at org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:512)
        at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:395)
        at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
        at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
        at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:672)
        at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:463)
        at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:398)
        at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:301)
        at org.apache.myfaces.context.servlet.ServletExternalContextImpl.dispatch(ServletExternalContextImpl.java:419)
        ... 29 more

     
    • Ulf Dittmer
      Ulf Dittmer
      2008-11-07

      I'm not sure why that's happening, but have you actually tried putting the object in the page context?