Why Target Unreachable in rich:popUp?
daxxy Mar 23, 2012 7:57 AMRichfaces 4.2.0.
I am trying to duplicate the functionality shown in Data Table Edit of showcase with one big difference. I am using a dataGrid instead of a dataTable, but I figured I could get it to work anyway. I am get a "Target Unreachable, 'editedAlternate' returned null" error, and it seems clear why I am getting it. When the page loads, contactView.editedAlternate resolves to null. Duh.
What I don't understand is why the example in the showcase does *not* get this error. What are you doing that I am not? I don't see where editedCar is getting initialized except *after* the commandLink to display the popup is invoked. So how come editedCar is not resolving to null and producing this same error?
Here is excerpt from my code. Let me know if you need more info
<rich:dataGrid value="#{contactView.doors.alternateList}" var="alt" rowKeyVar="idx">
<rich:panel>
<a4j:commandLink execute="@this" render="editPanel"
oncomplete="#{rich:component('editPanel')}.show()" >
<h:graphicImage value="/icons/edit.png" />
<f:setPropertyActionListener
target="#{contactView.editedAlternate}" value="#{alt}" />
</a4j:commandLink>
<a4j:commandLink action="#{contactView.delete(alt)}">
<h:graphicImage value="/icons/delete.png" />
</a4j:commandLink>
<h:panelGrid columns="1">
<h:outputText id="nm11" value="#{alt.name}" />
<h:outputText id="pgr11" value="#{alt.phone}" />
<h:outputText id="adr11" value="#{alt.pager}" />
<h:outputText id="adr21" value="#{alt.comment}" />
</h:panelGrid>
</rich:panel>
</rich:dataGrid>
<rich:popupPanel id="editPanel" >
<h:panelGrid columns="2">
<h:outputText value="Name" />
<h:inputText id="innm21" value="#{contactView.editedAlternate.name}" />
<h:outputText value="Phone" />
<h:inputText id="inpgr21" value="#{contactView.editedAlternate.phone}" />
<h:outputText value="Pager" />
<h:inputText id="inadr41" value="#{contactView.editedAlternate.pager}" />
<h:outputText value="Comment" />
<h:inputText id="inadr31" value="#{contactView.editedAlternate.comment}" />
</h:panelGrid>
<a4j:commandLink value="Save" actionListener="#{contactView.save(contactView.editedAlternate)}"
render="list newcontact" oncomplete="#{rich:component('editPanel')}.hide(); return false;"/>
<a4j:commandButton value="Cancel" onclick="#{rich:component('editPanel')}.hide(); return false;" />
</rich:popupPanel>
And here is the stack trace
16:08:58,276 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/contacts-as7].[FacesServlet]] (http--0.0.0.0-8080-3) Servlet.service() for servlet FacesServlet threw exception: javax.enterprise.event.ObserverException
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) [rt.jar:1.6.0_25]
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) [rt.jar:1.6.0_25]
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) [rt.jar:1.6.0_25]
at java.lang.reflect.Constructor.newInstance(Constructor.java:513) [rt.jar:1.6.0_25]
at java.lang.Class.newInstance0(Class.java:355) [rt.jar:1.6.0_25]
at java.lang.Class.newInstance(Class.java:308) [rt.jar:1.6.0_25]
at org.jboss.weld.util.reflection.SecureReflections$16.work(SecureReflections.java:343) [weld-core-1.1.5.AS71.Final-redhat-1.jar:2012-02-22 16:46]
at org.jboss.weld.util.reflection.SecureReflectionAccess.run(SecureReflectionAccess.java:52) [weld-core-1.1.5.AS71.Final-redhat-1.jar:2012-02-22 16:46]
at org.jboss.weld.util.reflection.SecureReflectionAccess.runAsInstantiation(SecureReflectionAccess.java:173) [weld-core-1.1.5.AS71.Final-redhat-1.jar:2012-02-22 16:46]
at org.jboss.weld.util.reflection.SecureReflections.newInstance(SecureReflections.java:340) [weld-core-1.1.5.AS71.Final-redhat-1.jar:2012-02-22 16:46]
at org.jboss.weld.injection.Exceptions.rethrowException(Exceptions.java:33) [weld-core-1.1.5.AS71.Final-redhat-1.jar:2012-02-22 16:46]
at org.jboss.weld.injection.Exceptions.rethrowException(Exceptions.java:73) [weld-core-1.1.5.AS71.Final-redhat-1.jar:2012-02-22 16:46]
at org.jboss.weld.injection.MethodInjectionPoint.invokeOnInstanceWithSpecialValue(MethodInjectionPoint.java:162) [weld-core-1.1.5.AS71.Final-redhat-1.jar:2012-02-22 16:46]
at org.jboss.weld.event.ObserverMethodImpl.sendEvent(ObserverMethodImpl.java:241) [weld-core-1.1.5.AS71.Final-redhat-1.jar:2012-02-22 16:46]
at org.jboss.weld.event.ObserverMethodImpl.sendEvent(ObserverMethodImpl.java:229) [weld-core-1.1.5.AS71.Final-redhat-1.jar:2012-02-22 16:46]
at org.jboss.weld.event.ObserverMethodImpl.notify(ObserverMethodImpl.java:207) [weld-core-1.1.5.AS71.Final-redhat-1.jar:2012-02-22 16:46]
at org.jboss.weld.manager.BeanManagerImpl.notifyObservers(BeanManagerImpl.java:569) [weld-core-1.1.5.AS71.Final-redhat-1.jar:2012-02-22 16:46]
at org.jboss.weld.manager.BeanManagerImpl.fireEvent(BeanManagerImpl.java:559) [weld-core-1.1.5.AS71.Final-redhat-1.jar:2012-02-22 16:46]
at org.jboss.weld.manager.BeanManagerImpl.fireEvent(BeanManagerImpl.java:554) [weld-core-1.1.5.AS71.Final-redhat-1.jar:2012-02-22 16:46]
at org.jboss.solder.servlet.exception.CatchExceptionFilter.doFilter(CatchExceptionFilter.java:74) [solder-impl-3.1.0.Final.jar:3.1.0.Final]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280) [jbossweb-7.0.10.Final-redhat-1.jar:]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.10.Final-redhat-1.jar:]
at org.jboss.solder.servlet.event.ServletEventBridgeFilter.doFilter(ServletEventBridgeFilter.java:74) [solder-impl-3.1.0.Final.jar:3.1.0.Final]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280) [jbossweb-7.0.10.Final-redhat-1.jar:]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.10.Final-redhat-1.jar:]
at com.ocpsoft.pretty.PrettyFilter.doFilter(PrettyFilter.java:126) [prettyfaces-jsf2-3.3.2.jar:]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280) [jbossweb-7.0.10.Final-redhat-1.jar:]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.10.Final-redhat-1.jar:]
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275) [jbossweb-7.0.10.Final-redhat-1.jar:]
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161) [jbossweb-7.0.10.Final-redhat-1.jar:]
at org.jboss.as.jpa.interceptor.WebNonTxEmCloserValve.invoke(WebNonTxEmCloserValve.java:50) [jboss-as-jpa-7.1.0.Final-redhat-1.jar:7.1.0.Final-redhat-1]
at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:154) [jboss-as-web-7.1.0.Final-redhat-1.jar:7.1.0.Final-redhat-1]
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:155) [jbossweb-7.0.10.Final-redhat-1.jar:]
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) [jbossweb-7.0.10.Final-redhat-1.jar:]
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) [jbossweb-7.0.10.Final-redhat-1.jar:]
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:368) [jbossweb-7.0.10.Final-redhat-1.jar:]
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877) [jbossweb-7.0.10.Final-redhat-1.jar:]
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:671) [jbossweb-7.0.10.Final-redhat-1.jar:]
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:930) [jbossweb-7.0.10.Final-redhat-1.jar:]
at java.lang.Thread.run(Thread.java:662) [rt.jar:1.6.0_25]
Caused by: javax.servlet.ServletException: /index.xhtml @85,55 value="#{contactView.editedAlternate.name}": Target Unreachable, 'editedAlternate' returned null
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:606) [jboss-jsf-api_2.1_spec-2.0.0.Final-redhat-1.jar:2.0.0.Final-redhat-1]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329) [jbossweb-7.0.10.Final-redhat-1.jar:]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.10.Final-redhat-1.jar:]
at org.jboss.weld.servlet.ConversationPropagationFilter.doFilter(ConversationPropagationFilter.java:62) [weld-core-1.1.5.AS71.Final-redhat-1.jar:2012-02-22 16:46]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280) [jbossweb-7.0.10.Final-redhat-1.jar:]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.10.Final-redhat-1.jar:]
at org.jboss.solder.servlet.exception.CatchExceptionFilter.doFilter(CatchExceptionFilter.java:65) [solder-impl-3.1.0.Final.jar:3.1.0.Final]
... 20 more
Caused by: javax.el.PropertyNotFoundException: /index.xhtml @85,55 value="#{contactView.editedAlternate.name}": Target Unreachable, 'editedAlternate' returned null
at com.sun.faces.facelets.el.TagValueExpression.getType(TagValueExpression.java:100) [jsf-impl-2.1.5-redhat-1.jar:2.1.5-redhat-1]
at com.sun.faces.renderkit.html_basic.HtmlBasicInputRenderer.getConvertedValue(HtmlBasicInputRenderer.java:95) [jsf-impl-2.1.5-redhat-1.jar:2.1.5-redhat-1]
at javax.faces.component.UIInput.getConvertedValue(UIInput.java:1030) [jboss-jsf-api_2.1_spec-2.0.0.Final-redhat-1.jar:2.0.0.Final-redhat-1]
at javax.faces.component.UIInput.validate(UIInput.java:960) [jboss-jsf-api_2.1_spec-2.0.0.Final-redhat-1.jar:2.0.0.Final-redhat-1]
at javax.faces.component.UIInput.executeValidate(UIInput.java:1233) [jboss-jsf-api_2.1_spec-2.0.0.Final-redhat-1.jar:2.0.0.Final-redhat-1]
at javax.faces.component.UIInput.processValidators(UIInput.java:698) [jboss-jsf-api_2.1_spec-2.0.0.Final-redhat-1.jar:2.0.0.Final-redhat-1]
at javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1214) [jboss-jsf-api_2.1_spec-2.0.0.Final-redhat-1.jar:2.0.0.Final-redhat-1]
at javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1214) [jboss-jsf-api_2.1_spec-2.0.0.Final-redhat-1.jar:2.0.0.Final-redhat-1]
at javax.faces.component.UIForm.processValidators(UIForm.java:253) [jboss-jsf-api_2.1_spec-2.0.0.Final-redhat-1.jar:2.0.0.Final-redhat-1]
at javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1214) [jboss-jsf-api_2.1_spec-2.0.0.Final-redhat-1.jar:2.0.0.Final-redhat-1]
at javax.faces.component.UIViewRoot.processValidators(UIViewRoot.java:1172) [jboss-jsf-api_2.1_spec-2.0.0.Final-redhat-1.jar:2.0.0.Final-redhat-1]
at com.sun.faces.lifecycle.ProcessValidationsPhase.execute(ProcessValidationsPhase.java:76) [jsf-impl-2.1.5-redhat-1.jar:2.1.5-redhat-1]
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101) [jsf-impl-2.1.5-redhat-1.jar:2.1.5-redhat-1]
at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118) [jsf-impl-2.1.5-redhat-1.jar:2.1.5-redhat-1]
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:593) [jboss-jsf-api_2.1_spec-2.0.0.Final-redhat-1.jar:2.0.0.Final-redhat-1]
... 26 more
TDR