Results 1 to 6 of 6

Thread: Java5 Enum and Hessian

  1. #1
    Join Date
    Sep 2006
    Location
    Los Angeles, CA
    Posts
    4

    Default Java5 Enum and Hessian

    I have the following enum and class defined (on both sides of my remote interface):

    ***
    Currency.java
    ***
    public enum Currency implements Serializable {
    US_DOLLAR,
    CANADIAN_DOLLAR
    }

    ***
    Money.java
    ***
    public class Money implements Serializable {
    private Currency currency;

    public Currency getCurrency() {
    return currency;
    }
    public void setCurrency(Currency currency) {
    this.currency = currency;
    }
    }



    When I call a remote method (Hessian), I get the following stacktrace:

    <Sep 25, 2006 1:47:58 PM PDT> <Error> <HTTP> <BEA-101017> <weblogic.servlet.internal.WebAppServletContext@13 83279 -
    appName: '_appsdir_subscription_war',
    name: 'subscription.war', context-path: '/subscription']
    Root cause of ServletException.
    java.io.IOException: java.lang.InstantiationException:
    subscription.common.Currency
    at com.caucho.hessian.io.JavaDeserializer.readMap
    (JavaDeserializer.java:119)
    at com.caucho.hessian.io.HessianInput.readObject
    (HessianInput.java:662)
    at com.caucho.hessian.io.JavaDeserializer.readMap
    (JavaDeserializer.java:135)
    at com.caucho.hessian.io.JavaDeserializer.readMap
    (JavaDeserializer.java:114)
    at com.caucho.hessian.io.HessianInput.readObject
    (HessianInput.java:662)


    I'm using Java5, weblogic 9.2 and spring 2.0-rc3. Anyone have an idea on why this is happening?

    -mike

  2. #2
    Join Date
    Sep 2006
    Location
    Los Angeles, CA
    Posts
    4

    Default Hessian Problem

    I was able to work around the problem by changing to use HttpInvoker instead of Hessian. It seems Hessian doesn't know how to work with Java 5 enums. I don't know if any of the other remoting services have the same problem, because HttpInvoker was going to be my second choice anyway.

  3. #3

    Default

    Not really an answer to your question, but you could also use
    Code:
    java.util.Currency
    for your Money pattern.

    -Patrick

  4. #4
    Join Date
    Sep 2006
    Location
    Los Angeles, CA
    Posts
    4

    Default Re: java.util.Currency

    Yeah, that was just the easiest example I could come up with. There are several other enums I could have used, I just wanted something that was simple to explain. Thanks.

  5. #5

    Default

    Hello,

    I don't know the version of Hessian in Spring2.0-rc3, in rc4 it is 3.0.20. The enums should be supported since Hessian 3.0.20...

    http://bugs.caucho.com/view.php?id=1209

    -Patrick

  6. #6
    Join Date
    Sep 2006
    Location
    Los Angeles, CA
    Posts
    4

    Default

    Good call pgras. Spring 2.0 was just released in final version yesterday, and it comes with Hessian 3.0.20, which solves the enum problem. Thanks for the heads up.

    -m

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •