Have read about everything I can find on jndi and tomcat and JBoss3 but I still can't get my jndi lookup working in my jsp (times out doing lookup). Does anyone have a simple example of a jsp calling an ejb? I'd really like to see where all the config files go (ejb-jar, web.xml, jboss-web.xml, jndi.properties) and their proper syntax as I've been stuck on this for two days.
--- MyJSP
out.println("Person List");
Context jndiContext = new InitialContext();
Object ref = jndiContext.lookup("AcademyPersonService");
AcademyPersonServiceHome servicehome = (AcademyPersonServiceHome)
PortableRemoteObject.narrow(ref, AcademyPersonServiceHome.class);
AcademyPersonService service = servicehome.create();
String xmlOutput = service.GetHelloMessage();
------ web.xml
<web-app>
<session-config>
<session-timeout>30</session-timeout>
</session-config>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
<ejb-ref>
<ejb-ref-name>AcademyPersonService</ejb-ref-name>
<ejb-ref-type>Session</ejb-ref-type>
AcademyPersonServiceHome
AcademyPersonService
</ejb-ref>
</web-app>
----- jndi.properties
java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
java.naming.provider.url=localhost
---- ejb-jar extract
<ejb-name>AcademyPersonService</ejb-name>
net.codezilla.academy.ejb.personservice.AcademyPersonServiceHome
net.codezilla.academy.ejb.personservice.AcademyPersonService
<ejb-class>net.codezilla.academy.ejb.personservice.AcademyPersonServiceEJB</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Container</transaction-type>
</enterprise-beans>