@EJB injection in JSF managed beans on glassfish with myfaces

I was trying to get @EJB dependency to work on my JSF managed beans. MyFaces Tomahawk on a Glassfish v2 app server. I kept getting NullPointerExceptions because the injection didn't happen...

Turns out it was failing to inject the ejb implementations because my webapp was trying to use the MyFaces jsf implementation next to the sun RI implementation shipped with Glassfish.

So, make sure not both the RI implementation (provided by glassfish), and myFaces implementation are active!

I prevented the myFaces implementation from loading by commenting the StartupServletContextListener in WEB-INF/web.xml (2.5 headers):


No comments:

Post a Comment