I am working in VisualAge for java. I am getting
ClassCastException in the following line of code. The getTypesHome() is a method to lookup the Types' HomeInterface, so I can call its method, FindAll(), where FindAll () returns an Enumeration of "Types". I would appreciated it if you have any suggestion in this matter. Thank you in advance.
Enumeration types = getTypesHome().findAll();
while (types.hasMoreElements()) {
out.println("Types : " + ((Types)types.nextElement()).getName () + "<br>");
}
Janice
-
ClassCastException (3 messages)
- Posted by: Janice Wong
- Posted on: September 24 2000 22:56 EDT
Threaded Messages (3)
- ClassCastException by Taras Zhugayevich on September 25 2000 09:53 EDT
- ClassCastException by Janice Wong on September 28 2000 18:57 EDT
- ClassCastException by Mayank Nain on September 26 2000 19:25 EDT
-
ClassCastException[ Go to top ]
- Posted by: Taras Zhugayevich
- Posted on: September 25 2000 09:53 EDT
- in response to Janice Wong
Hi,
I don't know which Application Server you are using, but if it implements EJB 1.1 then in order to cast remote objects you have to use PortableRemoteObject. Here example:
MyRemote myRemoteVar = (MyRemote) javax.rmi.PortableRemoteObject.narrow(enumeration.nextElement(), MyRemote.class);
Try this code, it has to work in EJB 1.1 environment.
Best regards,
Taras
-
ClassCastException[ Go to top ]
- Posted by: Janice Wong
- Posted on: September 28 2000 18:57 EDT
- in response to Taras Zhugayevich
Tara,
thank you for the solution. -
ClassCastException[ Go to top ]
- Posted by: Mayank Nain
- Posted on: September 26 2000 19:25 EDT
- in response to Janice Wong
Read the weblogic documentation for this. this is to do with improper loading of classes with weblogic and JVM classloader.
Mayank