-
Sep 25th, 2006, 04:26 PM
#1
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
-
Oct 2nd, 2006, 12:56 PM
#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.
-
Oct 3rd, 2006, 01:49 AM
#3
Not really an answer to your question, but you could also use for your Money pattern.
-Patrick
-
Oct 3rd, 2006, 12:37 PM
#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.
-
Oct 4th, 2006, 01:23 AM
#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
-
Oct 4th, 2006, 07:04 PM
#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
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules