Hi,
I am a newbee to EJB programming and I am trying to develop my first ejb on WSAD5.0, I just programmed a session bean which returns a simple String through a getMessage method.
I am trying to lookup this EJB through a jsp page and I am getting a NameNotFoundException.
I searched several forums including this one and tried to implement according to the recommendations given here. But the problem still persists. My code goes as follows.
ejb-jar.xml (generated by WSAD)
-------------
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN" "http://java.sun.com/dtd/ejb-jar_2_0.dtd">
<ejb-jar id="ejb-jar_ID">
<display-name>rajEjb</display-name>
<enterprise-beans>
<session
id="FirstBean">
<ejb-name>FirstBean</ejb-name>
<local-home>raj.ejb.session.stateless.FirstLocalHome</local-home>
<local>raj.ejb.session.stateless.First</local>
<ejb-class>raj.ejb.session.stateless.FirstBean</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Container</transaction-type>
</session>
</enterprise-beans>
</ejb-jar>
ibm-ejb-bnd-jar.xmi(also generated by WSAD)
---------------------
<?xml version="1.0" encoding="UTF-8"?>
<ejbbnd:EJBJarBinding xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:ejbbnd="ejbbnd.xmi" xmlns:ejb="ejb.xmi" xmi:id="EJBJarBinding_1083440172703">
<ejbJar href=""/>
<ejbBindings
xmi:id="EnterpriseBeanBinding_1083440172703" jndiName="FirstStatelessBean">
<enterpriseBean xmi:type="ejb:Session" href=""/>
</ejbBindings>
</ejbbnd:EJBJarBinding>
index.jsp (where lookup is made)
-----------------------------------
<%! private Context ctx = null;
private FirstLocalHome localHome;
%>
<%
try{
ctx = new InitialContext();
localHome=(FirstLocalHome)ctx.lookup("java:comp/env/FirstStatelessBean");
}catch(NamingException eNE){
System.out.println("Naming Exception");
eNE.printStackTrace(); }
%>
and the following exception is thrown when JSP page is called.
O Naming Exception
[5/2/04 13:38:21:163 EDT] 42bb80ab SystemErr R javax.naming.NameNotFoundException: Name "comp/env/FirstStatelessBean" not found in context "java:".
[5/2/04 13:38:21:163 EDT] 42bb80ab SystemErr R at
com.ibm.ws.naming.ipbase.NameSpace.lookup(NameSpace.java:1003)
[5/2/04 13:38:21:163 EDT] 42bb80ab SystemErr R at com.ibm.ws.naming.urlbase.UrlContext.lookup(UrlContext.java:1211)
[5/2/04 13:38:21:163 EDT] 42bb80ab SystemErr R at com.ibm.ws.naming.urlbase.UrlContext.lookup(UrlContext.java:1203)
[5/2/04 13:38:21:163 EDT] 42bb80ab SystemErr R ...................
Can anyone of you tell me how to lookup the EJB and solve my problem.
It would be a great help for me.
thanks in advance.
Raj.
Do you Yahoo!?
Win a $20,000 Career Makeover at Yahoo! HotJobs =========================================================================== To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message "signoff EJB-INTEREST". For general help, send email to [EMAIL PROTECTED] and include in the body of the message "help".
