NullPointerException в org.primefaces.component.chart.renderer.BarRenderer.encodeData - PullRequest
0 голосов
/ 04 февраля 2019

Я надеюсь, что мой вопрос похож на этот вопрос , но, к сожалению, ответ не работает для меня.

<p:chart type="bar" model="#{lasDashboardBean.barModel}" style="height:350px">
                            <p:ajax event="itemSelect" listener="#{lasDashboardBean.itemSelect}"  update="machineInfoTable"  />
                        </p:chart>

LasDashboardBean.java

@Named(value = "lasDashboardBean")
@Dependent
public class LasDashboardBean {

private BarChartModel barModel;
private DashboardController dashboardDbController;

@PostConstruct
public void init() {
    try {
        dashboardDbController = new DashboardController();
    } catch (NamingException ex) {
        Logger.getLogger(LasDashboardBean.class.getName()).log(Level.SEVERE, null, ex);
    }
    createBarModel();

}
private void createBarModel() {
    barModel = initBarModel();
    barModel.setTitle("Machine Menufacturers Count");
    barModel.setLegendPosition("ne");

    Axis xAxis = barModel.getAxis(AxisType.X);
    xAxis.setTickAngle(90);

    Axis yAxis = barModel.getAxis(AxisType.Y);
    yAxis.setLabel("Count");
    yAxis.setMin(0);
}
private BarChartModel initBarModel() {
    BarChartModel model = new BarChartModel();
    ChartSeries manufacturersMachines = new ChartSeries();
    manufacturersMachines.setLabel("Machines");
    try {

        manufacturersMachineCount = dashboardDbController.getManufacturersMachinesCount();

        manufacturersMachineCount.stream().forEach((mc) -> {
            manufacturersMachines.set(mc.getManufacturerName(), mc.getCount());
        });

        model.addSeries(manufacturersMachines);

    } catch (SQLException ex) {
        Logger.getLogger(LasDashboardBean.class.getName()).log(Level.SEVERE, null, ex);
    }
    return model;

}

Журнал ошибок:

java.lang.NullPointerException at org.primefaces.component.chart.renderer.BarRenderer.encodeData (BarRenderer.java:35) в организации.primefaces.component.chart.renderer.BasePlotRenderer.render (BasePlotRenderer.java:29) в org.primefaces.component.chart.ChartRenderer.encodeScript (ChartRenderer.java:95) в org.primefaces.component.chenreenart.Rende.art(ChartRenderer.java:68) в javax.faces.component.UIComponentBase.encodeEnd (UIComponentBase.java:949) в javax.faces.component.UIComponent.encodeAll (UIComponent.java:1912) в org.primefaces.comrident.pan.PanelGridRenderer.encodeGridBody (PanelGridRenderer.java:244) в org.primefaces.component.panelgrid.PanelGridRenderer.encodeGridLayout (PanelGridRenderer.java:90) в org.primefaces.component.panelgrid.Pan.erer.encodeEnd (PanelGridRenderer.java:40) в javax.faces.component.UIComponentBase.encodeEnd (UIComponentBase.java:949) в javax.faces.component.UIComponent.encodeAll (UIComponent.java:1912) в javax..Renderer.encodeChildren (Renderer.java:176) на javax.faces.component.UIComponentBase.encodeChildren (UIComponentBase.java:918) на javax.faces.component.UIComponent.encodeAll (UIComponent.java:1905).component.UIComponent.encodeAll (UIComponent.java:1908) в javax.faces.component.UIComponent.encodeAll (UIComponent.java:1908) в com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView (FaceletViewHandlingSt49gy)в com.sun.faces.application.view.MultiViewHandler.renderView (MultiViewHandler.java:194) в javax.faces.application.ViewHandlerWrapper.renderView (ViewHandlerWrapper.java:151) в javax.faces.application.ViewHandlerWrapper.renderView (ViewHand.java: 151) на com.sun.faces.lifecycle.RenderResponsePhase.execute (RenderResponsePhase.java:126) на com.sun.faces.lifecycle.Phase.doPhase (Phase.java:100) на com.sun.faces.lifecycle.LifecycleImpl.render (LifecycleImpl.java:223) на javax.faces.webapp.FacesServlet.service(FacesServlet.java:671) в org.apache.catalina.core.StandardWrapper.service (StandardWrapper.java:1580) в org.apache.catalina.core.ApplicationFilterChain.internalDoFilter (ApplicationFilterChain.java:338 или в приложении).catalina.core.ApplicationFilterChain.doFilter (ApplicationFilterChain.java:208) в org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter (ProxiedFilterChain.java:61) в org.apache.shiro.wefilter.web.AdviceFilter.java:108) в org.apache.shiro.web.servlet.AdviceFilter.doFilterInternal (AdviceFilter.java:137) в org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter (OncePerRequestFilter.jav) org..apache.shiro.web.servlet.ProxiedFilterChain.doFilter (ProxiedFilterChain.java:66) в org.apache.shiro.web.servlet.AbstractShiroFilter.executeChain (AbstractShiroFilter.java:449)в org.apache.shiro.web.servlet.AbstractShiroFilter $ 1.call (AbstractShiroFilter.java:365) в org.apache.shiro.subject.support.SubjectCallable.doCall (SubjectCallable.java:90) в org.apache.shiro.subject.support.SubjectCallable.call (SubjectCallable.java:83) в org.apache.shiro.subject.support.DelegatingSubject.execute (DelegatingSubject.java:383) в org.apache.shiro.web.servlet.AbstractShiroFilterternal.AbstractShiroFilter.java:362) в org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter (OncePerRequestFilter.java:125) в org.apache.catalina.core.ApplicationFilterChain.internalDoFilter: ApplicationFilter (ApplicationFilter) (ApplicationFilter) (ApplicationFilter)в org.apache.catalina.core.ApplicationFilterChain.doFilter (ApplicationFilterChain.java:208) в org.apache.catalina.core.StandardWrapperValve.invoke (StandardWrapperValve.java:256) в org.apache.kevetatatataina(StandardContextValve.java:160) в org.apache.catalina.core.StandardPipeline.doInvoke (StandardPipeline.java:652) в org.apache.catalina.core.StandardPipeline.invoke (StandardPipeline.java:591) в com.sun.enterprise.web.WebPipeline.invoke (WebPipeline.java:99) в org.apache.catalina.core.StandardHostValve.invoke (StandardHostValve.java:155) в org.apache.catalina.connector.CoyoteAdapter.doService (Coyote:371) в org.apache.catalina.connector.CoyoteAdapter.service (CoyoteAdapter.java:238) в com.sun.enterprise.v3.services.impl.ContainerMapper $ HttpHandlerCallable.call (ContainerMapper.java:463) в com.sun.enterprise.v3.services.impl.ContainerMapper.service (ContainerMapper.java:168) при org.glassfish.grizzly.http.server.HttpHandler.runService (HttpHandler.java: 206) по адресу org.glassfish.grizzly.http.server.HttpHandler.doHandle (HttpHandler.java:180) по адресу org.glassfish.grizzly.http.server.HttpServerFilter.handleRead (HttpServerFilter.java:24).glassfish.grizzly.filterchain..java: 201) в org.glassfish.grizzly.filterchain.DefaultFilterChain.execute (DefaultFilterChain.java:133) в org.glassfish.grizzly.filterchain.DefaultFilterChain.process (DefaultFilterChain.java:112) в org.glass.ProcessorExecutor.execute (ProcessorExecutor.java:77) по адресу org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent (TCPNIOTransport.java:539) по адресу org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIO1trate.jj (Аннотация)на org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0 (WorkerThreadIOStrategy.java:117) в org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access $ 100 (WorkerThreadIOStrategy.java:56) в org.glassfish.grizzly.strategies.WorkerThreadIOStrategy $ WorkerThreadRunnrate.j.glassfish.grizzly.threadpool.AbstractThreadPool $ Worker.doWork (AbstractThreadPool.java:593) в org.glassfish.grizzly.threadpool.AbstractThreadPool $ Worker.run (AbstractThreadPool.java:573) в java.lang.Thread.run (поток.Java: 748)

1 Ответ

0 голосов
/ 06 февраля 2019

Я столкнулся с той же проблемой на сервере Glassfish .После смены сервера проблема была решена.

...