title: Cannot pass arguments to a method through EL - javax.el.MethodNotFoundException
body: <p>Using JSF 2.0 and EL, I am trying to call a method on a POJO which is an attribute of a viewscoped bean. The code is actually very similar to <strong><a href="https://stackoverflow.com/users/157882/balusc">@BalusC</a></strong>'s tutorial <a href="http://balusc.blogspot.com/2011/09/communication-in-jsf-20.html#ProcessingGETRequestParameters" rel="nofollow noreferrer">here</a>. When I call a method that takes no arguments, everything's fine. But when I try to call a method that takes an argument, I get the following exception:</p>
  
  <pre><code>javax.faces.el.MethodNotFoundException: javax.el.MethodNotFoundException:
  /user.xhtml at line 42 and column 32 action="#{users.user.removeFriend(friend)}":
  Method not found: model.User@67f2b0dd.removeFriend()
  </code></pre>
  
  <p>Here are some more details:</p>
  
  <p><strong>user.xhtml</strong></p>
  
  <pre><code>&lt;f:metadata&gt;
      &lt;f:viewParam name="id" value="#{users.id}" /&gt;
      &lt;f:event type="preRenderView" listener="#{users.init}" /&gt;
  &lt;/f:metadata&gt;
  
  ...
  
  &lt;h:form id="usersForm"&gt;
      &lt;p:outputPanel&gt;    
          &lt;p:dataTable id="userTable" value="#{users.user.friendList}" var="friend"&gt;
              &lt;p:column&gt;
                  &lt;h:outputText value="#{friend.name}" /&gt;
              &lt;/p:column&gt;
              &lt;p:column&gt;
                  &lt;p:commandButton action="#{users.user.removeFriend(friend)}"
                      ajax="true"
                      update="userTable somethingElse" process="@this"
                      onerror="errorDialog.show();"
                      icon="ui-icon-delete"
                      title="delete user"&gt;
                  &lt;/p:commandButton&gt;
              &lt;/p:column&gt;
          &lt;/p:dataTable&gt;
      &lt;/p:outputPanel&gt;
  
      &lt;p:commandButton action="#{users.user.removeAllFriends()}" ajax="true"
                  update="userTable somethingElse"
                  process="@this"
                  icon="ui-icon-close"
                  value="delete all friends?"&gt;
      &lt;/p:commandButton&gt;
  
  
  &lt;/h:form&gt;
  </code></pre>
  
  <p>I have the following <code>ViewScoped</code> bean:</p>
  
  <p><strong>Users.java</strong></p>
  
  <pre><code>@ManagedBean(name = "users")
  @ViewScoped
  public class Users implements Serializable {
      private static final long serialVersionUID = 1L;
  
      private String id;
      private User user;
  
      @ManagedProperty("#{userService}")
      private UserService userService; // session scoped
  
      public void init() {
          user = userService.getCart(id);
      }
  
      public final String getId() {
          return id;
      }
  
      public final void setId(String id) {
          this.id= id;
      }
  
      public final User getUser() {
          return user;
      }
  
      public final void setUser(User user) {
          this.user= user;
      }
  
      public final void setUserService(UserService userService) {
          this.userService = userService;
      }
  
  }
  </code></pre>
  
  <p>The <code>User</code> class - a POJO - has a <code>private List&lt;Friend&gt; friends</code> attribute, with getter and setters and a <code>public</code> method <code>User#removeFriend(Friend f)</code>. It has another <code>public</code> method; <code>User#removeAllFriends()</code>.</p>
  
  <p>The page renders fine but I get the exception when I click the "Remove" commandButton next to a user in the table.</p>
  
  <p>What's wrong here? Why can I successfully call a parameter-less method but can't pass arguments to another?</p>
  
  <p><strong>Edit:</strong> The application is deployed on Tomcat 7.0, if that's any good.</p>
  
  <p>Any help appreciated.</p>
  
  <p><strong>Update:</strong> As BalusC and Neo pointed, this is an issue with Tomcat 7.0. I installed WebLogic 12.1 and it all worked fine.</p>