EJB injection failed on glassfish with myfaces

I got nullpointers for all EJB injected dao’s :o. In fact a colleague of me already blogged the solution. It’s a small world after all :D.

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):
view plainprint?

1. <!--  
4. org.apache.myfaces.webapp.StartupServletContextListener
7. -->

Leave a Reply

Your email address will not be published. Required fields are marked *

Please reload

Please Wait