When you access a remote EJB from a client you usully need to provide some data so the client is actually able to locate the remote service, instantiate an appropriate context etc. InitialContext = new InitialContext(); is used when the defaults are fine for you (as when you are trying to connect to an EJB from the very same server from a JSP, for example).
So the initial code would usually look like... As per the Resin documentation and using Burlap (http://www.caucho.com/resin-3.0/ejb/burlap-client.xtp) Hashtable env = new Hashtable(); // set the environment properties env.put(Context.INITIAL_CONTEXT_FACTORY,"com.caucho.burlap.BurlapContextFactory"); env.put(Context.PROVIDER_URL, "http://host.com/burlap"); try { // create an initial context using the above environment properties Context context = new InitialContext(env); ... Using Hessian, the data would be something similar: (http://www.caucho.com/resin-3.0/ejb/hessian-client.xtp) I have not tested it using EJB3.X in Resin, but that's how it used to work in Resin in previous versions and other servers, as specified by J2EE. If after trying that you can't find the object (but the JNDIserver is found), I would recommend "browsing" the resulting JNDI tree to find where the objects are bound. Sometimes the name is not where we expect them to be ;). Suerte! D. Sergio Fernandez escribió: > Hi guys, any idea about this? > > TIA > > Sergio > > Sergio Fernandez escribió: >> Hi all, >> >> I've deployed an EJB in my resin server following the guide provided in >> the installation (resin 3.1.2)... it works fine trying to execute the >> EJB from the servlet deployed in the same machine... but I want to >> execute the EJB from a stand alone java client... and I cant... actually >> I cannot find how to configure my java client to find the initial context... >> >> the testing code I wrote is the following, but obviously is not complete. >> >> public static void main(String[] args) throws NamingException { >> >> InitialContext ctx = new InitialContext(); >> Object obj = >> ctx.lookup("java:net/universia/empleo/ejb/EmpleoRemotoBean"); >> EmpleoRemoto hello = >> (EmpleoRemoto)PortableRemoteObject.narrow(obj, EmpleoRemoto.class); >> Boolean result = hello.invalidaCacheMaestras(); >> System.out.println(result); >> } >> >> Any idea/documentation/tutorial about this?? >> >> Thanks a lot, >> >> Sergio >> >> >> _______________________________________________ >> resin-interest mailing list >> [email protected] >> http://maillist.caucho.com/mailman/listinfo/resin-interest >> > > > > _______________________________________________ > resin-interest mailing list > [email protected] > http://maillist.caucho.com/mailman/listinfo/resin-interest -- ------------------------------------------- Daniel Lopez Janariz ([EMAIL PROTECTED]) Web Services Centre for Information and Technology Balearic Islands University (SPAIN) ------------------------------------------- _______________________________________________ resin-interest mailing list [email protected] http://maillist.caucho.com/mailman/listinfo/resin-interest
