PortableRemoteObject problem with JDK 1.3 and weblogic
"pkc1998" <[email protected]> Sat, 06 Apr 2002 15:26:20 -0000
| Newsgroups | gmane.comp.java.ejb.general |
|---|---|
| Message-ID | <[email protected]> |
I am getting a ClassCastException when I try to cast a weblogic container-managed entity bean's findAll() return type (Enumeration) via PortableRemoteObject.narrow(), Enumeration e = (Enumeration) PortableRemoteObject.narrow (home.findAll(), A.class) where home is the home interface for class A, i. e., AHome home = (AHome) PortableRemoteObject.narrow ... //Note this line runs fine. The stack traces shows that javax.rmi.PortableObject.narrow is calling com.sun.corba.se.internal.javax.rmi.PortableRemoteObject.narrow which throws the ClassCastException. The same code used to work with weblogic 5.1 and HP's JDK 1.2. I got this exception when we compiled the code under 1.2 and run it under JDK 1.3 with same weblogic. (I personnally do not like the idea of compiling and running on different JDKs, but that is someone else's "great" idea and I have no control over it) After looking into the contents of Jar files, I think here is what is happening. Since JDK 1.2 does not include javax.rmi and weblogic does come with its own javax.rmi, I think we must have been using weblogic's implementation of javax.rmi when we use JDK 1.2. Now that we have switched to JDK1.3 which comes with its own javax.rmi, JVM must be using JDK 1.3's javax.rmi and that is why you see the trace with SUN's internal implementation throwing out exceptions. So the issue appears to be that we have two different and incompatible javax.rmi implementation, one from SUN and one from weblogic. Here are my questions: 1. Is it legal to do a narrow from Enumeration type ? If yes, then is this a bug in JDK1.3 ? 2. I think I can get around this problem by narrowing one enumeration element at a time, but I prefer not to do that. The other approach is to somehow tell JVM to use weblogic's javax.rmi.PortableRemoteObject implementation via system properties (- D flag). However, I can not find any weblogic system properties to do that. Does anyone know how to do this ? If I can not do this, I think my last resort is to use - Xbootclasspath to tell JVM to load weblogic's classes before JDK's classes. I would appreciate any comments/suggestions on my problem. Thanks. Peter