Hello Dominik,

the Contact classe from the client and server project are not identical :
they don't have the same "serialVersionUID".

Best regards,
Thierry Boileau


Hi,
> I'm trying to develop my first "restlet application" based on the tutorial.
> The goal for a JavaSE-App should be to retrieve a "Contact" object from a
> JavaEE-App.
> I downloaded the Version 2.1 Snapshot for JavaSE and for JavaEE.
> So first I've created a new JavaEE Project by selecting new "Dynamic Web
> Project" in Eclipse and added the following jar files into the folder
> WebContent -> WEB-INF -> lib:
> org.restlet.ext.servlet.jar, org.restlet.jar and org.restlet.test.jar
>
> My Application Class has only one method:
>
>     public synchronized Restlet createInboundRoot() {
>         // Create a router Restlet that routes each call to a new instance
> of HelloWorldResource.
>         Router router = new Router(getContext());
>         // Defines only one route
>         router.attach("/hello", ContactServerResource.class);
>         return router;
>     }
>
> The class ContactServerResource, Contact and the interface ContactResource
> are the same as in the Tutorial (
> http://wiki.restlet.org/docs_2.1/13-restlet/21-restlet/318-restlet/303-restlet.html
> ).
> The XML-File is from here:
> http://wiki.restlet.org/docs_2.1/13-restlet/275-restlet/312-restlet.html
> Of course i adjusted the param-value.
>
> Now I've created a JavaSE Project and added the lib org.restlet.jar JavaSE
> Version.
> Furthermore I added the same class Contact and the same interface
> ContactRessource to this project.
>
> My Main-Class looks like this:
>
>     public static void main(String[] args) throws ResourceException,
> IOException {
>         ClientResource cr = new ClientResource("
> http://localhost:8080/restlet/hello";);
>         // Get the Contact object
>         ContactResource resource = cr.wrap(ContactResource.class);
>         cr.setRequestEntityBuffering(true);
>
>         Contact contact = resource.retrieve();
>
>         if (contact != null) {
>             System.out.println("firstname: " + contact.getFirstName());
>             System.out.println(" lastname: " + contact.getLastName());
>             System.out.println("     nage: " + contact.getAge());
>         } else {
>             System.out.println("null");
>         }
>
>     }
>
> The problem is that I keep getting the answer "null" and I couldn't find
> what I'm doing wrong.
> In the appendix I put the two Eclipse projects.
>
> Do you have some suggestions for me?
>
> Kind regards
> Dominik
>

------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2722500

Reply via email to