Websphere 3.5 + Ejb + Client Application = ClassCastException


EJB programming & troubleshooting: Websphere 3.5 + Ejb + Client Application = ClassCastException

  1. 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:
    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();
                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) {
                return null;

    Can any one help...!!!!

    Threaded Messages (4)

  2. IBM JDK needed[ Go to top ]

    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.

  3. IBM JDK needed[ Go to top ]

    Why, although the code compiles without error.
  4. IBM JDK needed[ Go to top ]

    The ORB is different. The WAS runtime needs the IBM ORB.
  5. IBM JDK needed[ Go to top ]

    Thanks a lot, i did it....
    lots of thanks...