Client doesn't work with Cayenne Web Service

From: tristan (tristancali..ahoo.com)
Date: Fri Jun 19 2009 - 06:11:18 EDT

  • Next message: Andrey Razumovsky: "Re: Client doesn't work with Cayenne Web Service"

    I've developed a small application with Apache Cayenne using Cayenne Web Service. The application was developed on Eclipse using the Jetty plugin. This was the only way to make it work, so I can start writing code. 
    The problem is when I try to deploy the application using a standalone Jetty server, the client java application throws an exception for this code (and any example from online documentation):  ClientConnection connection = new HessianConnection(
      "http://localhost:8080/reselleri/cayenne-service");
      DataChannel channel = new ClientChannel(connection);
      ObjectContext context = new CayenneContext(channel);

      SelectQuery select = new SelectQuery(Administrator.class);
      // this is where the exception is thrown !
      List rezultat = context.performQuery(select);

    If I run the server web service inside Eclipse Jetty Plugin, it works perfectly:

    INFO QueryLogger: Detected and installed adapter: org.apache.cayenne.dba.derby.DerbyAdapter
    INFO QueryLogger: SELECT t0.denumire, t0.parola, t0.username, t0.id FROM ADMINISTRATOR t0 - prepared in 47 ms.
    INFO QueryLogger: === returned 2 rows. - took 1344 ms.

    If I run the service with standalone Jetty or Tomcat (I've tried many versions, even for Cayenne+dependencies, it' the same) the client won't work, as you can see in the exception output below. I can mention that while running Tomcat/Jetty, I don't have problems running servlets using Cayenne on server side. Only the client has problems. It seems that for some reason, the cayenne web service+client works only with Jetty plugin. What can I do ?

    Thank you very much for your attention.

    TristanBelow is the stdout from client, the connection is fine, but I can't perform queries.19.06.2009 12:21:08 org.apache.cayenne.remote.hessian.HessianConnection connect
    INFO: Connecting to [http://localhost:8080/reselleri/cayenne-service] - dedicated session.
    19.06.2009 12:21:09 org.apache.cayenne.remote.hessian.HessianConnection connect
    INFO: === Connected, session: org.apache.cayenne.remote.RemoteSession@1de3f2d[sessionId=863r7x7r6ilu] - took 1125 ms.
    19.06.2009 12:21:09 org.apache.cayenne.remote.BaseConnection sendMessage
    INFO: --- Message 0: Bootstrap
    19.06.2009 12:21:09 org.apache.cayenne.remote.BaseConnection sendMessage
    INFO: === Message 0: Bootstrap done - took 391 ms.
    19.06.2009 12:21:09 org.apache.cayenne.remote.BaseConnection sendMessage
    INFO: --- Message 1: Query
    com.caucho.hessian.io.HessianProtocolException: 
      at com.caucho.hessian.client.HessianProxy.invoke(HessianProxy.java)
      at $Proxy0.processMessage(Unknown Source)
      at org.apache.cayenne.remote.hessian.HessianConnection.doSendMessage(HessianConnection.java:140)
      at org.apache.cayenne.remote.BaseConnection.sendMessage(BaseConnection.java:73)
      at org.apache.cayenne.remote.ClientChannel.send(ClientChannel.java:242)
      at org.apache.cayenne.remote.ClientChannel.onQuery(ClientChannel.java:88)
      at org.apache.cayenne.util.ObjectContextQueryAction.runQuery(ObjectContextQueryAction.java:217)
      at org.apache.cayenne.CayenneContextQueryAction.execute(CayenneContextQueryAction.java:47)
      at org.apache.cayenne.CayenneContext.onQuery(CayenneContext.java:290)
      at org.apache.cayenne.CayenneContext.performQuery(CayenneContext.java:279)
      at com.distributie.client.FormPrincipal.Connect(FormPrincipal.java:170)
      at com.distributie.client.FormPrincipal.<init>(FormPrincipal.java:145)
    ----------skipped lines ------------



    This archive was generated by hypermail 2.0.0 : Fri Jun 19 2009 - 06:15:02 EDT