Just for grins I am trying to call an
EJB's business method from within a
Tomcat web application. I have tried to call a simple EJB, the AdviceBean from the AdviceApp (first tutorial of "Head First EJB"), using the same code from the AdviceApp client, from within the
servlet's doPost() method. I am getting a NameNotFoundException, complaining that the "Name Advisor is not bound in this Context". The J2EE RI server is running, the EJB is deployed, and the client jar file with all of the EJB classes and interfaces (created by RI container at deploy time) is included in the WEB-INF/lib directory of the webapp.
The servlet code is below, maybe someone can see what it is I'm doing wrong or leaving out. Basically the servlet's job is to fill a JavaBean with the advice
string from the EJB's getAdvice() method, then add the bean to the session, to be displayed on a following
JSP using a <jsp:getProperty> tag. Also included after the servlet code is the Tomcat web application's web.xml, which has an <ejb-ref> for the bean, but this doesn't seem to be enough to get my EJB bound into the context (I guessed at what the correct <ejb-ref> element values should be).
Any comments or suggestions will be quite appreciated.
And the XML:
[ December 07, 2003: Message edited by: Michael Ernest ]