Question

I am using Prime faces in my application. I have specification to migrate Tomcat server(6) to Glass fish(v2.1) I have done it in net beans.

But I am getting HTTP Status 503 Error while running project. (Working fine while using tomcat 6)

Getting This in console

Initializing Mojarra (1.2_13-b01-FCS) for context '/Prime'
WebModule[/Prime]PWC1275: Exception sending context initialized event to listener
instance of class com.sun.faces.config.ConfigureListener

Caused by: org.xml.sax.SAXParseException: cvc-enumeration-valid: Value '2.0' is not
facet-valid with respect to enumeration '[1.2]'. It must be a value from the enumeration.

Why i am getting this error and please give me a solution for this.

Thank You.

Was it helpful?

Solution

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>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top