Websphere 3.5 + Ejb + Client Application = ClassCastException

Discussions

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:
    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

    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.

    Billy
  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...