Glassfish v2 ships as being a full fledged Java EE 5 container with JSF 1.2 bundled. Your webapp is apparently a JSF 2.0 based one which has JSF 2.0 libraries in /WEB-INF/lib
. This will of course conflict with Glassfish's own JSF 1.2 librares with errors like this. Your specific error is caused by having <faces-config version="2.0">
which isn't supported by JSF 1.2.
Whilst backwards compatible with Java EE 5, JSF 2.0 is part of Java EE 6 and thus by default only bundled in Glassfish v3 and so on. That it works in Tomcat is obviously because Tomcat as being a barebones JSP/Servlet container doesn't ship with JSF bundled, but only with JSP/Servlet. So there would be no potential version conflicts with JSF in Tomcat.
You need to tell Glassfish that it should not use its own bundled JSF, but instead the webapp bundled JSF. You can do that by adding the following entries to <sub-web-app>
of /WEB-INF/sun-web.xml
file:
<class-loader delegate="false"/>
<property name="useBundledJsf" value="true"/>
If you don't have this file, you can find a sample at the bottom of this Glassfish v2.1.1 deployment guide:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sun-web-app PUBLIC '-//Sun Microsystems, Inc.//DTD
Application Server 9.0 Servlet 2.5//EN'
'http://www.sun.com/software/appserver/dtds/sun-web-app_2_5-0.dtd'>
<sun-web-app>
<!-- Your config here -->
</sun-web-app>