title: java.lang.ClassCastException: org.omg.stub.java.rmi._Remote_Stub cannot be cast to <Remote Business interface name>
body: <p>I am using WAS server and I have written a java client to call one EJB through business interface as follows:</p>
  
  <pre><code>Hashtable&lt;String, String&gt; envJNDIProperties = new Hashtable&lt;String, String&gt;();
                          envJNDIProperties.put("javax.naming.factory.initial", "com.ibm.websphere.naming.WsnInitialContextFactory");
                          envJNDIProperties.put("java.naming.provider.url", "iiop://indmtx981:24121");
                          envJNDIProperties.put("java.naming.security.principal", myTicket);
                          envJNDIProperties.put("java.naming.security.credentials", "NA");
                          envJNDIProperties.put("org.omg.CORBA.ORBClass", "com.ibm.CORBA.iiop.ORB");
  
                          InitialContext initialCtx = new InitialContext(envJNDIProperties);
  
                          Object ejbObject = null;
  
  /*
  * Giving me error in following line
  */                         
  SearchServicesRemoteBusiness remoteBusiness = (SearchServicesRemoteBusiness) initialCtx.lookup("amdocs-RM-Billing/CM-L1/SearchServicesBean!amdocs.csm3g.sessions.views.business.remote.SearchServicesRemoteBusiness");
  
                          System.out.println("Got referencve for: "+ ejbObject.getClass().getName());
  //                      SearchServicesRemoteBusiness remoteBusiness = (SearchServicesRemoteBusiness) PortableRemoteObject.narrow(ejbObject,amdocs.csm3g.sessions.views.business.remote.SearchServicesRemoteBusiness.class);
  
                          AccountIdInfo accountId = new AccountIdInfo();
  
                          remoteBusiness.searchAccountById(accountId);
  </code></pre>
  
  <h2>Error:</h2>
  
  <p>java.lang.ClassCastException: org.omg.stub.java.rmi._Remote_Stub cannot be cast to .SearchServicesRemoteBusiness
          at EJBStandaloneClient.main(EJBStandaloneClient.java:27)</p>
  
  <p>what i have tried: I use createEJBStubs.sh to create stub for this remote business interface and while running put this stub in client classpath, but error still exists.
  Any suggestion is welcome.</p>