Announcement Announcement Module
Collapse
No announcement yet.
Java5 Enum and Hessian Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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
    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.

    Comment


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

      -Patrick

      Comment


      • #4
        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.

        Comment


        • #5
          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

          Comment


          • #6
            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

            Comment

            Working...
            X