2015-06-24 28 views
2

這裏是backing bean,它將消息發送給對象在模型中獲取價值。<#:graphicImage>在#{bean.foo()。bar()}上拋出javax.el.PropertyNotFoundException,但#{bean.fooAndBar()}工作

@Model 
public class ManageUsersBean { 

    public ImageField getProfilePicField() { 
     return getSelectedMaskedEntity().getProfilePicField(); 
    } 

    public StreamedContent paintProfilePic() { 
     return getProfilePicField().paint(); 
    } 
} 

public class ImageField 
{ 
    public StreamedContent paint() { 
     return paintPicture(getValue(), getPropertyName(), imageMimeTypeSupplier.get()); 
    } 
} 

爲什麼以下EL正常工作:

<p:graphicImage value="#{manageUsersBean.paintProfilePic()}"/> 

但下面不工作:

<p:graphicImage value="#{manageUsersBean.getProfilePicField().paint()}"/> 

這導致PropertyNotFoundException: Target Unreachable, 'null' returned null.

完整的堆棧跟蹤:

[javax.enterprise.resource.webcontainer.jsf.context] (default task-50) Exception when handling error trying to reset the response.: java.io.IOException: javax.el.PropertyNotFoundException: Target Unreachable, 'null' returned null 
    at org.primefaces.component.graphicimage.GraphicImageRenderer.encodeEnd(GraphicImageRenderer.java:43) [primefaces-5.2.jar:5.2] 
    at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:919) [jboss-jsf-api_2.2_spec-2.2.6.jar:2.2.6] 
    at org.primefaces.renderkit.CoreRenderer.renderChild(CoreRenderer.java:88) [primefaces-5.2.jar:5.2] 
    at org.primefaces.renderkit.CoreRenderer.renderChildren(CoreRenderer.java:71) [primefaces-5.2.jar:5.2] 
    at org.primefaces.component.panel.PanelRenderer.encodeContent(PanelRenderer.java:206) [primefaces-5.2.jar:5.2] 
    at org.primefaces.component.panel.PanelRenderer.encodeMarkup(PanelRenderer.java:123) [primefaces-5.2.jar:5.2] 
    at org.primefaces.component.panel.PanelRenderer.encodeEnd(PanelRenderer.java:58) [primefaces-5.2.jar:5.2] 
    at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:919) [jboss-jsf-api_2.2_spec-2.2.6.jar:2.2.6] 
    at org.primefaces.renderkit.CoreRenderer.renderChild(CoreRenderer.java:88) [primefaces-5.2.jar:5.2] 
    at org.primefaces.renderkit.CoreRenderer.renderChildren(CoreRenderer.java:71) [primefaces-5.2.jar:5.2] 
    at org.primefaces.component.panelgrid.PanelGridRenderer.encodeRow(PanelGridRenderer.java:196) [primefaces-5.2.jar:5.2] 
    at org.primefaces.component.panelgrid.PanelGridRenderer.encodeStaticBody(PanelGridRenderer.java:151) [primefaces-5.2.jar:5.2] 
    at org.primefaces.component.panelgrid.PanelGridRenderer.encodeTableBody(PanelGridRenderer.java:104) [primefaces-5.2.jar:5.2] 
    at org.primefaces.component.panelgrid.PanelGridRenderer.encodeTableLayout(PanelGridRenderer.java:65) [primefaces-5.2.jar:5.2] 
    at org.primefaces.component.panelgrid.PanelGridRenderer.encodeEnd(PanelGridRenderer.java:37) [primefaces-5.2.jar:5.2] 
    at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:919) [jboss-jsf-api_2.2_spec-2.2.6.jar:2.2.6] 
    at org.primefaces.renderkit.CoreRenderer.renderChild(CoreRenderer.java:88) [primefaces-5.2.jar:5.2] 
    at org.primefaces.renderkit.CoreRenderer.renderChildren(CoreRenderer.java:71) [primefaces-5.2.jar:5.2] 
    at org.primefaces.component.fieldset.FieldsetRenderer.encodeContent(FieldsetRenderer.java:94) [primefaces-5.2.jar:5.2] 
    at org.primefaces.component.fieldset.FieldsetRenderer.encodeMarkup(FieldsetRenderer.java:76) [primefaces-5.2.jar:5.2] 
    at org.primefaces.component.fieldset.FieldsetRenderer.encodeEnd(FieldsetRenderer.java:47) [primefaces-5.2.jar:5.2] 
    at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:919) [jboss-jsf-api_2.2_spec-2.2.6.jar:2.2.6] 
    at org.primefaces.renderkit.CoreRenderer.renderChild(CoreRenderer.java:88) [primefaces-5.2.jar:5.2] 
    at org.primefaces.renderkit.CoreRenderer.renderChildren(CoreRenderer.java:71) [primefaces-5.2.jar:5.2] 
    at org.primefaces.component.panelgrid.PanelGridRenderer.encodeRow(PanelGridRenderer.java:196) [primefaces-5.2.jar:5.2] 
    at org.primefaces.component.panelgrid.PanelGridRenderer.encodeStaticBody(PanelGridRenderer.java:151) [primefaces-5.2.jar:5.2] 
    at org.primefaces.component.panelgrid.PanelGridRenderer.encodeTableBody(PanelGridRenderer.java:104) [primefaces-5.2.jar:5.2] 
    at org.primefaces.component.panelgrid.PanelGridRenderer.encodeTableLayout(PanelGridRenderer.java:65) [primefaces-5.2.jar:5.2] 
    at org.primefaces.component.panelgrid.PanelGridRenderer.encodeEnd(PanelGridRenderer.java:37) [primefaces-5.2.jar:5.2] 
    at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:919) [jboss-jsf-api_2.2_spec-2.2.6.jar:2.2.6] 
    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1864) [jboss-jsf-api_2.2_spec-2.2.6.jar:2.2.6] 
    at javax.faces.render.Renderer.encodeChildren(Renderer.java:176) [jboss-jsf-api_2.2_spec-2.2.6.jar:2.2.6] 
    at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:889) [jboss-jsf-api_2.2_spec-2.2.6.jar:2.2.6] 
    at org.primefaces.renderkit.CoreRenderer.renderChild(CoreRenderer.java:84) [primefaces-5.2.jar:5.2] 
    at org.primefaces.renderkit.CoreRenderer.renderChildren(CoreRenderer.java:71) [primefaces-5.2.jar:5.2] 
    at org.primefaces.component.panelgrid.PanelGridRenderer.encodeRow(PanelGridRenderer.java:196) [primefaces-5.2.jar:5.2] 
    at org.primefaces.component.panelgrid.PanelGridRenderer.encodeStaticBody(PanelGridRenderer.java:151) [primefaces-5.2.jar:5.2] 
    at org.primefaces.component.panelgrid.PanelGridRenderer.encodeTableBody(PanelGridRenderer.java:104) [primefaces-5.2.jar:5.2] 
    at org.primefaces.component.panelgrid.PanelGridRenderer.encodeTableLayout(PanelGridRenderer.java:65) [primefaces-5.2.jar:5.2] 
    at org.primefaces.component.panelgrid.PanelGridRenderer.encodeEnd(PanelGridRenderer.java:37) [primefaces-5.2.jar:5.2] 
    at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:919) [jboss-jsf-api_2.2_spec-2.2.6.jar:2.2.6] 
    at org.primefaces.renderkit.CoreRenderer.renderChild(CoreRenderer.java:88) [primefaces-5.2.jar:5.2] 
    at org.primefaces.renderkit.CoreRenderer.renderChildren(CoreRenderer.java:71) [primefaces-5.2.jar:5.2] 
    at org.primefaces.extensions.component.layout.LayoutPaneRenderer.encodeBegin(LayoutPaneRenderer.java:152) [primefaces-extensions-3.2.0.jar:3.2.0] 
    at javax.faces.component.UIComponentBase.encodeBegin(UIComponentBase.java:864) [jboss-jsf-api_2.2_spec-2.2.6.jar:2.2.6] 
    at org.primefaces.renderkit.CoreRenderer.renderChild(CoreRenderer.java:81) [primefaces-5.2.jar:5.2] 
    at org.primefaces.renderkit.CoreRenderer.renderChildren(CoreRenderer.java:71) [primefaces-5.2.jar:5.2] 
    at org.primefaces.extensions.component.layout.LayoutPaneRenderer.encodeBegin(LayoutPaneRenderer.java:152) [primefaces-extensions-3.2.0.jar:3.2.0] 
    at javax.faces.component.UIComponentBase.encodeBegin(UIComponentBase.java:864) [jboss-jsf-api_2.2_spec-2.2.6.jar:2.2.6] 
    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1855) [jboss-jsf-api_2.2_spec-2.2.6.jar:2.2.6] 
    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1860) [jboss-jsf-api_2.2_spec-2.2.6.jar:2.2.6] 
    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1860) [jboss-jsf-api_2.2_spec-2.2.6.jar:2.2.6] 
    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1860) [jboss-jsf-api_2.2_spec-2.2.6.jar:2.2.6] 
    at com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:461) [jsf-impl-2.2.6-jbossorg-4.jar:] 
    at com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:133) [jsf-impl-2.2.6-jbossorg-4.jar:] 
    at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:337) [jboss-jsf-api_2.2_spec-2.2.6.jar:2.2.6] 
    at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:337) [jboss-jsf-api_2.2_spec-2.2.6.jar:2.2.6] 
    at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:337) [jboss-jsf-api_2.2_spec-2.2.6.jar:2.2.6] 
    at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:120) [jsf-impl-2.2.6-jbossorg-4.jar:] 
    at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101) [jsf-impl-2.2.6-jbossorg-4.jar:] 
    at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:219) [jsf-impl-2.2.6-jbossorg-4.jar:] 
    at javax.faces.webapp.FacesServlet.service(FacesServlet.java:647) [jboss-jsf-api_2.2_spec-2.2.6.jar:2.2.6] 
    at io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:85) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final] 
    at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:130) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final] 
    at org.primefaces.webapp.filter.FileUploadFilter.doFilter(FileUploadFilter.java:78) [primefaces-5.2.jar:5.2] 
    at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:60) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final] 
    at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:132) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final] 
    at io.undertow.websockets.jsr.JsrWebSocketFilter.doFilter(JsrWebSocketFilter.java:123) [undertow-websockets-jsr-1.0.15.Final.jar:1.0.15.Final] 
    at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:60) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final] 
    at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:132) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final] 
    at com.foo.presentation.filter.NoCacheFilter.doFilter(NoCacheFilter.java:43) [classes:] 
    at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:60) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final] 
    at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:132) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final] 
    at io.undertow.servlet.handlers.FilterHandler.handleRequest(FilterHandler.java:85) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final] 
    at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:61) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final] 
    at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final] 
    at org.wildfly.extension.undertow.security.SecurityContextAssociationHandler.handleRequest(SecurityContextAssociationHandler.java:78) 
    at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25) [undertow-core-1.0.15.Final.jar:1.0.15.Final] 
    at io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:113) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final] 
    at io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:56) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final] 
    at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25) [undertow-core-1.0.15.Final.jar:1.0.15.Final] 
    at io.undertow.security.handlers.AuthenticationConstraintHandler.handleRequest(AuthenticationConstraintHandler.java:51) [undertow-core-1.0.15.Final.jar:1.0.15.Final] 
    at io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:45) [undertow-core-1.0.15.Final.jar:1.0.15.Final] 
    at io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:61) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final] 
    at io.undertow.servlet.handlers.security.ServletSecurityConstraintHandler.handleRequest(ServletSecurityConstraintHandler.java:56) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final] 
    at io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:58) [undertow-core-1.0.15.Final.jar:1.0.15.Final] 
    at io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:70) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final] 
    at io.undertow.security.handlers.SecurityInitialHandler.handleRequest(SecurityInitialHandler.java:76) [undertow-core-1.0.15.Final.jar:1.0.15.Final] 
    at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25) [undertow-core-1.0.15.Final.jar:1.0.15.Final] 
    at org.wildfly.extension.undertow.security.jacc.JACCContextIdHandler.handleRequest(JACCContextIdHandler.java:61) 
    at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25) [undertow-core-1.0.15.Final.jar:1.0.15.Final] 
    at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25) [undertow-core-1.0.15.Final.jar:1.0.15.Final] 
    at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:240) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final] 
    at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:227) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final] 
    at io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:73) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final] 
    at io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:146) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final] 
    at io.undertow.server.Connectors.executeRootHandler(Connectors.java:177) [undertow-core-1.0.15.Final.jar:1.0.15.Final] 
    at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:727) [undertow-core-1.0.15.Final.jar:1.0.15.Final] 
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [rt.jar:1.8.0_05] 
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [rt.jar:1.8.0_05] 
    at java.lang.Thread.run(Thread.java:745) [rt.jar:1.8.0_05] 
Caused by: javax.el.PropertyNotFoundException: Target Unreachable, 'null' returned null 
    at com.sun.el.parser.AstValue.getTarget(AstValue.java:192) [javax.el-3.0.0.jar:] 
    at com.sun.el.parser.AstValue.getType(AstValue.java:86) [javax.el-3.0.0.jar:] 
    at com.sun.el.ValueExpressionImpl.getType(ValueExpressionImpl.java:201) [javax.el-3.0.0.jar:] 
    at org.jboss.weld.el.WeldValueExpression.getType(WeldValueExpression.java:93) [weld-core-impl-2.1.2.Final.jar:2014-01-09 09:23] 
    at org.jboss.weld.el.WeldValueExpression.getType(WeldValueExpression.java:93) [weld-core-impl-2.1.2.Final.jar:2014-01-09 09:23] 
    at org.primefaces.el.ValueExpressionAnalyzer.intercept(ValueExpressionAnalyzer.java:69) [primefaces-5.2.jar:5.2] 
    at org.primefaces.el.ValueExpressionAnalyzer.getExpression(ValueExpressionAnalyzer.java:44) [primefaces-5.2.jar:5.2] 
    at org.primefaces.util.DynamicResourceBuilder.build(DynamicResourceBuilder.java:52) [primefaces-5.2.jar:5.2] 
    at org.primefaces.component.graphicimage.GraphicImageRenderer.getImageSrc(GraphicImageRenderer.java:75) [primefaces-5.2.jar:5.2] 
    at org.primefaces.component.graphicimage.GraphicImageRenderer.encodeEnd(GraphicImageRenderer.java:41) [primefaces-5.2.jar:5.2] 
    ... 100 more 

