java - CDI with Primefaces Charts not rendering properly -
i have 4 primefaces bar charts renders, not. in 1 of them, inject http user session attribute , use render chart (the idea show data corresponds (logged in) user department).
there 4 session beans i'm using javax.enterprise.context.requestscoped. sometimes, glassfish destroys instance expected, not.
based on exception below, how can resolve it?
thanks in advance.
the xhtml below shows main code 2 of 4 bar charts:
<p:tab title="horas de treinamento (por funci)" closable="true" > <p:barchart id="horasbars" value="#{charthorasfunci.modelhoras}" legendposition="ne" orientation="horizontal" seriescolors="aa5555, 00438f" xaxislabel="horas" yaxislabel="funcis" title="34 horas de treinamento (orçado/realizado) por funci" > </p:barchart> </p:tab> <p:tab title="horas de treinamento (por escritório)" closable="true" titletip="este subitem impacta no atb."> <p:barchart id="horassbarsesc" value="#{charthorasesc.modelhorasesc}" legendposition="ne" orientation="vertical" seriescolors="aa5555, 00438f" xaxislabel="prefixo" yaxislabel="quantidade" title="horas de treinamento (orçado/realizado) por prefixo" > </p:barchart>
the session bean below shows main code 1 of 4 session bean:
@named(value = "charthorasfunci") @requestscoped public class charthorasfunci implements serializable { private final beanlogin sessionprefdep = new beanlogin(); private final string sessionattribute = facescontext.getcurrentinstance().getexternalcontext().getsessionmap().get("xprefdep").tostring(); public charthorasfunci() { } @ejb private capacitacaofacade cf; @ejb private prefdepsfacade pf; private cartesianchartmodel modelhoras; public cartesianchartmodel getmodelhoras() { return modelhoras; } public void setmodelhoras(cartesianchartmodel modelhoras) { this.modelhoras = modelhoras; } private void horaschart() { list<capacitacao> orclist = cf.findbyprefdep(); list<prefdeps> prefdepslist = pf.findall(); sessionprefdep.setxprefdep(sessionattribute); system.out.print("from init:" + sessionprefdep.tostring()); modelhoras = new cartesianchartmodel(); chartseries orchorasseries = new chartseries("orçado"); chartseries rlzhorasseries = new chartseries("realizado"); (prefdeps p : prefdepslist) { integer metahoras = 0; integer rlzhoras = 0; integer x = 0; integer y = 0; (capacitacao r : p.getcapacitacaocollection()) { if (r.getiddtref().getid().intvalue() == 1) { if (r.getindicativo().equals("")) { x++; } if (r.getatghoras().equals("sim")) { y++; } metahoras = x.intvalue(); rlzhoras = y.intvalue(); } } } (capacitacao o : orclist) { if (o.getprefdep().getprefdep().tostring() == null ? sessionprefdep.getxprefdep().tostring() == null : o.getprefdep().getprefdep().tostring().equals(sessionprefdep.getxprefdep().tostring())) { orchorasseries.set(o.getfunci(), o.getmetahoras().getvalor()); rlzhorasseries.set(o.getfunci(), o.getrlzhoras().floatvalue()); } } modelhoras.addseries(orchorasseries); modelhoras.addseries(rlzhorasseries); } @postconstruct private void initialize() { horaschart(); } @predestroy public void cleanup() { system.out.println("destoy instances here!!"); // <-- destroys, not! } }
the exception:
severe: error rendering view[/capacitacao/capacitacao/index.xhtml] javax.el.elexception: /web-inf/include/capacitacao/capacitacao/list.xhtml @145,38 value="#{charthorasfunci.modelhoras}": org.jboss.weld.exceptions.weldexception: weld-000049 unable invoke private void br.com.bb.upb.diage.atb.capacitacao.beans.charthorasfunci.initialize() on br.com.bb.upb.diage.atb.capacitacao.beans.charthorasfunci@3e9c727c @ com.sun.faces.facelets.el.tagvalueexpression.getvalue(tagvalueexpression.java:114) @ javax.faces.component.componentstatehelper.eval(componentstatehelper.java:194) @ javax.faces.component.componentstatehelper.eval(componentstatehelper.java:182) @ javax.faces.component.uioutput.getvalue(uioutput.java:174) @ org.primefaces.component.chart.bar.barchartrenderer.encodedata(barchartrenderer.java:127) @ org.primefaces.component.chart.bar.barchartrenderer.encodescript(barchartrenderer.java:51) @ org.primefaces.component.chart.bar.barchartrenderer.encodeend(barchartrenderer.java:36) @ javax.faces.component.uicomponentbase.encodeend(uicomponentbase.java:924) @ javax.faces.component.uicomponent.encodeall(uicomponent.java:1863) @ javax.faces.component.uicomponent.encodeall(uicomponent.java:1859) @ org.primefaces.component.tabview.tabviewrenderer.encodeend(tabviewrenderer.java:59) @ javax.faces.component.uicomponentbase.encodeend(uicomponentbase.java:924) @ javax.faces.component.uicomponent.encodeall(uicomponent.java:1863) @ com.sun.faces.context.partialviewcontextimpl$phaseawarevisitcallback.visit(partialviewcontextimpl.java:559) @ com.sun.faces.component.visit.partialvisitcontext.invokevisitcallback(partialvisitcontext.java:183) @ org.primefaces.component.tabview.tabview.visittree(tabview.java:405) @ javax.faces.component.uicomponent.visittree(uicomponent.java:1700) @ javax.faces.component.uicomponent.visittree(uicomponent.java:1700) @ javax.faces.component.uicomponent.visittree(uicomponent.java:1700) @ javax.faces.component.uiform.visittree(uiform.java:371) @ javax.faces.component.uicomponent.visittree(uicomponent.java:1700) @ javax.faces.component.uicomponent.visittree(uicomponent.java:1700) @ javax.faces.component.uicomponent.visittree(uicomponent.java:1700) @ javax.faces.component.uicomponent.visittree(uicomponent.java:1700) @ com.sun.faces.context.partialviewcontextimpl.processcomponents(partialviewcontextimpl.java:399) @ com.sun.faces.context.partialviewcontextimpl.processpartial(partialviewcontextimpl.java:319) @ org.primefaces.context.primepartialviewcontext.processpartial(primepartialviewcontext.java:57) @ javax.faces.component.uiviewroot.encodechildren(uiviewroot.java:1004) @ javax.faces.component.uicomponent.encodeall(uicomponent.java:1856) @ com.sun.faces.application.view.faceletviewhandlingstrategy.renderview(faceletviewhandlingstrategy.java:417) @ com.sun.faces.application.view.multiviewhandler.renderview(multiviewhandler.java:131) @ javax.faces.application.viewhandlerwrapper.renderview(viewhandlerwrapper.java:337) @ javax.faces.application.viewhandlerwrapper.renderview(viewhandlerwrapper.java:337) @ com.sun.faces.lifecycle.renderresponsephase.execute(renderresponsephase.java:120) @ com.sun.faces.lifecycle.phase.dophase(phase.java:101) @ com.sun.faces.lifecycle.lifecycleimpl.render(lifecycleimpl.java:219) @ org.apache.myfaces.extensions.cdi.jsf2.impl.listener.phase.codilifecyclewrapper.render(codilifecyclewrapper.java:126) @ javax.faces.webapp.facesservlet.service(facesservlet.java:647) @ org.apache.catalina.core.standardwrapper.service(standardwrapper.java:1682) @ org.apache.catalina.core.standardwrappervalve.invoke(standardwrappervalve.java:318) @ org.apache.catalina.core.standardcontextvalve.invoke(standardcontextvalve.java:160) @ org.apache.catalina.core.standardpipeline.doinvoke(standardpipeline.java:734) @ org.apache.catalina.core.standardpipeline.invoke(standardpipeline.java:673) @ com.sun.enterprise.web.webpipeline.invoke(webpipeline.java:99) @ org.apache.catalina.core.standardhostvalve.invoke(standardhostvalve.java:174) @ org.apache.catalina.connector.coyoteadapter.doservice(coyoteadapter.java:357) @ org.apache.catalina.connector.coyoteadapter.service(coyoteadapter.java:260) @ com.sun.enterprise.v3.services.impl.containermapper.service(containermapper.java:188) @ org.glassfish.grizzly.http.server.httphandler.runservice(httphandler.java:191) @ org.glassfish.grizzly.http.server.httphandler.dohandle(httphandler.java:168) @ org.glassfish.grizzly.http.server.httpserverfilter.handleread(httpserverfilter.java:189) @ org.glassfish.grizzly.filterchain.executorresolver$9.execute(executorresolver.java:119) @ org.glassfish.grizzly.filterchain.defaultfilterchain.executefilter(defaultfilterchain.java:288) @ org.glassfish.grizzly.filterchain.defaultfilterchain.executechainpart(defaultfilterchain.java:206) @ org.glassfish.grizzly.filterchain.defaultfilterchain.execute(defaultfilterchain.java:136) @ org.glassfish.grizzly.filterchain.defaultfilterchain.process(defaultfilterchain.java:114) @ org.glassfish.grizzly.processorexecutor.execute(processorexecutor.java:77) @ org.glassfish.grizzly.nio.transport.tcpniotransport.fireioevent(tcpniotransport.java:838) @ org.glassfish.grizzly.strategies.abstractiostrategy.fireioevent(abstractiostrategy.java:113) @ org.glassfish.grizzly.strategies.workerthreadiostrategy.run0(workerthreadiostrategy.java:115) @ org.glassfish.grizzly.strategies.workerthreadiostrategy.access$100(workerthreadiostrategy.java:55) @ org.glassfish.grizzly.strategies.workerthreadiostrategy$workerthreadrunnable.run(workerthreadiostrategy.java:135) @ org.glassfish.grizzly.threadpool.abstractthreadpool$worker.dowork(abstractthreadpool.java:564) @ org.glassfish.grizzly.threadpool.abstractthreadpool$worker.run(abstractthreadpool.java:544) @ java.lang.thread.run(thread.java:724) caused by: javax.el.elexception: org.jboss.weld.exceptions.weldexception: weld-000049 unable invoke private void br.com.bb.upb.diage.atb.capacitacao.beans.charthorasfunci.initialize() on br.com.bb.upb.diage.atb.capacitacao.beans.charthorasfunci@3e9c727c @ javax.el.beanelresolver.getvalue(beanelresolver.java:368) @ com.sun.faces.el.demuxcompositeelresolver._getvalue(demuxcompositeelresolver.java:176) @ com.sun.faces.el.demuxcompositeelresolver.getvalue(demuxcompositeelresolver.java:203) @ com.sun.el.parser.astvalue.getvalue(astvalue.java:140) @ com.sun.el.parser.astvalue.getvalue(astvalue.java:204) @ com.sun.el.valueexpressionimpl.getvalue(valueexpressionimpl.java:226) @ org.jboss.weld.el.weldvalueexpression.getvalue(weldvalueexpression.java:50) @ com.sun.faces.facelets.el.tagvalueexpression.getvalue(tagvalueexpression.java:109) ... 64 more caused by: org.jboss.weld.exceptions.weldexception: weld-000049 unable invoke private void br.com.bb.upb.diage.atb.capacitacao.beans.charthorasfunci.initialize() on br.com.bb.upb.diage.atb.capacitacao.beans.charthorasfunci@3e9c727c @ org.jboss.weld.injection.producer.defaultlifecyclecallbackinvoker.invokemethods(defaultlifecyclecallbackinvoker.java:91) @ org.jboss.weld.injection.producer.defaultlifecyclecallbackinvoker.postconstruct(defaultlifecyclecallbackinvoker.java:73) @ org.jboss.weld.injection.producer.basicinjectiontarget.postconstruct(basicinjectiontarget.java:95) @ org.jboss.weld.injection.producer.beaninjectiontarget.postconstruct(beaninjectiontarget.java:65) @ org.jboss.weld.bean.managedbean.create(managedbean.java:161) @ org.jboss.weld.context.forwardingcontextual.create(forwardingcontextual.java:27) @ org.jboss.weld.context.abstractcontext.get(abstractcontext.java:103) @ org.jboss.weld.context.passivatingcontextwrapper$abstractpassivatingcontextwrapper.get(passivatingcontextwrapper.java:64) @ org.jboss.weld.bean.proxy.contextbeaninstance.getinstance(contextbeaninstance.java:93) @ org.jboss.weld.bean.proxy.proxymethodhandler.invoke(proxymethodhandler.java:79) @ br.com.bb.upb.diage.atb.capacitacao.beans.charthorasfunci$proxy$_$$_weldclientproxy.getmodelhoras(unknown source) @ sun.reflect.nativemethodaccessorimpl.invoke0(native method) @ sun.reflect.nativemethodaccessorimpl.invoke(nativemethodaccessorimpl.java:57) @ sun.reflect.delegatingmethodaccessorimpl.invoke(delegatingmethodaccessorimpl.java:43) @ java.lang.reflect.method.invoke(method.java:606) @ javax.el.beanelresolver.getvalue(beanelresolver.java:363) ... 71 more caused by: java.lang.reflect.invocationtargetexception @ sun.reflect.nativemethodaccessorimpl.invoke0(native method) @ sun.reflect.nativemethodaccessorimpl.invoke(nativemethodaccessorimpl.java:57) @ sun.reflect.delegatingmethodaccessorimpl.invoke(delegatingmethodaccessorimpl.java:43) @ java.lang.reflect.method.invoke(method.java:606) @ org.jboss.weld.injection.producer.defaultlifecyclecallbackinvoker.invokemethods(defaultlifecyclecallbackinvoker.java:89) ... 86 more caused by: java.lang.illegalstateexception: queue full @ java.util.abstractqueue.add(abstractqueue.java:98) @ java.util.concurrent.arrayblockingqueue.add(arrayblockingqueue.java:283) @ com.sun.common.util.logging.loggingoutputstream.flush(loggingoutputstream.java:116) @ java.io.printstream.write(printstream.java:482) @ com.sun.common.util.logging.loggingoutputstream$loggingprintstream.write(loggingoutputstream.java:392) @ sun.nio.cs.streamencoder.writebytes(streamencoder.java:221) @ sun.nio.cs.streamencoder.implflushbuffer(streamencoder.java:291) @ sun.nio.cs.streamencoder.flushbuffer(streamencoder.java:104) @ java.io.outputstreamwriter.flushbuffer(outputstreamwriter.java:185) @ java.io.printstream.write(printstream.java:527) @ java.io.printstream.print(printstream.java:669) @ com.sun.common.util.logging.loggingoutputstream$loggingprintstream.print(loggingoutputstream.java:297) @ org.apache.felix.gogo.runtime.threadio.threadprintstream.print(threadprintstream.java:150) @ br.com.bb.upb.diage.atb.capacitacao.beans.charthorasfunci.horaschart(charthorasfunci.java:80) @ br.com.bb.upb.diage.atb.capacitacao.beans.charthorasfunci.initialize(charthorasfunci.java:108) ... 91 more warning: standardwrappervalve[faces servlet]: servlet.service() servlet faces servlet threw exception java.lang.illegalstateexception: cdata tags may not nest @ com.sun.faces.renderkit.html_basic.htmlresponsewriter.startcdata(htmlresponsewriter.java:681) @ javax.faces.context.responsewriterwrapper.startcdata(responsewriterwrapper.java:179) @ javax.faces.context.partialresponsewriter.starterror(partialresponsewriter.java:341) @ org.primefaces.context.primepartialresponsewriter.starterror(primepartialresponsewriter.java:156) @ com.sun.faces.context.ajaxexceptionhandlerimpl.handlepartialresponseerror(ajaxexceptionhandlerimpl.java:200) @ com.sun.faces.context.ajaxexceptionhandlerimpl.handle(ajaxexceptionhandlerimpl.java:124) @ javax.faces.context.exceptionhandlerwrapper.handle(exceptionhandlerwrapper.java:100) @ com.sun.faces.lifecycle.phase.dophase(phase.java:119) @ com.sun.faces.lifecycle.lifecycleimpl.render(lifecycleimpl.java:219) @ org.apache.myfaces.extensions.cdi.jsf2.impl.listener.phase.codilifecyclewrapper.render(codilifecyclewrapper.java:126) @ javax.faces.webapp.facesservlet.service(facesservlet.java:647) @ org.apache.catalina.core.standardwrapper.service(standardwrapper.java:1682) @ org.apache.catalina.core.standardwrappervalve.invoke(standardwrappervalve.java:318) @ org.apache.catalina.core.standardcontextvalve.invoke(standardcontextvalve.java:160) @ org.apache.catalina.core.standardpipeline.doinvoke(standardpipeline.java:734) @ org.apache.catalina.core.standardpipeline.invoke(standardpipeline.java:673) @ com.sun.enterprise.web.webpipeline.invoke(webpipeline.java:99) @ org.apache.catalina.core.standardhostvalve.invoke(standardhostvalve.java:174) @ org.apache.catalina.connector.coyoteadapter.doservice(coyoteadapter.java:357) @ org.apache.catalina.connector.coyoteadapter.service(coyoteadapter.java:260) @ com.sun.enterprise.v3.services.impl.containermapper.service(containermapper.java:188) @ org.glassfish.grizzly.http.server.httphandler.runservice(httphandler.java:191) @ org.glassfish.grizzly.http.server.httphandler.dohandle(httphandler.java:168) @ org.glassfish.grizzly.http.server.httpserverfilter.handleread(httpserverfilter.java:189) @ org.glassfish.grizzly.filterchain.executorresolver$9.execute(executorresolver.java:119) @ org.glassfish.grizzly.filterchain.defaultfilterchain.executefilter(defaultfilterchain.java:288) @ org.glassfish.grizzly.filterchain.defaultfilterchain.executechainpart(defaultfilterchain.java:206) @ org.glassfish.grizzly.filterchain.defaultfilterchain.execute(defaultfilterchain.java:136) @ org.glassfish.grizzly.filterchain.defaultfilterchain.process(defaultfilterchain.java:114) @ org.glassfish.grizzly.processorexecutor.execute(processorexecutor.java:77) @ org.glassfish.grizzly.nio.transport.tcpniotransport.fireioevent(tcpniotransport.java:838) @ org.glassfish.grizzly.strategies.abstractiostrategy.fireioevent(abstractiostrategy.java:113) @ org.glassfish.grizzly.strategies.workerthreadiostrategy.run0(workerthreadiostrategy.java:115) @ org.glassfish.grizzly.strategies.workerthreadiostrategy.access$100(workerthreadiostrategy.java:55) @ org.glassfish.grizzly.strategies.workerthreadiostrategy$workerthreadrunnable.run(workerthreadiostrategy.java:135) @ org.glassfish.grizzly.threadpool.abstractthreadpool$worker.dowork(abstractthreadpool.java:564) @ org.glassfish.grizzly.threadpool.abstractthreadpool$worker.run(abstractthreadpool.java:544) @ java.lang.thread.run(thread.java:724)
there seems problem in application code triggered @postconstruct
. interesting part of stacktrace:
caused by: java.lang.illegalstateexception: queue full @ java.util.abstractqueue.add(abstractqueue.java:98) @ java.util.concurrent.arrayblockingqueue.add(arrayblockingqueue.java:283) @ com.sun.common.util.logging.loggingoutputstream.flush(loggingoutputstream.java:116) @ java.io.printstream.write(printstream.java:482) @ com.sun.common.util.logging.loggingoutputstream$loggingprintstream.write(loggingoutputstream.java:392) @ sun.nio.cs.streamencoder.writebytes(streamencoder.java:221) @ sun.nio.cs.streamencoder.implflushbuffer(streamencoder.java:291) @ sun.nio.cs.streamencoder.flushbuffer(streamencoder.java:104) @ java.io.outputstreamwriter.flushbuffer(outputstreamwriter.java:185) @ java.io.printstream.write(printstream.java:527) @ java.io.printstream.print(printstream.java:669) @ com.sun.common.util.logging.loggingoutputstream$loggingprintstream.print(loggingoutputstream.java:297) @ org.apache.felix.gogo.runtime.threadio.threadprintstream.print(threadprintstream.java:150)
looks you're producing more output stream can handle, it's not cdi problem after all.
Comments
Post a Comment