2

I'm doing an upgrade from JBoss 6 to JBoss 8 (WildFly). The version of RichFaces 3.3.3 has stayed the same. Several places in the code call the RichText spacer, like this:

<rich:spacer height="15" width="5"/>

In web.xml, the servlet-mapping entries related to Faces looked like this:

<servlet-mapping>
    <servlet-name>Faces Servlet</servlet-name>
    <url-pattern>*.jsf</url-pattern>
</servlet-mapping>
<servlet-mapping>
    <servlet-name>Faces Servlet</servlet-name>
    <url-pattern>/faces/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
    <servlet-name>Faces Servlet</servlet-name>
    <url-pattern>*.faces</url-pattern>
</servlet-mapping>

When running JBoss 6, the spacer image had the following URL, which worked fine:

https://host.com/dc/a4j/g/3_3_3.Finalimages/spacer.gif

We start running into issues when we upgrade to JBoss 8. The URL suddenly looks like this, and returns a 404 Not Found when accessed:

https://host.com/dc/faces/a4j/g/3_3_3.Finalimages/spacer.gif

I tried removing all but the *.jsf servlet-mapping from web.xml, like the documentation specifies. This made the URL look like this:

https://host.com/dc/a4j/g/3_3_3.Finalimages/spacer.gif.jsf

The URL returns a 500 Internal Server Error when accessed:

ERROR [io.undertow.request] (default task-29) UT005023: Exception handling request to /dc/a4j/g/3_3_3.Finalimages/spacer.gif.jsf: javax.servlet.ServletException: org.ajax4jsf.resource.ResourceNotFoundException: Resource not registered : images/spacer.gif.jsf

The image is always available the original URL.

For reference, here is web.xml:

<?xml version="1.0" encoding="ISO-8859-1"?>
<web-app xmlns="http://java.sun.com/xml/ns/javaee"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
             version="3.0">

    <display-name>[clipped]</display-name>

    <context-param>
        <param-name>org.jboss.jbossfaces.JSF_CONFIG_NAME</param-name>
        <param-value>mojarra-1.2_15</param-value>
    </context-param>

    <context-param>
      <param-name>org.ajax4jsf.VIEW_HANDLERS</param-name>
      <param-value>com.sun.facelets.FaceletViewHandler</param-value>
    </context-param>

    <context-param>
      <param-name>org.ajax4jsf.COMPRESS_SCRIPT</param-name>
      <param-value>false</param-value>
    </context-param>

    <context-param>
        <param-name>org.jboss.seam.core.init.debug</param-name>
        <param-value>false</param-value>
    </context-param>

    <context-param>
        <description>Disable MyFacesExtensionsFilter check</description>
        <param-name>org.apache.myfaces.CHECK_EXTENSIONS_FILTER</param-name>
        <param-value>false</param-value>
    </context-param>

    <context-param>
        <param-name>org.apache.myfaces.COMPRESS_STATE_IN_SESSION</param-name>
        <param-value>false</param-value>
    </context-param>

    <context-param>
        <param-name>org.apache.myfaces.SERIALIZE_STATE_IN_SESSION</param-name>
        <param-value>false</param-value>
    </context-param>

    <context-param>
        <param-name>org.apache.myfaces.ALLOW_JAVASCRIPT</param-name>
        <param-value>true</param-value>
    </context-param>

    <context-param>
        <param-name>org.apache.myfaces.DETECT_JAVASCRIPT</param-name>
        <param-value>false</param-value>
    </context-param>

    <context-param>
        <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
        <param-value>.xhtml</param-value>
    </context-param>

    <context-param>
        <param-name>org.richfaces.LoadStyleStrategy</param-name>
        <param-value>NONE</param-value>
    </context-param>
    <context-param>
        <param-name>org.richfaces.LoadScriptStrategy</param-name>
        <param-value>NONE</param-value>
    </context-param>

    <context-param>
        <param-name>com.sun.faces.numberOfViewsInSession</param-name>
        <param-value>5</param-value>
    </context-param>

    <context-param>
        <param-name>com.sun.faces.numberOfLogicalViews</param-name>
        <param-value>5</param-value>
    </context-param>

    <servlet>
        <servlet-name>Seam Resource Servlet</servlet-name>
        <servlet-class>org.jboss.seam.servlet.SeamResourceServlet</servlet-class>
    </servlet>

    <servlet-mapping>
        <servlet-name>Seam Resource Servlet</servlet-name>
        <url-pattern>/seam/resource/*</url-pattern>
    </servlet-mapping>

    <filter>
        <filter-name>Seam Filter</filter-name>
        <filter-class>org.jboss.seam.servlet.SeamFilter</filter-class>
    </filter>

    <filter>
        <display-name>RichFaces Filter</display-name>
        <filter-name>richfaces</filter-name>
        <filter-class>org.ajax4jsf.Filter</filter-class>
    </filter>

    <filter-mapping>
        <filter-name>Seam Filter</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>

    <filter-mapping>
        <filter-name>richfaces</filter-name>
        <servlet-name>Faces Servlet</servlet-name>
        <dispatcher>REQUEST</dispatcher>
        <dispatcher>FORWARD</dispatcher>
        <dispatcher>INCLUDE</dispatcher>
    </filter-mapping>

    <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>

    <session-config>
        <session-timeout>45</session-timeout>
    </session-config>
</web-app>

I just assume bypass the issue and do away with the spacer, but the spacer is also called internally by RichFaces, within some of the components that we are currently using.

What should I do to get the spacer to show up correctly?

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
mattalxndr
  • 9,143
  • 8
  • 56
  • 87

1 Answers1

0

You should exclude second initialization of org.ajax4jsf.Filter in filter and filter-mapping sections of web.xml. Seam instantiate org.ajax4jsf.Filter from Ajax4jsfFilterInstantiator class.

Please remove following code from web.xml

<filter>
    <display-name>RichFaces Filter</display-name>
    <filter-name>richfaces</filter-name>
    <filter-class>org.ajax4jsf.Filter</filter-class>
</filter>
... 

<filter-mapping>
    <filter-name>richfaces</filter-name>
    <servlet-name>Faces Servlet</servlet-name>
    <dispatcher>REQUEST</dispatcher>
    <dispatcher>FORWARD</dispatcher>
    <dispatcher>INCLUDE</dispatcher>
</filter-mapping>

See related RichFaces Issue RF-3410

vim
  • 407
  • 4
  • 8