Dear Professionals...
i created an EJB session bean and deployed it successfully to Websphere 3.5. I created a servlet to access the bean from within Websphere...it worked great. When i created a client application to access the bean, i got the following error:
java.lang.ClassCastException
at com.ibm.ejs.ns.jndi.CNContextImpl.isContextLocalCheck(CNContextImpl.java:1324)
The jar files in the classpath are
C:\VisualCafe\Java2\bin\java -cp Deployedroom.jar;ujc.jar;iioprt.jar;rmiorb.jar;jndi.jar;ejb.jar Client
The lookup file is
import javax.ejb.*;
import javax.naming.*;
import javax.naming.NamingException;
public class EJBLookup {
public static EJBHome lookup(String name, Class homeClass, String serverName) {
try {
java.util.Properties p = new java.util.Properties();
p.put(Context.INITIAL_CONTEXT_FACTORY,
"com.ibm.ejs.ns.jndi.CNInitialContextFactory");
if (serverName != null) {
String serverAddress =
(serverName.length() > 0) ? serverName : "localhost";
p.put(Context.PROVIDER_URL, "iiop://" + serverAddress + ":900"); //PENDING: Port 900 ??
}
InitialContext ic = new InitialContext(p);
javax.rmi.PortableRemoteObject.narrow(ic.lookup(name), homeClass);
Object o = javax.rmi.PortableRemoteObject.narrow(ic.lookup(name), homeClass);
return (EJBHome) o;
} catch (Throwable e) {
e.printStackTrace();
return null;
}
}
}
Can any one help...!!!!
thankx
Discussions
EJB programming & troubleshooting: Websphere 3.5 + Ejb + Client Application = ClassCastException
-
Websphere 3.5 + Ejb + Client Application = ClassCastException (4 messages)
- Posted by: mohamed sabry
- Posted on: April 24 2001 10:49 EDT
Threaded Messages (4)
- IBM JDK needed by Billy Newport on April 24 2001 23:13 EDT
- IBM JDK needed by mohamed sabry on April 26 2001 07:45 EDT
-
IBM JDK needed by Billy Newport on April 26 2001 04:29 EDT
- IBM JDK needed by mohamed sabry on April 29 2001 07:25 EDT
-
IBM JDK needed by Billy Newport on April 26 2001 04:29 EDT
- IBM JDK needed by mohamed sabry on April 26 2001 07:45 EDT
-
IBM JDK needed[ Go to top ]
- Posted by: Billy Newport
- Posted on: April 24 2001 23:13 EDT
- in response to mohamed sabry
It won't work without the IBM JDK. I noticed you are using the Cafe JDK. The jars that you need are the ujc and ejs and sslight also if you're using security.
Billy
-
IBM JDK needed[ Go to top ]
- Posted by: mohamed sabry
- Posted on: April 26 2001 07:45 EDT
- in response to Billy Newport
Why, although the code compiles without error. -
IBM JDK needed[ Go to top ]
- Posted by: Billy Newport
- Posted on: April 26 2001 16:29 EDT
- in response to mohamed sabry
The ORB is different. The WAS runtime needs the IBM ORB. -
IBM JDK needed[ Go to top ]
- Posted by: mohamed sabry
- Posted on: April 29 2001 07:25 EDT
- in response to Billy Newport
Thanks a lot, i did it....
lots of thanks...