UPDATE:

issue (#476)已定,並應在PrimeFaces V 5.3可用,但我還沒有機會測試它尚未。

+1

尷尬。如果你使用'#{manageUsersBean.profilePicField.paint()}'呢?你有沒有嘗試升級WildFly? (或至少是它的EL impl) – BalusC

+0

是的,'#{manageUsersBean.profilePicField.paint()}'起作用。奇怪的。我正在使用EL 3.0.1-b05的Wildfly 8.2 Final。當它變得可用時,我將升級到Wildfly 9.0 Final。如果你想作出回答,我會標記回答的問題。非常感謝。 –

+1

畢竟不是WildFly/EL問題。 PrimeFaces'ValueExpressionAnalyzer'是這裏的原因。 – BalusC

回答

3

org.primefaces.el.ValueExpressionAnalyzer並不期望在這裏嵌套的方法調用。只需使它成爲一個嵌套的屬性調用。

<p:graphicImage value="#{manageUsersBean.profilePicField.paint()}"/> 
+0

這應該被認爲是PF中的一個錯誤嗎? – Kukeltje

+0

是的,但我不希望有一個快速的解決方案,因爲有一個相對簡單的解決方法,它實際上是「更正確」的方法。 – BalusC

+0

我同意,但是我正在爲這個類添加一些東西,並在下週創建一個pull請求,所以添加這個作爲一個額外的修復程序,我可以看看 – Kukeltje

相關問題