No matter where you put your Helper class, whether it is in the web, ejb-jar, ear module or even in the System classloader, the last container managed class in your application is the JSF bean (or the JSF servlet), so from the Java EE container's point of view the lookup is done in the Web application.
If you don't want to know what is going on under the hood, don't read the following:
The container reads the deployment descriptors at application startup time and links the deployment descriptor settings to the container managed object (EJB, Servlet, etc.). Each time a method on a Local or Remote interface is called the container adds that container managed object's name to a stack stored in a threadlocal variable attached to that thread. Then it proceeds with calling the business method.
When you do a JNDI lookup call in your class the container checks the stack stored with the current thread to look for the name of the current running container managed object, and uses it to check that object's deployment descriptor definitions (here, ejb-ref/ejb-local-ref the Java EE descriptor, and ejb-ref in sun-XXX.xml) so figure out the actual JNDI name of the bean on the server that you want to look up.
#I simplified a few things in this explanation, but basically that's how it works.
So when your WelcomeJSFBean calls the Helper class stored in the ejb-jar, the last object in the stack of the threadlocal points to WelcomeJSFBean, so that's where it looks for the ejb-local-jar definitions.
So [b]please[/b] copy those definitions to your web.xml, remove the sun-ejb-jar.xml from your ejb-jar (leave the other deployment descriptors in) and run it so we can move on.
[i](...)
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
<ejb-ref>
<ejb-ref-name>DddEJBRemoteHome</ejb-ref-name>
<ejb-ref-type>Session</ejb-ref-type>
<home>ddd.ejb.DddEJBRemoteHome</home>
<remote>ddd.ejb.DddEJBRemote</remote>
<ejb-link>dddEAR-ejb.jar#DddEJBBean</ejb-link>
</ejb-ref>
<ejb-local-ref>
<ejb-ref-name>DddEJBLocalHome</ejb-ref-name>
<ejb-ref-type>Session</ejb-ref-type>
<local-home>ddd.ejb.DddEJBLocalHome</local-home>
<local>ddd.ejb.DddEJBLocal</local>
<ejb-link>dddEAR-ejb.jar#DddEJBBean</ejb-link>
</ejb-local-ref>
</web-app>[/i]
[Message sent by forum member 'dkoper' (dkoper)]
http://forums.java.net/jive/thread.jspa?messageID=253577