1 Reply Latest reply on May 21, 2013 1:09 AM by Siva P

    Richfaces 4 Autocomplete not work (Target Unreachable, identifier 'userBean1' resolved to null)

    mohamed sassi Newbie

      I am using jsf 2.2 and richfaces 4, My bean :

       

      /**

      package com.mkyong;

      import java.util.ArrayList;

      import java.util.List;

      import javax.faces.bean.ManagedBean;

      import javax.faces.bean.ViewScoped;

       

       

      @ManagedBean

      @ViewScoped

      public class UserBean1 {

          public List<String> autocomplete(String prefix) {

              ArrayList<String> result = new ArrayList<String>();

              result.add("England");

              result.add("France");

              result.add("Germany");

              result.add("Italy");

              result.add("Spain");

              return result;

          }

          private String name;

          private String state;

          public String getState() {

              return state;

          }

          public String getName() {

              return name;

          }

      }

       

      -------My view

      <ui:composition xmlns="http://www.w3.org/1999/xhtml"

      xmlns:h="http://java.sun.com/jsf/html"

      xmlns:f="http://java.sun.com/jsf/core"

      xmlns:ui="http://java.sun.com/jsf/facelets"

      xmlns:a4j="http://richfaces.org/a4j"

      xmlns:rich="http://richfaces.org/rich">

      <f:view>

      <h:head></h:head>

      <h:body>

      <rich:panel header="Richfaces sample validation and auto-completion">

         <h:form>

           <h:outputText value="Enter your name" />

           <h:inputText id="name" value="#{userBean1.name}">

              <rich:validator />

           </h:inputText>

           <rich:message for="name" />

           <br />

       

           <h:outputText value="Enter your state" />

           <rich:autocomplete value="#{userBean1.state}" minChars="1" autocompleteMethod="#{userBean1.autocomplete}" />

         </h:form>

      </rich:panel>

      </h:body>

      </f:view>

      </ui:composition>

       

      ----------------------------> :

      19 mai 2013 21:47:39 org.richfaces.renderkit.AutocompleteRendererBase getItems

      GRAVE: /page1.xhtml @23,114 autocompleteMethod="#{userBean1.autocomplete}": Target Unreachable, identifier 'userBean1' resolved to null

      javax.el.PropertyNotFoundException: /page1.xhtml @23,114 autocompleteMethod="#{userBean1.autocomplete}": Target Unreachable, identifier 'userBean1' resolved to null

                at com.sun.faces.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:107)

                at org.richfaces.renderkit.AutocompleteRendererBase.getItems(AutocompleteRendererBase.java:102)

                at org.richfaces.renderkit.AutocompleteRendererBase.encodeItems(AutocompleteRendererBase.java:163)

                at org.richfaces.renderkit.AutocompleteRendererBase.encodeMetaComponent(AutocompleteRendererBase.java:275)

                at org.richfaces.component.AbstractAutocomplete.encodeMetaComponent(AbstractAutocomplete.java:405)

                at org.richfaces.context.ExtendedPartialViewContextImpl$RenderVisitCallback.visit(ExtendedPartialViewContextImpl.java:546)

                at org.richfaces.context.BaseExtendedVisitContext.invokeVisitCallback(BaseExtendedVisitContext.java:321)

                at org.richfaces.context.ExtendedVisitContext.invokeMetaComponentVisitCallback(ExtendedVisitContext.java:68)

                at org.richfaces.component.AbstractAutocomplete.visitTree(AbstractAutocomplete.java:391)

                at javax.faces.component.UIComponent.visitTree(UIComponent.java:1700)

                at javax.faces.component.UIForm.visitTree(UIForm.java:371)

                at javax.faces.component.UIComponent.visitTree(UIComponent.java:1700)

                at javax.faces.component.UIComponent.visitTree(UIComponent.java:1700)

                at javax.faces.component.UIComponent.visitTree(UIComponent.java:1700)

                at org.richfaces.context.ExtendedPartialViewContextImpl.processPartialRenderPhase(ExtendedPartialViewContextImpl.java:310)

                at org.richfaces.context.ExtendedPartialViewContextImpl.processPartial(ExtendedPartialViewContextImpl.java:213)

                at javax.faces.component.UIViewRoot.encodeChildren(UIViewRoot.java:1004)

                at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1856)

                at com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:417)

                at com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:131)

                at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:337)

                at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:120)

                at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)

                at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:219)

                at javax.faces.webapp.FacesServlet.service(FacesServlet.java:647)

                at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)

                at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)

                at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:83)

                at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)

                at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)

                at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)

                at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:366)

                at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:109)

                at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:83)

                at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:378)

                at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:97)

                at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:378)

                at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:100)

                at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:378)

                at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:78)

                at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:378)

                at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:54)

                at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:378)

                at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:35)

                at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:378)

                at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:187)

                at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:378)

                at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:105)

                at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:378)

                at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:79)

                at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:378)

                at org.springframework.security.web.session.ConcurrentSessionFilter.doFilter(ConcurrentSessionFilter.java:109)

                at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:378)

                at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:167)

                at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:237)

                at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167)

                at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)

                at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)

                at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)

                at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)

                at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)

                at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)

                at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)

                at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)

                at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:852)

                at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)

                at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)

                at java.lang.Thread.run(Thread.java:619)

        • 1. Re: Richfaces 4 Autocomplete not work (Target Unreachable, identifier 'userBean1' resolved to null)
          Siva P Master

          Hi,

           

          I have worked in auto complete before and it is working fine.

          Please check ur means is @ManagedBean and your bean is userBean1.

          Ans also try to change the bean name and execute the application.Because ur JSP or Xhtml page is not able to find out the bean woith name userBean1.

          For me i have faced problem like after selecting value from autocomplete ,we can't ale to rerender the dattable in the same screen.

          https://community.jboss.org/message/798878#798878

           

          sample ,

           

          <rich:autocomplete value="#{loginBean.state}" minChars="1" autocompleteMethod="#{loginBean.autocomplete}" />

           

          public List<String> autocomplete(String prefix) {  

           

           

                        System.out.println("StartsWith:"+prefix);

                        ArrayList<String> result = new ArrayList<String>();  

                        for(UserBean beanObj:employeelst)

                        {

                                  if(beanObj.getEmployee_name().toLowerCase().startsWith(prefix))

                                  {

                                            result.add(beanObj.getEmployee_name());

                                  }

                        }

                   return result;

              }

           

          Thanks,

          Siva

          1 of 1 people found this helpful