Greeting Ranchers, This is my first EJB application. I have to create a web client to the Advice EJB. The idea is to create a simple GetAdvice.jsp and a servlet. The servlet will lookup the advice bean and display the advice. To achieve this I created a j2ee project and added the Advice EJB. Now I created another dynamic web project with the servlet and jsp. In the deployment descriptor I added the ejb-ref name and type as the lookup name and jndi name respectively. In the service method I'm looking up the enterprise bean.
Context ic = new InitialContext(); Object o = ic.lookup("ejb/Advice"); Advice ad = (Advice) PortableRemoteObject.narrow(o,Advice.class);
I'm using WSAD 5.1. In this way will I be able to retreive the remote bean? [ February 28, 2007: Message edited by: Naveen Sharma ]
Okie, thanks... I'll try it and let you know. Btw I'm still very doubious about all this I mean, we are not making any declarative provisions at the client end expect for ebj-ref tag in the web.xml. Any client I create with the ejb package in the class path will be able to access the ejb? I read somewhere that some client.jar needs to be created. Not sure though
Any client I create with the ejb package in the class path will be able to access the ejb?
As long as the jndi name is known to the client, any client can always lookup the bean. If however you want to restrict access to some beans to some specific roles then you can do that by securing the EJB.