3 Replies Latest reply on Oct 5, 2006 1:49 PM by Gavin King

    java.lang.NoSuchMethodException

    Monkey Den Master

      Can't seem to find the problem here. The search() method is defined in the local interface and the session bean, and it's invoked by the JSP/JSF. As you can see, the email field is annotated as @In+@Out, neither required. I recieve as NoSuchMethodException.

      Entity

      @Local
      public interface UserSearch {
       public String search();
      }


      SFSB
      @Stateful
      @Scope(ScopeType.SESSION)
      @Name("usersearch")
      public class UserSearchAction implements UserSearch, Serializable {
      
       @PersistenceContext
       private EntityManager em;
      
       @In(required=false)
       @Out(required=false)
       private String email;
       ...
       public String search() {
       String queryStr = "from UserView where lower(email) = :email";
       Query query = em.createQuery(queryStr);
      
       query.setParameter("email", email.toLowerCase() + "%");
      
       //The complete list of results
       this.searchResults = query.getResultList();
       return "refresh-page";
       }
       ...
      }


      JSP
      <f:view>
       <h:form>
       <h:inputText id="email" value="#{email}" />
       <h:commandButton id="search" type="submit" value="Search" action="#{usersearch.search}" styleClass="formButton" />
       </h:form>
      </f:view>


      Stacktrace
      javax.faces.FacesException: Error calling action method of component with id _id0:search
       at org.apache.myfaces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:74)
       at javax.faces.component.UICommand.broadcast(UICommand.java:106)
       at javax.faces.component.UIViewRoot._broadcastForPhase(UIViewRoot.java:90)
       at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:164)
       at org.apache.myfaces.lifecycle.LifecycleImpl.invokeApplication(LifecycleImpl.java:316)
       at org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:86)
       at javax.faces.webapp.FacesServlet.service(FacesServlet.java:106)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:144)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
       at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
       at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
       at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
       at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
       at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
       at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
       at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
       at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
       at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
       at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
       at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
       at java.lang.Thread.run()V(Unknown Source)
      Caused by: javax.faces.el.EvaluationException: Exception while invoking expression #{usersearch.search}
       at org.apache.myfaces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:165)
       at org.apache.myfaces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:63)
       ... 27 more
      Caused by: java.lang.NoSuchMethodException: search
       at java.lang.Class.findMethod(Ljava.lang.String;[Ljava.lang.Class;I)Ljava.lang.reflect.Method;(Unknown Source)
       at java.lang.Class.getMethod(Ljava.lang.String;[Ljava.lang.Class;I)Ljava.lang.reflect.Method;(Unknown Source)
       at org.apache.myfaces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:118)