1 Reply Latest reply on Jun 4, 2012 4:43 PM by mrusinak

    JAX-RS and ClientFramework Connection problem

    sirwayne

      Hello,

       

      i cant't open a thread in the rest usegroup, so i post here my problem. =)...

       

      I try to start the client example from the easy user guide: Iam using JBoss6 AS.

      http://docs.jboss.org/resteasy/docs/2.0.0.GA/userguide/html/RESTEasy_Client_Framework.html

       

      but i get always a 404 error

       

      Exception in thread "main" org.jboss.resteasy.client.ClientResponseFailure: Error status 404 Not Found returned
          at org.jboss.resteasy.client.core.BaseClientResponse.createResponseFailure(BaseClientResponse.java:414)
          at org.jboss.resteasy.client.core.BaseClientResponse.createResponseFailure(BaseClientResponse.java:405)
          at org.jboss.resteasy.client.core.BaseClientResponse.checkFailureStatus(BaseClientResponse.java:399)
          at org.jboss.resteasy.client.core.extractors.BodyEntityExtractor.extractEntity(BodyEntityExtractor.java:38)
          at org.jboss.resteasy.client.core.ClientInvoker.invoke(ClientInvoker.java:107)
          at org.jboss.resteasy.client.core.ClientProxy.invoke(ClientProxy.java:72)
          at $Proxy18.getBasic(Unknown Source)
          at client.RestClient.main(RestClient.java:34)
      

       

      My Code:

      Client side:

       

      public class RestClient {
      
          public static void main(String[] args) {
                 // this initialization only needs to be done once per VM
              RegisterBuiltin.register(ResteasyProviderFactory.getInstance());
              SimpleClient client = ProxyFactory.create(SimpleClient.class, "http://localhost:8080/");
              System.out.println(client.getBasic());
          }
      
      }
      

       

      Server side:

       

      @Path("/")
      public interface SimpleClient
      {
         @GET
         @Path("basic")
         @Produces("text/plain")
         String getBasic();
      }
      

       

      public class SimpleClientImpl implements SimpleClient{
      
          @Override
          public String getBasic() {
              return "Test";
          }
      }
      

       

       

      web.xml

       

      <?xml version="1.0" encoding="UTF-8"?>
      <web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
      </web-app>
      

       

      Has anybody an idea? There is no problem if i use a browser http://localhost:8080/project/basic

       

      Thanks =)