Search code examples
jqueryoracleweblogicrichfacesweblogic11g

RichFaces 4.5 - Weblogic 11g - ReferenceError


I'm working on an application using Struts and JSF 2 with RichFaces 4.5.4.

Everything works fine when the application runs on a Tomcat(7) server. But when I run it on a WebLogic(11gR1-10.3.6) server the JS resources are not loaded.

The rich:popupPanel gets the error: ReferenceError: RichFaces is not defined And when I try to run a jQuery script I get: ReferenceError: jQuery is not defined

I'm using <h:head> instead of <head> and I have this parameters in my web.xml:

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

Solution

  • Well, it seems that ResourceServlet wasn't automatically registered.

    As explains here ResourceServlet is automatically registered in the Servlet 3.0 and higher environments.

    In the Servlet 2.5 and lower environments, it is necessary to register the ResourceServlet manually in the WEB-INF/web.xml configuration file:

    <servlet>
      <servlet-name>Resource Servlet</servlet-name>
      <servlet-class>org.richfaces.webapp.ResourceServlet</servlet-class>
      <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet-mapping>
      <servlet-name>Resource Servlet</servlet-name>
      <url-pattern>/org.richfaces.resources/*</url-pattern>
    </servlet-mapping>
    <context-param>
        <param-name>org.richfaces.resourceOptimization.enabled</param-name>
        <param-value>true</param-value>
    </context-param>