Hi All,
I'm Using Websphere Application Server 3.5.4. I'm able to succeessfully deploy an
EJB, but when I run the following client code It gives me "ClassCastException"
-------------------------------------------------------
InitialContext ivjInitContext = null;
bgc.ipt.ejb.IPTLeasedLinePriceEstimatorHome beanHome = null;
bgc.ipt.ejb.IPTLeasedLinePriceEstimator remote = null;
// Get the initial context
try {
Properties properties = new Properties();
// Get location of name service
properties.put(javax.naming.Context.PROVIDER_URL,
"iiop://bharani_kumar:900/");
// Get name of initial context factory
properties.put(javax.naming.Context.INITIAL_CONTEXT_FACTORY, "com.ibm.ejs.ns.jndi.CNInitialContextFactory");
ivjInitContext = new InitialContext(properties);
Object homeObject = null;
homeObject = ivjInitContext.lookup("bharani");
//System.out.println(ivjInitContext.lookup("bharani").getClass().getName());
beanHome = (bgc.ipt.ejb.IPTLeasedLinePriceEstimatorHome) javax.rmi.PortableRemoteObject.narrow(homeObject,
bgc.ipt.ejb.IPTLeasedLinePriceEstimatorHome.class);
} catch (Exception e) { // Error getting the initial context
System.out.println("Error: "+e);
e.printStackTrace();
}
----------------------------------------------------------------
The following is the exception I get
Error : java.lang.ClassCastException
java.lang.ClassCastException
at com.ibm.ejs.ns.jndi.CNContextImpl.isContextLocalCheck(CNContextImpl.java:1340)
at com.ibm.ejs.ns.jndi.CNContextImpl.doLookup(CNContextImpl.java:764)
at com.ibm.ejs.ns.jndi.CNContextImpl.lookup(CNContextImpl.java:590)
at javax.naming.InitialContext.lookup(InitialContext.java:349)
at EJBClient.main(EJBClient.java:30)
Interactive Session Ended
I have tried setting the classpath Deployed EJB jar file as someone mentioned before. But The problem still exists.
Please Help Me!!!
Thanking you in anticipation,
- Bharani