users@glassfish.java.net

Re: JSF 2.0.1 does NOT work in both Tomcat and GlassFishv3 (fails in GlassFish)

From: Ryan Lubke <Ryan.Lubke_at_Sun.COM>
Date: Fri, 06 Nov 2009 08:58:25 -0800

Sorry for the delayed response. Please see inline...

On 11/4/09 10:10 AM, glassfish_at_javadesktop.org wrote:
> We have a Maven war project that includes the 2.0.1-b02 impl/api jars into our war file.... we deploy our war to both Tomcat and GlassFish (we are evaluating moving to GlassFish v3 Preview). I added the following to my sun-web.xml file (to have GlassFish use the version of JSF I have in my war file):
>
> class-loader delegate="false"
> property name="useBundledJsf" value="true"
>
> but, when I do this, I get the following error when I deploy my simple war file:
>
> java.lang.Exception: java.lang.NoSuchMethodError: javax.servlet.ServletContext.getServletRegistrations()Ljava/util/Map;
>

I believe the problem is due to the fact that V3 Preview is using an
outdated version of the Servlet 3.0 API.
Mojarra 2.0.x includes a ServletContainerInitializer that using
programmatic Servlet registration in order to add default mappings
of the FacesServlet *if* we're unable to determine if the FacesServlet
has already been mapped.

It works in Tomcat 6.0.x because that's a Servlet 2.5 container and as
such, the ServletContainerInitializer is ignored.

For now, if you want to use JSF 2.0 with V3, it will have to be with a
promoted build.

Going forward for Mojarra 2.0.x, we'll be packaging the
ServletContainerInitializer within an optional jar instead of the
main implementation jar.
> I know I don't need 2.0.1 for GlassFish v3 Preview, but I'm trying to use the SAME war file that I use in Tomcat as I use in Glassfish. Attached is the simple Maven JSF2.0.1 HelloWorld project that shows this problem.
>
> Am I doing something wrong?
>
> Notes:
> - We are using a unmodified version of Tomcat 6.0.
> - I'm using bundled version of servlet-api.jar file that comes with the app server (Tomcat version: 2.5 Glassfish: 3.0-Preview).
> - If I include the servlet-api-2.5.jar in my war I STILL get the same results.
>
> Thanks,
> Jeff
> [Message sent by forum member 'jeffcampbell' (jeffcampbell_at_idea1.com)]
>
> http://forums.java.net/jive/thread.jspa?messageID=370522
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>
>