logo       

Re: Encountered an IOExceptionWrapper: java.lang.UnsupportedOperationExcept: msg#00019

Subject: Re: Encountered an IOExceptionWrapper: java.lang.UnsupportedOperationException
Hi. Thank you for replying.

The error happens when an exception is thrown by the service. From what I can understand, the Hessian parser failed to recreate the exception thrown by the service (for my test it was a NullPointerException). This, however, does not happen when I use HessianProxyFactory to connect to the service. Unfortunately, I cannot use this method because it cannot handle Authentication and Proxy. Therefore I was forced to recreate how Hessian converts the request and sends it using the HttpClient of Apache. Below is my code for doing that. Can you point out to me where I could have made a mistake?

START OF CODE

  public Object connect(String id, String pwd, String method, Object[] param)
  throws Exception {
// Create an httpClient instance
    HttpClient httpClient = new HttpClient();
    URL url = "" URL(address);
    httpClient.getParams().setCookiePolicy(CookiePolicy.IGNORE_COOKIES);
// Set username and password
    httpClient.getState().setCredentials(
      new AuthScope(url.getHost(), url.getPort(), null),
      new UsernamePasswordCredentials(id, pwd)
    );
// Transform request to Hessian binary
    ByteArrayOutputStream out = new ByteArrayOutputStream();
    try {
      Hessian2Output output = new Hessian2Output(out);
      output.startCall(method);
      for (int i = 0; param != null && i < param.length; i++) {
        output.writeObject(param[i]);
      }
      output.completeCall();
      output.flush();
    } finally {
      out.close ();
    }
// Insert binary stream to connection
    PostMethod httpMethod = new PostMethod(url.toString ());
    httpMethod.setDoAuthentication(true);
    ((PostMethod) httpMethod).setRequestEntity(
      new ByteArrayRequestEntity(out.toByteArray())
    );
    try {
// Call service
      int status = httpClient.executeMethod(httpMethod);
      if (status == 200) {
// Read reply
        Hessian2Input input =
          new Hessian2Input(httpMethod.getResponseBodyAsStream());
        input.startReply(); // Error occurs here
        Object obj = input.getReplyFault();
        if (obj == null) {
          obj = input.readObject();
        }
        input.completeReply ();
        if (obj instanceof Throwable) {
          throw (Throwable) obj;
        } else {
          return obj;
        }
      } else {
        System.out.println(httpMethod.getResponseBodyAsString());
      }
    } catch (Throwable e) {
      throw new Exception(e);
    } finally {
      System.out.println("status: " + httpMethod.getStatusLine());
      httpMethod.releaseConnection();
    }
    return null;
  }

END OF CODE


Once again, thank you.
- ian

On 6/27/07, Ben Hood <0x6e6562-Re5JQEeQqe8AvxtiuMwx3w@xxxxxxxxxxxxxxxx> wrote:
On 6/20/07, ian tabangay <itabangay-Re5JQEeQqe8AvxtiuMwx3w@xxxxxxxxxxxxxxxx> wrote:
> Hi. Has anyone encountered this kind of exception when using the hessian
> 3.1.1? im getting this exception when the server encountered an exception
> when executing the service. Can anyone give suggestions how i can go around
> this problem? Thanks.

Could you give us a brief version of the code that causes this problem?

_______________________________________________
hessian-interest mailing list
hessian-interest-p4ZHcaHNc0TQT0dZR+AlfA@xxxxxxxxxxxxxxxx
http://maillist.caucho.com/mailman/listinfo/hessian-interest
Ruby Jobs
Java Jobs
Jobs in California
more...
what
job title, keywords
where
city, state, zip
jobs by job search
<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Recently Viewed:
linux.drivers.b...    security.firewa...    mathematics.lps...    web.zope.plone....    x25/2005-12/msg...    culture.tv.sout...    pld.user.polish...    qplus.devel/200...    version-control...    openbsd.bugs/20...    distributions.g...    gnu.chess.bugs/...    redhat.release....    emacs.bugs/2002...    java.bio.genera...    ataraid/2005-01...    finance.moneyda...    hardware.microc...    netbsd.ports.xe...    bug-tracking.gn...    text.xml.saxon....    kde.linux/2002-...   
Home | blog view | USPTO Patent Archive | advertise | OSDir is an inevitable website. super tiny logo