Richfaces 4.5 - wrong reference to spacer.gif
johannes2014 Feb 22, 2017 4:09 PMRichfaces 4.5.17.Final (after upgrading from 4.3.6.Final)
This error also shows up with 4.5.9.Final
After upgrading from 4.3.6.Final to Richfaces 4.5.17.Final I see the following Exception when I open I page including an rich:extendedDataTable:
13:50:08,594 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/myapp].[Faces Servlet]] (http-127.0.0.1:8080-1) JBWEB000236: Servlet.service() for servlet Faces Servlet threw exception: java.lang.UnsupportedOperationException
at org.richfaces.resource.URLResource.userAgentNeedsUpdate(URLResource.java:79) [richfaces-core-4.5.17.Final.jar:4.5.17.Final]
at com.sun.faces.application.resource.ResourceHandlerImpl.handleResourceRequest(ResourceHandlerImpl.java:255) [jsf-impl-2.1.28.SP10-redhat-1.jar:2.1.28.SP10-redhat-1]
at javax.faces.application.ResourceHandlerWrapper.handleResourceRequest(ResourceHandlerWrapper.java:125) [jboss-jsf-api_2.1_spec-2.1.28.SP2-redhat-1.jar:2.1.28.SP2-redhat-1]
at javax.faces.application.ResourceHandlerWrapper.handleResourceRequest(ResourceHandlerWrapper.java:125) [jboss-jsf-api_2.1_spec-2.1.28.SP2-redhat-1.jar:2.1.28.SP2-redhat-1]
at org.richfaces.resource.ResourceHandlerImpl.handleResourceRequest(ResourceHandlerImpl.java:219) [richfaces-core-4.5.17.Final.jar:4.5.17.Final]
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:591) [jboss-jsf-api_2.1_spec-2.1.28.SP2-redhat-1.jar:2.1.28.SP2-redhat-1]
The cause for this is that there is a missing reference to spacer.gif:
The spacer.gif is loaded in
http://localhost:8080/myapp/org.richfaces.resources/javax.faces.resource/org.richfaces/extendedDataTable.ecss?db=eAG7dPvZfwAIqAOT
This is how extendedDataTable.ecss looks rendered in the browser:
.rf-edt-rsz {
background-image: url(/ddsadmin_2/javax.faces.resource/spacer.gif.myportal-resource?ln=org.richfaces&v=sLjXbVU);
cursor: e-resize;
height: 20px;
position: absolute;
left: 100%;
margin-left: -3px;
width: 6px;
}
and how extendedDataTable.ecss looks like in the WAR:
.rf-edt-rsz {
background-image: "#{a4jSkin.imageUrl('spacer.gif')}";
cursor: e-resize;
height: 20px; /*TODO*/
position: absolute;
left: 100%;
margin-left: -3px;
width: 6px;
}
This is how to fix it yourself easily by overriding the css class (see also Chapter 3. RichFaces overview ):
Override the CSS class and remove the background-image reference:
<h:outputStylesheet target="head">
.rf-edt-rsz {
background-image: none;
}
</h:outputStylesheet>
The error itself has nothing to do with the skin used (I turned it off using org.richfaces.enableControlSkinning=false in web.xml), I verified it also occurs with blueSky or DEFAULT.
The spacer.gif is present in richfaces-4.5.17.Final\META-INF\resources\org.richfaces.staticResource\4.5.17.Final\PackedCompressed\blueSky\org.richfaces.images\spacer.gif.
The error is caused by a wrong reference to the existing spacer.gif:
The correct rendered reference would be
This is the wrong reference rendered in the ecss file:
http://localhost:8080/myapp/javax.faces.resource/spacer.gif
This it how it should look like (this reference works):
http://localhost:8080/myapp/org.richfaces.resources/javax.faces.resource/org.richfaces/spacer.gif
So the "org.richfaces.resources" is missing.