webtier@glassfish.java.net

Re: [webtier] JSF2.0 -Cannot load ManagedBean in a jar when using @ManagedBean annotation

From: Jason Lee <jason.d.lee_at_oracle.com>
Date: Tue, 08 Jun 2010 08:26:27 -0500

On 6/8/10 2:44 AM, webtier_at_javadesktop.org wrote:
> Hello,
>
> I tried to use @ManagedBean annotation in a bean class. If I put it in a jar and place the jar in WEB-INF/lib, it cannot be loaded.
>
> I tested the JSF2.0.2 (Mojarra-2.0.2) in Tomcat 6.0.26 with Java 6.
>
> But If I put my bean in WEB-INF/classes. It runs very well. How can I packed those managed beans in a jar and run well?
>
If you are packaging JSF artifacts in a jar, then you need to have
META-INF/faces-config.xml. The only thing required is the root
faces-config element (set to version 2.0, iirc). If that file is not
present, JSF will not scan classes in that archive for JSF artifacts.

-- 
Jason Lee
Senior Member of Technical Staff
GlassFish Administration Console
Oracle Corporation
Phone +1 405-216-3193
Blog http://blogs.steeplesoft.com