Posted By:
Bozidar_Dangubic
Posted On:
Tuesday, October 30, 2001 05:15 AM
you can access EJBs from any java client. Here is a code snippet. Properties object used to create InitialContext is proprietary to your app server so you will need to get the information on that and change it in the code. this code access stateless session EJB running on orion app server.
Properties prop = new Properties() ;
prop.put(javax.naming.Context.INITIAL_CONTEXT_FACTORY,
"com.evermind.server.rmi.RMIInitialContextFactory") ;
prop.put(javax.naming.Context.PROVIDER_URL,"ormi://localhost/app-name") ;
prop.put(javax.naming.Context.SECURITY_PRINCIPAL,"administrator") ;
prop.put(javax.naming.Context.SECURITY_CREDENTIALS,"123456789") ;
javax.naming.Context ctx = new javax.naming.InitialContext(prop) ;
// get the cache
Object ref = ctx.lookup("InquiryBean") ;
InquiryHome home = (InquiryHome) PortableRemoteObject.narrow(ref,InquiryHome.class) ;
InquiryRemote inq = home.create() ;
....
inq.executeBusinessMethod(....) ;
....