Skip to main content

JSF2.0 -Cannot load ManagedBean in a jar when using @ManagedBean annotation

2 replies [Last post]
ericmacau
Offline
Joined: 2003-08-27
Points: 0

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?

Best regards,
Eric

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
userjava1
Offline
Joined: 2009-06-03
Points: 0
Jason Lee

On 6/8/10 2:44 AM, webtier@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

---------------------------------------------------------------------
To unsubscribe, e-mail: webtier-unsubscribe@glassfish.dev.java.net
For additional commands, e-mail: webtier-help@glassfish.dev.java.net