I have created a ear file that has many wars within it and a jar file containing the ejb classes.Now i want to access the ejb's present in tht jar from one of my wars.What all am i suppose to do to make this happen
Hi shawn, It is very simple,Let me tell you step by step:
1. In you JAR file please make it sure that you have given EJB REF i.e. nick name to your EJB. Reason is it is not good to lookup any component by its actual JNDI name beacuse if you do that than your code is tightel coupled with JNDI name,which is wrong. 2. Mentioned those EJB REF in your web.xml file using <ejb-ref> or similar tag (please look on the web ). 3.Now in your servlet class simply do the lookup,rest of all will be taken care by the container itself. but make it sure that while you do lookup you are using the same ref-name which you have given in web.xml file.