Hi Noam,

There are some remaining bugs in the internal/default HTTP client connector.
Those are being fixed and 2.1.1 should help much.

For now, you can drop org.restlet.ext.net.jar (or
org.restlet.ext.httpclient.jar and dependencies) in your classpath to a more
stable one.

Let me know if this helps!
Jerome


-----Message d'origine-----
De : Noam Krendel [mailto:nkren...@yahoo.com] 
Envoyé : lundi 15 octobre 2012 20:48
À : discuss@restlet.tigris.org
Objet : Restlet client hanging when connecting to Restlet server (SunOS)

I am using Restlet 2.1.0 with the xstream and jettison extensions.  In my
JUnit test I create a simple server:


    @BeforeClass
    public static void setUpBeforeClass() throws Exception {
      server = new Server(Protocol.HTTP, SERVER_PORT,
TestServerResource.class);
      Context ctx = new Context();
      server.setContext(ctx);
      server.start();
    }

And I'm testing it with a simple client call:

    ClientResource cr = new ClientResource(URL);
    Representation r = cr.get();
    System.out.println(r.getText());

My resource is declared:

  public class TestServerResource extends ServerResource {

    private static volatile Customer bernard = Customer.createSample();

    @Get("json")
    public Customer retrieve() {
      System.out.println("GET request received");
      return bernard;
    }
  }

This all seems to work perfectly well in my development environment (Mac OS
X), but on a SunOS box the client just hangs.  There are no exceptions on
the client or server.

I tried different approaches to making the client call including using
Request and Client:

    Request request = new Request(Method.GET,
"http://localhost:8188/retrieve";);
    Client client = new Client(Protocol.HTTP);
    Response response = client.handle(request);
    response.getEntity().write(System.out);

But that doesn't seem to help.
Looking at the thread dump with jstack I see this:


"main" prio=3 tid=0x08070800 nid=0x2 waiting on condition [0xfe0eb000]
   java.lang.Thread.State: WAITING (parking)
        at sun.misc.Unsafe.park(Native Method)
        - parking to wait for  <0xbbe827e8> (a
java.util.concurrent.CountDownLatch$Sync)
        at java.util.concurrent.locks.LockSupport.park(LockSupport.java:156)
        at
java.util.concurrent.locks.AbstractQueuedSynchronizer.parkAndCheckInterrupt(
AbstractQueuedSynchronizer.java:811)
        at
java.util.concurrent.locks.AbstractQueuedSynchronizer.doAcquireSharedInterru
ptibly(AbstractQueuedSynchronizer.java:969)
        at
java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireSharedInterrupt
ibly(AbstractQueuedSynchronizer.java:1281)
        at
java.util.concurrent.CountDownLatch.await(CountDownLatch.java:207)
        at
org.restlet.engine.connector.ClientConnectionHelper.handle(ClientConnectionH
elper.java:517)
        at org.restlet.Client.handle(Client.java:180)
        at org.restlet.Restlet.handle(Restlet.java:284)
        at com.redprairie.task.common.TempClient.main(TempClient.java:17)


Any ideas what's going on?  Is there perhaps a known problem on SunOS?

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

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

Reply via email to