Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

ClassCastException after RemoteCall  RSS feed

koshka Sagar
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I get a ClassCastException after remote call.
The business method takes a parameter and returns a Vector containing objects of a class. after the remote call when i print the size of the vector and use the getClass().getName() on the object retrieved from the vector it gives me the name of the class correctly. but if i try to typecast this class to the X class it give me a ClassCastException.
Summary :
1. The object returned after the remote call is a vector that
contains X class objects. X class implements Serializable
2. using the narrow() of PortableRemoteObject
3. Remote call is successful with no Remote Exceptions. Vector
that is returned after remote call has size greater than Zero.
4. Iterating thru the vector to retreive X class object and
casting it gives exception.
Code :
Context ctx = NameLookup.getInitialContext();
Object objref = ctx.lookup(JNDI_NAME);
HighlighterSessionHome home = (HighlighterSessionHome)
HighlighterSession highlighterEJB = home.create();
//vector of X class objects
Vector highlights = highlighterdEJB.getHighlights(employeeId);
for(int i = 0;i<highlights.size();i++)>
X high = (X)highlights.elementAt(i);
System.out.println("high.preText : " + high.preText);

* X class implements Serializable interface.
Main feature :
This code works fine on weblogic6.0 but is failing on websphere 4.0
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!