2 Replies Latest reply on Jan 3, 2011 2:51 PM by carmine lia

    RESTEasy client error

    Bret Wortman Newbie

      I think this might be a problem in RESTEasy, but since it could just as easily be a problem in my code I wanted to post here for review before I open a bug about it.


      What I have is an interface that defines my services.  When I create a proxy client, one of the methods (getAllForDwell) throws an exception each time I try to invoke it.


      @Path("/messages")
      public interface IMessageResource {
      
              // Methods omitted for brevity
      
           @POST
           @Produces("application/xml")
           @Consumes("application/xml")
           @Path("/SSR")
           public List<Message> querySSR(SSRRequest request);
           
           @GET
           @Produces("application/xml")
           @Path("/dwellSet/{id}")
           public List<Message> getAllForDwell(@PathParam("{id}") Long dwellId);



      When I invoke (again, some code removed for brevity):


      // Properties map
      private static GPRIProperties gpriProperties;
      
      // Client proxy for talking to the web services.
      private IMessageResource client;
      
      // Static initializer to load the url from properties.
      static {
           gpriProperties = GPRIProperties.getInstance();
           url = "http://" + gpriProperties.getProperty("server") + ":"
                     + gpriProperties.getProperty("jbossPort")
                     + gpriProperties.getProperty("urlPrefix");
      }
      
      @Test
      public void testGetAllForDwell() {
           List<Message> messages = client.getAllForDwell(201004211223340L);



      I get the following error trace:


      java.lang.RuntimeException: java.lang.IllegalArgumentException: You did not supply enough values to fill path parameters
           at org.jboss.resteasy.client.core.ClientInvoker.invoke(ClientInvoker.java:101)
           at org.jboss.resteasy.client.core.ClientProxy.invoke(ClientProxy.java:72)
           at $Proxy21.getAllForDwell(Unknown Source)
           at com.techma.shepherd.client.TestClient.testGetAllForDwell(TestClient.java:1672)
           at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
           at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
           at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
           at java.lang.reflect.Method.invoke(Unknown Source)
           at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
           at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
           at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
           at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
           at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:76)
           at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
           at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
           at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
           at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
           at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
           at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
           at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
           at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:49)
           at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
           at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
           at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
           at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
           at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
      Caused by: java.lang.IllegalArgumentException: You did not supply enough values to fill path parameters
           at org.jboss.resteasy.specimpl.UriBuilderImpl.buildFromValues(UriBuilderImpl.java:546)
           at org.jboss.resteasy.specimpl.UriBuilderImpl.build(UriBuilderImpl.java:539)
           at org.jboss.resteasy.client.ClientRequest.getUri(ClientRequest.java:761)
           at org.jboss.resteasy.client.core.executors.ApacheHttpClientExecutor.execute(ApacheHttpClientExecutor.java:76)
           at org.jboss.resteasy.core.interception.ClientExecutionContextImpl.proceed(ClientExecutionContextImpl.java:39)
           at org.jboss.resteasy.plugins.interceptors.encoding.AcceptEncodingGZIPInterceptor.execute(AcceptEncodingGZIPInterceptor.java:40)
           at org.jboss.resteasy.core.interception.ClientExecutionContextImpl.proceed(ClientExecutionContextImpl.java:45)
           at org.jboss.resteasy.client.ClientRequest.execute(ClientRequest.java:449)
           at org.jboss.resteasy.client.ClientRequest.httpMethod(ClientRequest.java:679)
           at org.jboss.resteasy.client.core.ClientInvoker.invoke(ClientInvoker.java:97)
           ... 25 more



      I don't see anything missing in this code, and all the other tests which exercise the other methods defined in the interface work perfectly.  Is there an obvious flaw in my code?