Pretty faces config issues on WebSphere Application server – JSF2

Splash Forums PrettyFaces Users Pretty faces config issues on WebSphere Application server – JSF2

This topic contains 3 replies, has 2 voices, and was last updated by  testtf2 4 years, 9 months ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #18664

    testtf2
    Member

    Getting the error “Error 500: com.ocpsoft.pretty.PrettyFilter incompatible with javax.servlet.Filter” while trying to launch my web application through WebSphere.

    Application uses

    • JSF2.1.2
    • Prettyfaces-jsf2-3.3.2
    • Primefaces 3.2
    • WebSphere Application Server 7.0.0.9

    Application shipped with servlet-api.jar version2.5 (WEB-INF/lib)

    Have changed the war class loader order to “parent last” and policy to “Single class loader for application” in WebSphere admin console to pick apps own JSF version.

    Tried but not luck on adding custom properties in WebSphere admin console for filter compatibility(Last in FAQ at http://ocpsoft.org/prettyfaces/)

    The same works in Tomcat 6.0.32 which uses servlet-api 2.5

    Below is webxml

    <context-param>

    <param-name>defaultHtmlEscape</param-name>

    <param-value>true</param-value>

    </context-param>

    <context-param>

    <param-name>com.sun.faces.numberOfViewsInSession</param-name>

    <param-value>3</param-value>

    </context-param>

    <context-param>

    <param-name>com.sun.faces.numberOfLogicalViews</param-name>

    <param-value>10</param-value>

    </context-param>

    <context-param>

    <param-name>contextConfigLocation</param-name>

    <param-value>classpath*:WEB-INF/Controller-servlet.xml</param-value>

    </context-param>

    <context-param>

    <param-name>com.sun.faces.expressionFactory</param-name>

    <param-value>com.sun.el.ExpressionFactoryImpl</param-value>

    </context-param>

    <context-param>

    <description>JSF Injection provider</description>

    <param-name>com.sun.faces.injectionProvider</param-name>

    <param-value>net.devgrok.jsf.Tomcat6GuiceInjectionProvider</param-value>

    </context-param>

    <context-param>

    <param-name>primefaces.THEME</param-name>

    <param-value>cupertino</param-value>

    </context-param>

    <context-param>

    <param-name>javax.faces.PARTIAL_STATE_SAVING</param-name>

    <param-value>false</param-value>

    </context-param>

    <context-param>

    <param-name>javax.faces.FULL_STATE_SAVING_VIEW_IDS</param-name>

    <param-value>abc.xhtml</param-value>

    </context-param>

    <!-- JSF Required Context Params END-->

    <!-- JSF Required Filters & Listeners START-->

    <filter>

    <filter-name>PrimeFaces FileUpload Filter</filter-name>

    <filter-class>org.primefaces.webapp.filter.FileUploadFilter</filter-class>

    <init-param>

    <param-name>thresholdSize</param-name>

    <param-value>1048576000</param-value><!--51200-->

    </init-param>

    <init-param>

    <param-name>uploadDirectory</param-name>

    <param-value>/temp</param-value>

    </init-param>

    </filter>

    <filter-mapping>

    <filter-name>PrimeFaces FileUpload Filter</filter-name>

    <servlet-name>Faces Servlet</servlet-name>

    </filter-mapping>

    <!-- Creates the Spring Container shared by all Servlets and Filters -->

    <listener>

    <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>

    </listener>

    <filter>

    <filter-name>Pretty Filter</filter-name>

    <filter-class>com.ocpsoft.pretty.PrettyFilter</filter-class>

    </filter>

    <filter-mapping>

    <filter-name>Pretty Filter</filter-name>

    <url-pattern>/*</url-pattern>

    <dispatcher>FORWARD</dispatcher>

    <dispatcher>REQUEST</dispatcher>

    </filter-mapping>

    <!-- JSF Required Filters & Listeners END-->

    <!-- JSF Required Servlets START -->

    <servlet>

    <servlet-name>Faces Servlet</servlet-name>

    <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>

    <load-on-startup>1</load-on-startup>

    </servlet>

    <servlet-mapping>

    <servlet-name>Faces Servlet</servlet-name>

    <url-pattern>*.jsf</url-pattern>

    </servlet-mapping>

    Any hints or help please! Thanks in advance!

    #22893

    testtf2
    Member

    1. Need to change the war class loader order to “parent last” and policy to “Single class loader for application” in WebSphere admin console to pick apps own JSF version.

    2. Remove the servlet-api.jar and xml-apis-1.0.b2.jar files from WEB-INF/Lib folder as it collides with server versions.

    The above steps solved my issues.

    Thanks

    #22894

    Hi, thanks for sharing you solution. You should never add the Servlet API to your /WEB-INF/lib folder because every servlet container will provide it’s own version. And having two versions on the classpath will lead to all sorts of problems.

    #22895

    testtf2
    Member

    You are right. Unlike WebSphere in my testing env and may be other servers, Tomcat (6.0.32) which is added in my work env don’t complain about this redundant servlet-api occurrence. May be because both my /WEB-INF/lib and tomcat lib having same version of servlet-api.

    I initially misinterpreted the error message that it might something related to pretty-faces configuration! But it is not.

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.

Comments are closed.