Board index JavaServer Faces General Dynamic graphicImage doesn't work w/ConversationScoped bean

Dynamic graphicImage doesn't work w/ConversationScoped bean

Components, Ajax Framework, Utilities and More.


Posts: 30
Location: Rockford, Michigan, USA

I was trying to use a graphicImage tag with a value supplied by a ConversationScoped backing bean that pulls an image out of a database BLOB column.
<p:graphicImage value="#{logosBean.companyLogo}" alt="No Company Logo Set" />
However, it wasn't working. All I ever got was the alternate text. After chasing the problem from the server side for 2 days - where I concluded that everything was working fine - I finally decided to look at the generated page to see if it might hold any clues. In there I found the <img> tag for my image:
<img id="j_idt29:j_idt30"
    src="/EnergySolutionsProfile/faces/MaintainLogos.xhtml?cid=1&amp;primefacesDynamicContent=logosBean.companyLogo"
    alt="No Company Logo Set" />

In Firefox's Source display window it created a link for the img's src attribute, so I clicked on it and got another page of source that included the following error:
org.jboss.weld.context.ContextNotActiveException: WELD-001303 No active contexts for scope type javax.enterprise.context.ConversationScoped
   at org.jboss.weld.manager.BeanManagerImpl.getContext(BeanManagerImpl.java:664)
   at org.jboss.weld.bean.proxy.ContextBeanInstance.getInstance(ContextBeanInstance.java:77)
   at org.jboss.weld.bean.proxy.ProxyMethodHandler.invoke(ProxyMethodHandler.java:87)
   at com.MSCA.ESP.WebApp.org$jboss$weld$bean-web-ManagedBean-class_com$MSCA$ESP$WebApp$LogosBean_$$_WeldClientProxy.getCompanyLogo(org$jboss$weld$bean-web-ManagedBean-class_com$MSCA$ESP$WebApp$LogosBean_$$_WeldClientProxy.java)
   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 javax.el.BeanELResolver.getValue(BeanELResolver.java:302)
   at com.sun.faces.el.DemuxCompositeELResolver._getValue(DemuxCompositeELResolver.java:176)
   at com.sun.faces.el.DemuxCompositeELResolver.getValue(DemuxCompositeELResolver.java:203)
   at com.sun.el.parser.AstValue.getValue(AstValue.java:116)
   at com.sun.el.parser.AstValue.getValue(AstValue.java:163)
   at com.sun.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:219)
   at org.jboss.weld.el.WeldValueExpression.getValue(WeldValueExpression.java:55)
   at org.primefaces.application.DynamicContentStreamer.streamDynamicContent(DynamicContentStreamer.java:66)
   at org.primefaces.application.DynamicContentStreamer.beforePhase(DynamicContentStreamer.java:57)
   at com.sun.faces.lifecycle.Phase.handleBeforePhase(Phase.java:228)
   at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:99)
   at com.sun.faces.lifecycle.RestoreViewPhase.doPhase(RestoreViewPhase.java:116)
   at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
   at javax.faces.webapp.FacesServlet.service(FacesServlet.java:593)
   at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1539)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:343)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:217)
   at org.primefaces.webapp.filter.FileUploadFilter.doFilter(FileUploadFilter.java:79)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:217)
   at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:279)
   at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
   at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:655)
   at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:595)
   at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:98)
   at com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPipeline.java:91)
   at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:162)
   at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:330)
   at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:231)
   at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:174)
   at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:828)
   at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:725)
   at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1019)
   at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:225)
   at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137)
   at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104)
   at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90)
   at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79)
   at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54)
   at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59)
   at com.sun.grizzly.ContextTask.run(ContextTask.java:71)
   at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532)
   at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513)
   at java.lang.Thread.run(Thread.java:662)

I get the same error whether or not I actually begin a conversation (e.g. in a preRenderView event). I don't know if there's some kind of incompatibility between PrimeFaces' graphicImage and Glassfish (3.1.1), between PF and Conversation scopes, or something else. I'd like to submit an error report to someone, but I'm not even sure who the org.jboss classes belong to.

I was able to work around the problem by using a SessionScoped rather than ConversationScoped bean.


Posts: 30
Location: Rockford, Michigan, USA

Found where someone is having the same problem with RichFaces http://community.jboss.org/message/633410, and they filed a bug report about it: https://issues.jboss.org/browse/RF-11585. I'm still trying to figure out the relationship between JBoss and Glassfish, PrimeFaces, J2EE, CDI, JSF, Moby Dick, etc.


Posts: 30
Location: Rockford, Michigan, USA

This problem still exists in PrimeFaces 4.0.9, but may have changed. I found perhaps an explanation and a suggestion for a better method of handling this situation, though:
http://stackoverflow.com/questions/13651248/managedbean-return-null-to-graphicimage-in-primefaces


Return to General