webtier@glassfish.java.net

Re: Unable to get it work with Maven and embedded Jetty

From: <webtier_at_javadesktop.org>
Date: Wed, 23 Dec 2009 22:27:30 PST

The problem is that Mojarra (JSF 2 RI) scans three places for classes annotated with @ManagedBean:

1. WEB-INF/classes
2. JARS in WEB-INF/lib
3. classpath with META-INF/faces-config.xml

Since Jetty reads the class files from target/classes in embedded mode, JSF 2 doesn't know to scan them there (unless META-INF/faces-config.xml is present). Basically, instead of just scanning all classpath entries, Mojarra is very specific.

If you really want to get productive with JSF 2 right out of the box w/ embedded Jetty, I recommend looking into the weld-jsf-servlet-minimal artifact, which prepares a JSF 2.0 and CDI 1.0 application for you.

http://tinyurl.com/weld-archetypes

If you use @Named classes (from CDI) rather than @ManagedBean (from JSF 2), a substitue I recommend anyway, then you can get the productive you want.

Btw, here is the workaround with Mojarra with regard to the scanning: https://javaserverfaces.dev.java.net/issues/show_bug.cgi?id=1111 If you put faces-config.xml in src/main/resources/META-INF, then it will find the classes you want.
[Message sent by forum member 'mojavelinux' (dan.allen_at_mojavelinux.com)]

http://forums.java.net/jive/thread.jspa?messageID=377293