Shubhrajit Chatterjee wrote:Solved it at last ... there was nothing wrong with the client ... I was foolish to think that no configuration at the server end ....
I re-compiled my ejb with the follwing command ...
java weblogic.ejbc -compiler javac -keepgenerated -idl -idlDirectory idlSources -iiop ejb_far2cent.jar ejb_iiop_far2cent.jar
And then redeployed it .. now everything is working fine ....
It's worth looking at the client.jar that ejbc has generated. Now it contains the stub classes also .. along with home and remote
[ July 26, 2002: Message edited by: Shubhrajit Chatterjee ]
Hi Shubhrajit,
I am facing same problem. I didn't get your above solution.
My ejb is deployed on weblogic and my client requirement is JDK 1.4 so I can't use wlfullclinet or wlcinet.jar
May I know how can I lookup ejb. What changes I need in ejb and client side
My classes
EJB server
/**
* 11.06.2012.
* Session Bean implementation class CMSyncBean
* @author pharapra
*
*/
@Stateless
//(name = "CRMSyncBean", mappedName = "CRMSyncRemote")
@Remote(CRMSyncRemote.class)
@RemoteHome(CRMSyncHome.class)
public class CRMSyncBean {
public CRMSyncUserVO createWebIssuer(final CRMSyncOrganisationVO orgVO) throws BusinessException, SystemException {
}
}
//Home
public interface CRMSyncHome extends EJBHome
{
CRMSyncRemote create() throws javax.ejb.CreateException, RemoteException;
}
----------------------------------------------------------------------------------------------------------
Client
//Remote
public interface CRMSyncRemote extends EJBObject {
CRMSyncUserVO createWebIssuer(CRMSyncOrganisationVO orgVO) throws RemoteException, BusinessException, SystemException;
}
Lookup code
public static void main(String[] args) throws NamingException, RemoteException, CreateException {
Context ctx = null;
Hashtable<String, String> ht = new Hashtable<String, String>();
CRMSyncRemote remote = null;
//ht.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");
ht.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.cosnaming.CNCtxFactory");
//ht.put(Context.PROVIDER_URL, "t3://localhost:7001");
ht.put(Context.PROVIDER_URL, "iiop://localhost:7001");
ctx = new InitialContext(ht);
final Object objref = ctx.lookup("CRMSyncCRMSync-EJB-0_0_1-SNAPSHOT_jarCRMSyncBean_EO");
System.out.println(objref);
final CRMSyncHome home = (CRMSyncHome)PortableRemoteObject.narrow(objref, CRMSyncHome.class);
System.out.println("Got CRMSyncHome: " + home + " for " + home);
home.create();
//println("Got the MEJB");
}
Exception is
IOR:000000000000003f524d493a636f6d2e746965746f2e766e2e63726d73796e632e72656d6f74652e43524d53796e6352656d6f74653a30303030303030303030303030303030000000000001000000000000023c000102000000000a3132372e302e302e31001b59000000d800424541080103000000000f6578616d706c65735365727665720000000000000000003f524d493a636f6d2e746965746f2e766e2e63726d73796e632e72656d6f74652e43524d53796e6352656d6f74653a3030303030303030303030303030303000000000000433313700000000024245412a0000001000000000000000006e11836aa3e197274245410b00000048000000000000004001003d636f6d2e746965746f2e766e2e63726d73796e632e72656d6f74652e43524d53796e6352656d6f74653a6a617661782e656a622e454a424f626a65637400000005000000010000002c000000000001002000000003000100200001000105010001000101000000000300010100000101090501000100000019000000410000000000000039687474703a2f2f3132372e302e302e313a373030312f6265615f776c735f696e7465726e616c2f636c61737365732f43524d53796e63402f000000000000001f000000040000000300000020000000040000000100000021000000a80000000000000002000600000000002200000000004000000000000806066781020101010000001f0401000806066781020101010000000f7765626c6f67696344454641554c540000000000000000000000000000000000000000000000002200000000004000000000000806066781020101010000001f0401000806066781020101010000000f7765626c6f67696344454641554c540000000000000000000000000000000000
Exception in thread "main" java.lang.ClassCastException
at com.sun.corba.se.impl.javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:229)
at javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:137)
at TestClient.main(TestClient.java:32)
Caused by: java.lang.ClassCastException: Object is not of remote type com.tieto.vn.crmsync.ejb.CRMSyncHome
at com.sun.corba.se.impl.javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:221)
... 2 more
-------------------------------------------------------------------