title: Consume REST service with generic parameter
body: <p>I'm tryin to consume this REST service</p>
  
  <pre><code>@POST
  @Path(value="/storeGeneric")
  @Consumes(MediaType.APPLICATION_JSON)
  public &lt;T&gt; void storeGeneric(T data) {
      try {
          System.out.println("data name: "+data.getClass().getCanonicalName());
          ...
      } catch (Exception e) {
          e.printStackTrace();
      }
  }
  </code></pre>
  
  <p>by passing a JSON object by this javascript function:</p>
  
  <pre><code>function sendArticolo() {
      var articolo = {};
      articolo.id = 1;
      articolo.prezzo = 1;
      articolo.descrizione="roba";
      try {
          $.ajax({
              url: 'http://localhost:8080/ZZCrudRest/services/Rest/storeArticolo',
              type: 'POST',
              contentType: 'application/json',
              data: JSON.stringify(articolo),
              dataType: 'json'
          });
      } catch (err) {
          alert(err.message);
      }
  }
  </code></pre>
  
  <p>but, I got this exception:</p>
  
  <pre><code>12:37:26,294 GRAVE [com.sun.jersey.spi.container.ContainerResponse] (http-127.0.0.1-127.0.0.1-8080-1) The RuntimeException could not be mapped to a response, re-thr
  owing to the HTTP container: java.lang.ClassCastException: java.lang.reflect.Method cannot be cast to java.lang.Class
          at com.owlike.genson.reflect.TypeUtil.getTypes(TypeUtil.java:362) [genson-0.94.jar:]
          at com.owlike.genson.reflect.TypeUtil.match(TypeUtil.java:298) [genson-0.94.jar:]
          at com.owlike.genson.convert.BasicConvertersFactory.provide(BasicConvertersFactory.java:102) [genson-0.94.jar:]
          at com.owlike.genson.convert.BasicConvertersFactory.create(BasicConvertersFactory.java:74) [genson-0.94.jar:]
          at com.owlike.genson.convert.BasicConvertersFactory.create(BasicConvertersFactory.java:56) [genson-0.94.jar:]
  (more and more...)
  </code></pre>
  
  <p>Is there a way to consume a REST service with a generic parameter using JSON? I googled a lot without success. I'm using Jersey 1.8, genson 0.94, jboss 7.1.</p>