title: JAX-RS exception: Annotated with GET of resource, class is not recognized as valid resource method
body: <p>I am using the jersey implementation of JAX-RS for the web service. I am very new to this JAX-RS.</p>
  
  <p>I am trying to add a method in the service which accept an Employee object and returns the employee Id based on the Employee object values (there is a DB hit for this).</p>
  
  <p>Following the Restful principles, I made the method as @GET and provided the url path as shown below:</p>
  
  <pre><code>@Path("/EmployeeDetails")
  public class EmployeeService {
  @GET
  @Path("/emp/{param}")
  public Response getEmpDetails(@PathParam("param") Employee empDetails) {
  
      //Get the employee details, get the db values and return the Employee Id. 
  
      return Response.status(200).entity("returnEmployeeId").build();
  
  }
  }
  </code></pre>
  
  <p>For testing purpose, I wrote this Client:</p>
  
  <pre><code>public class ServiceClient {
  
  public static void main(String[] args) {
  
      ClientConfig config = new DefaultClientConfig();
      Client client = Client.create(config);
      WebResource service = client.resource(getBaseURI());
  
      Employee emp = new Employee();
      emp.name = "Junk Name";
      emp.age = "20";
      System.out.println(service.path("rest").path("emp/" + emp).accept(MediaType.TEXT_PLAIN).get(String.class));
  
  }
  
  private static URI getBaseURI() {
      return UriBuilder.fromUri("http://localhost:8045/AppName").build();
  }
  </code></pre>
  
  <p>}</p>
  
  <p>When I run it, I am getting the error: <code>Method, public javax.ws.rs.core.Response com.rest.EmployeeService.getEmpDetails(com.model.Employee), annotated with GET of resource, class com.rest.EmployeeService, is not recognized as valid resource method.</code></p>
  
  <p><strong>Edit:</strong></p>
  
  <p>Model:</p>
  
  <pre><code>package com.model;
  
  public class Employee {
  
  public String name;
  public String age;
  
  }
  </code></pre>
  
  <p>Please let me know where is the issue, I am a beginner in this and struggling to understand the concepts :(</p>