title: Jersey Producing media type conflict
body: <p>I'm trying out Jersey at the moment, followed <a href="http://netbeans.org/kb/docs/websvc/rest.html">this</a> link to set up a web service in netbeans. I have my entities classes and my REST classes.
  It works to add, edit, delete, request objects (in this case Users objects) from a javafx2 client.</p>
  
  <p>However, now I try to add a new method to my webservice for some simple authentication. First I added a new named query (Users.login) in the Users.java file:</p>
  
  <pre><code>@NamedQueries({
      @NamedQuery(name = "Users.findAll", query = "SELECT u FROM Users u"),
      @NamedQuery(name = "Users.login", query = "SELECT u FROM Users u WHERE u.username = :username AND u.password = :password"),
      @NamedQuery(name = "Users.findById", query = "SELECT u FROM Users u WHERE u.id = :id"),
      @NamedQuery(name = "Users.findByUserlevel", query = "SELECT u FROM Users u WHERE u.userlevel = :userlevel"),
      @NamedQuery(name = "Users.findByDisabled", query = "SELECT u FROM Users u WHERE u.disabled = :disabled")
  })
  </code></pre>
  
  <p>Afterwards I added following code to my UsersFacadeREST.java file (generated by Netbeans 7.2):</p>
  
  <pre><code>@GET
  @Path("{username}/{password}")
  @Produces({"application/xml", "application/json"})
  public Users login(@PathParam("username") String username, @PathParam("password") String password) {
      return em.createNamedQuery("login", Users.class)
              .setParameter("username", username)
              .setParameter("password", password)
              .getSingleResult();
  }
  </code></pre>
  
  <p>However, I receive following error when trying to deploy the web service:</p>
  
  <pre><code>SEVERE: Producing media type conflict. The resource methods public entities.Users service.UsersFacadeREST.login(java.lang.String,java.lang.String) and public java.util.List service.UsersFacadeREST.findRange(java.lang.Integer,java.lang.Integer) can produce the same media type
  </code></pre>
  
  <p>As I'm new to this, I have no clue why the login() method is giving a conflict with findRange()? The first has 2 String parameters and give a Users object, the second has 2 integer parameters and returns a List object? Is there any way to fix this problem as I'm gonna need some custom queries added to my webservice...</p>
  
  <p>For completion:</p>
  
  <pre><code>@GET
  @Path("{from}/{to}")
  @Produces({"application/xml", "application/json"})
  public List&lt;Users&gt; findRange(@PathParam("from") Integer from, @PathParam("to") Integer to) {
      return super.findRange(new int[]{from, to});
  }
  </code></pre>
  
  <p>Code in super class (AbstractFacade.java)</p>
  
  <pre><code>public List&lt;T&gt; findRange(int[] range) {
      javax.persistence.criteria.CriteriaQuery cq = getEntityManager().getCriteriaBuilder().createQuery();
      cq.select(cq.from(entityClass));
      javax.persistence.Query q = getEntityManager().createQuery(cq);
      q.setMaxResults(range[1] - range[0]);
      q.setFirstResult(range[0]);
      return q.getResultList();
  }
  </code></pre>