Uploaded image for project: 'RichFaces'
  1. RichFaces
  2. RF-12797

rich:editor not rendered when using RichFaces module

    XMLWordPrintable

    Details

    • Steps to Reproduce:
      Hide

      1) copy there richfaces jars from richfaces-4.3.0.Final.zip distribution:

      richfaces-components-api-4.3.0.Final.jar
      richfaces-components-ui-4.3.0.Final.jar
      richfaces-core-api-4.3.0.Final.jar
      richfaces-core-impl-4.3.0.Final.jar

      2) add following module.xml:

      <module xmlns="urn:jboss:module:1.1" name="org.richfaces">
      <resources>
      <resource-root path="richfaces-components-api-4.3.0.Final.jar"/>
      <resource-root path="richfaces-components-ui-4.3.0.Final.jar"/>
      <resource-root path="richfaces-core-api-4.3.0.Final.jar"/>
      <resource-root path="richfaces-core-impl-4.3.0.Final.jar"/>
      <!-- Insert resources here -->
      </resources>
      <dependencies>
      <module name="org.w3c.css.sac"/>
      <module name="net.sourceforge.cssparser"/>
      <module name="com.sun.jsf-impl"/>
      <module name="javax.api"/>
      <module name="javax.faces.api"/>
      <module name="javax.xml.bind.api"/>
      <module name="javax.xml.jaxp-provider"/>
      <module name="com.google.guava"/>
      </dependencies>
      </module>
      

      3) Unpack the attached zip.
      4) Build a War, which points to Richfaces module: gradle assemble
      (to build a War with included RF, run: gradle -Dendorsed=true assemble)
      5) Deploy to War to JBoss
      6) Startup Log of JBoss will show that the required resources are available.
      7) Go to http://localhost:8080/editor-test/index.jsf . With RF module, rich:editor won't show.
      8) if you use gradle -Dendorsed=true assemble, the editor will be visible

      Show
      1) copy there richfaces jars from richfaces-4.3.0.Final.zip distribution: richfaces-components-api-4.3.0.Final.jar richfaces-components-ui-4.3.0.Final.jar richfaces-core-api-4.3.0.Final.jar richfaces-core-impl-4.3.0.Final.jar 2) add following module.xml: <module xmlns="urn:jboss:module:1.1" name="org.richfaces"> <resources> <resource-root path="richfaces-components-api-4.3.0.Final.jar"/> <resource-root path="richfaces-components-ui-4.3.0.Final.jar"/> <resource-root path="richfaces-core-api-4.3.0.Final.jar"/> <resource-root path="richfaces-core-impl-4.3.0.Final.jar"/> <!-- Insert resources here --> </resources> <dependencies> <module name="org.w3c.css.sac"/> <module name="net.sourceforge.cssparser"/> <module name="com.sun.jsf-impl"/> <module name="javax.api"/> <module name="javax.faces.api"/> <module name="javax.xml.bind.api"/> <module name="javax.xml.jaxp-provider"/> <module name="com.google.guava"/> </dependencies> </module> 3) Unpack the attached zip. 4) Build a War, which points to Richfaces module: gradle assemble (to build a War with included RF, run: gradle -Dendorsed=true assemble) 5) Deploy to War to JBoss 6) Startup Log of JBoss will show that the required resources are available. 7) Go to http://localhost:8080/editor-test/index.jsf . With RF module, rich:editor won't show. 8) if you use gradle -Dendorsed=true assemble, the editor will be visible
    • Workaround Description:
      Hide

      To make rich:editor work with RF-module, add this WebListener in your WAR:

      import javax.servlet.ServletContext;
      import javax.servlet.ServletContextEvent;
      import javax.servlet.ServletContextListener;
      import javax.servlet.ServletRegistration.Dynamic;
      import javax.servlet.annotation.WebListener;
       
      import org.richfaces.webapp.ResourceServlet;
      import org.richfaces.webapp.ResourceServletContainerInitializer;
       
      @WebListener
      public class RichFacesInitializer implements ServletContextListener {
       
          @Override
          public void contextInitialized(final ServletContextEvent sce) {
              final ServletContext servletContext = sce.getServletContext();
              Dynamic dynamicRegistration = servletContext.addServlet("AutoRegisteredEditorResourceServlet", ResourceServlet.class);
              dynamicRegistration.addMapping(ResourceServletContainerInitializer.EDITOR_RESOURCES_DEFAULT_MAPPING);
          }
       
          @Override
          public void contextDestroyed(final ServletContextEvent sce) {
          }
      }
      

      Show
      To make rich:editor work with RF-module, add this WebListener in your WAR: import javax.servlet.ServletContext; import javax.servlet.ServletContextEvent; import javax.servlet.ServletContextListener; import javax.servlet.ServletRegistration.Dynamic; import javax.servlet.annotation.WebListener;   import org.richfaces.webapp.ResourceServlet; import org.richfaces.webapp.ResourceServletContainerInitializer;   @WebListener public class RichFacesInitializer implements ServletContextListener { @Override public void contextInitialized(final ServletContextEvent sce) { final ServletContext servletContext = sce.getServletContext(); Dynamic dynamicRegistration = servletContext.addServlet("AutoRegisteredEditorResourceServlet", ResourceServlet.class); dynamicRegistration.addMapping(ResourceServletContainerInitializer.EDITOR_RESOURCES_DEFAULT_MAPPING); } @Override public void contextDestroyed(final ServletContextEvent sce) { } }

      Description

      I want to configure my Webapp to use RichFaces as a JBoss module not a library. To achieve this, I create the module org.richfaces with version 4.3.0 in module directory of JBoss.

      As soon as I switch from library to module, the rich:editor is not rendered anymore. In the Browser History i read

      [15:07:25.511] GET http://localhost:8080/editor-test/org.richfaces.resources/javax.faces.resource/org.richfaces.ckeditor/lang/de.js?t=D03G5XL [HTTP/1.1 404 Not Found 1ms]

      I validated that the resource lang/de.js is available in classpath though.

      15:01:02,780 INFO [stdout] (MSC service thread 1-5) The following resource(s) are found at location /META-INF/resources/org.richfaces.ckeditor/lang/de.js
      15:01:02,781 INFO [stdout] (MSC service thread 1-5) — jar:file:/opt/jboss-7.1.1/modules/org/richfaces/main/richfaces-components-ui-4.3.0.Final.jar!/META-INF/resources/org.richfaces.ckeditor/lang/de.js

      Weird enough, all other components I checked still work. I followed the instructions of https://issues.jboss.org/browse/RF-12008.

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                semubiz Serge Mürset
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated: