[jboss-user] [JBoss Web Services] - JAX-RS and ClientFramework

Michael Müller do-not-reply at jboss.com
Wed May 18 08:04:07 EDT 2011


Michael Müller [http://community.jboss.org/people/sirwayne] created the discussion

"JAX-RS and ClientFramework"

To view the discussion, visit: http://community.jboss.org/message/605821#605821

--------------------------------------------------------------
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:
 http://docs.jboss.org/resteasy/docs/2.0.0.GA/userguide/html/RESTEasy_Client_Framework.html 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/ 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 http://java.sun.com/xml/ns/javaee"
    xmlns:xsi=" http://www.w3.org/2001/XMLSchema-instance http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation=" http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee  http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd 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 http://localhost:8080/project/basic

Thanks =)
--------------------------------------------------------------

Reply to this message by going to Community
[http://community.jboss.org/message/605821#605821]

Start a new discussion in JBoss Web Services at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2044]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20110518/9ca7f7e7/attachment.html 


More information about the jboss-user mailing list