1 2 Previous Next 19 Replies Latest reply on Jan 23, 2016 1:09 AM by peter.falken

    JSF taglibs in AS7 and modules

    jimbrady

      Hi all,

        I have been experimenting with Richfaces 4.0 under AS7.0.0.0 Final, with the Richfaces jar being passed to the application via a module (with all appropriate dependencies). It seems to require the Richfaces jars to be in the application - because it doesn't find the faces-config bzw. taglib definitions from the module. Is there a way around this?

      Thanks

        • 1. Re: JSF taglibs in AS7 and modules
          kwutzke

          IIRC I had the same problem. I keep them in the webapp and "everything is fine".

           

          Karsten

          • 2. Re: JSF taglibs in AS7 and modules
            jimbrady

            Well yes,

              but that is exactly my point. Isn't the idea of modules not to have jar files duplicated in your (potentially mulitple) applications. And I want the module anyway - in order to contain all the dependencies.

            • 3. Re: JSF taglibs in AS7 and modules
              eduardo.mello.cantu

              I think you're trying to do the same as in http://community.jboss.org/thread/174293.

              Anyway, it didn't solve my case.

              • 4. Re: JSF taglibs in AS7 and modules
                sfcoy

                Section 7.2 of the JavaServer Pages Specification Version 2.2 explains how taglibs are discovered

                • 5. Re: JSF taglibs in AS7 and modules
                  jimbrady

                  This is using facelets not JSP.

                   

                  Besides which, I don't think this is relevant. I also tried extracting the taglib definitions and putting them in the war, but that also doesn't work.

                  • 6. Re: JSF taglibs in AS7 and modules
                    jimbrady

                    Yes, it is the same.

                    • 7. Re: JSF taglibs in AS7 and modules
                      sfcoy

                      Have you tried this in your web.xml?

                       <context-param>
                              <param-name>javax.faces.FACELETS_LIBRARIES</param-name>
                              <param-value>WEB-INF/a4j.taglib.xml;WEB-INF/rich.taglib.xml</param-value>
                       </context-param>
                      

                       

                      (I've guessed where you may have placed the taglib descriptors)

                       

                      The spec (§10.3.2) says:

                      The run time must support two modes of discovery for Facelet tag library descriptors

                       

                      • Via declaration in the web.xml, as specified in Section 11.1.3 “Application Configuration Parameters”
                      • Via auto discovery by placing the tag library discriptor file within a jar on the web application classpath, naming the file so that it ends with “.taglib.xml”, without the quotes, and placing the file in the META-INF directory in the jar file.

                      so I think it should really find them in your module anyway. It kind of depends on exactly what they mean by "web application classpath".

                      • 8. Re: JSF taglibs in AS7 and modules
                        ctomc

                        What if you try explicit including taglib definitions from your dependant module?

                         

                        in your jboss-deployment-descriptor.xml

                         

                        add dependency like this:

                         

                            

                        <module name="my.module">
                             <imports><include path="META-INF"/></imports>
                        </module>
                        

                         

                        or include any path where your taglibs reside.

                         

                        by default when you add dependency it will add just dependencies to classes and nothing more (not even annotations on these classes)

                         

                         

                        cheers,

                        tomaz

                        1 of 1 people found this helpful
                        • 9. Re: JSF taglibs in AS7 and modules
                          jimbrady

                          jboss-deployment-decriptor.xml? Do you mean perhaps jboss-deployment-structure.xml?

                           

                          I'm using the dependencies in the manifest at the moment. Is there an equivalent?

                           

                          This sounds like we are almost there, it is the sort of answer I would like.

                          • 10. Re: JSF taglibs in AS7 and modules
                            jimbrady

                            I waited for JBoss AS 7.1 to test this suggestion - and it indeed works.

                             

                            Here is the solution for Richfaces:

                             

                            module.xml

                             

                            <module xmlns="urn:jboss:module:1.1" name="com.myproject.richfaces">
                                <resources>
                                    <resource-root path="richfaces-components-api-4.0.0.Final.jar"/>
                                    <resource-root path="richfaces-components-ui-4.0.0.Final.jar"/>
                                    <resource-root path="richfaces-core-api-4.0.0.Final.jar"/>
                                    <resource-root path="richfaces-core-impl-4.0.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>

                             

                             

                            jboss_deployment_structure.xml (in Ear META-INF)

                             

                            <

                            jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.1"

                            >

                             

                            <deployment>

                             

                            <!-- This allows you to define additional dependencies, it is the same

                            as using the Dependencies: manifest attribute -->

                             

                              <dependencies>

                             

                                <module name="org.slf4j" />

                             

                                <module name="org.slf4j.jcl-over-slf4j" />

                             

                                <module name="org.apache.commons.collections" />

                             

                                <module name="javax.ejb.api" />

                             

                              </dependencies>

                             

                            </deployment>

                             

                            <sub-deployment name="MyProjectWeb.war">

                             

                              <dependencies>

                             

                             

                                <module name="com.myproject.richfaces" >

                             

                                  <imports>

                             

                                    <include path="**" />

                             

                                  </imports>

                             

                                </module>

                             

                              </dependencies>

                             

                            </sub-deployment>

                            </

                            jboss-deployment-structure>

                             

                            P.S. Ear now less than 200Kb was over 3.6Mb

                            • 11. Re: JSF taglibs in AS7 and modules
                              mpgong

                              Quick question about this.  So you had to make the modules for the richfaces dependencies?  Would things also work if i were to create a single module and put all of the libs in there and not call out dependecies like so

                               

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

                               

                              except for where JBoss already defined them like javax.api?

                               

                              Thanks

                              • 12. Re: JSF taglibs in AS7 and modules
                                jimbrady

                                All of the above ARE already defined by jboss. My modules are all called com.myproject...

                                • 13. Re: JSF taglibs in AS7 and modules
                                  lfryc

                                  Hey guys, this seems just great!

                                   

                                  I would love to see this module as part of RichFaces distribution!

                                  • 14. Re: JSF taglibs in AS7 and modules
                                    lfryc

                                    Hi guys,

                                     

                                    just for reference, here is the feature request for distributing RichFaces 4 with AS7 module, please vote there or comment if you would like to grab that issue and implement it:

                                     

                                    https://issues.jboss.org/browse/RF-12008

                                     

                                    Thanks,

                                     

                                    ~ Lukas

                                    1 2 Previous Next