5 Replies Latest reply on Dec 10, 2007 7:42 AM by magdam

    Seam 2.0 and MyFaces

    pietruha

      Hi
      I need to use MyFaces with Seam 2.0 on JBoss 4.2.2 (one of third party jsf libraries needs it). Following the article http://wiki.jboss.org/wiki/Wiki.jsp?page=JBoss5AndMyFaces I have added a context parameter to web.xml. Which version of MyFaces should I use?

      If I use MyFaces 1.1.5 I get this error:

      21:42:28,843 INFO [FacesConfigurator] Reading config jar:file:/C:/JBoss/server/default/tmp/deploy/tmp45116jboss-seam.jar!/META-INF/faces-config.xml
      21:42:28,843 ERROR [Digester] Parse Error at line 2 column 14: Document is invalid: no grammar found.
      org.xml.sax.SAXParseException: Document is invalid: no grammar found.
       at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source)
       at org.apache.xerces.util.ErrorHandlerWrapper.error(Unknown Source)
      ...


      And more and more ...

      If I use MyFaces 1.2.0 I get this error:
      22:10:43,734 ERROR [DefaultFacesInitializer] Error initializing MyFaces: Class org.jboss.seam.jsf.SeamApplicationFactory is no javax.faces.application.ApplicationFactory
      java.lang.IllegalArgumentException: Class org.jboss.seam.jsf.SeamApplicationFactory is no javax.faces.application.ApplicationFactory
       at javax.faces.FactoryFinder.newFactoryInstance(FactoryFinder.java:128)
       at javax.faces.FactoryFinder.getFactory(FactoryFinder.java:107)
       at org.apache.myfaces.config.FacesConfigurator.configureApplication(FacesConfigurator.java:499)
       at org.apache.myfaces.config.FacesConfigurator.configure(FacesConfigurator.java:190)
       at org.apache.myfaces.webapp.DefaultFacesInitializer.initFaces(DefaultFacesInitializer.java:112)
       at org.apache.myfaces.webapp.StartupServletContextListener.contextInitialized(StartupServletContextListener.java:57)
       at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3856)
      ...


      What can I do?

        • 1. Re: Seam 2.0 and MyFaces
          pmuir

          Use MyFaces 1.2. That exception suggests to me that you've still got conflicting jsf implementations in JBoss AS.

          • 2. Re: Seam 2.0 and MyFaces
            pietruha

            I have added this entry to the web.xml:

            <context-param>
             <param-name>org.jboss.jbossfaces.WAR_BUNDLES_JSF_IMPL</param-name>
             <param-value>true</param-value>
            </context-param>

            myfaces-api.jar and myfaces-impl.jar I have added to WEB-INF/lib in war file.

            JBoss AS 4.2.2 is newly installed and the application is newly generated by seam-gen. Without any changes. No other applications on server. Where should I search a solution?

            • 3. Re: Seam 2.0 and MyFaces
              ssilvert

              Are you sure that your third party library needs the MyFaces impl? Which one is it? The only one I know of that actually referred to MyFaces core impl classes was old versions of Tomahawk.

              If you are still getting conflicts as Pete suggests then you should try removing the JSF impl from /deploy/jboss-web.deployer/jsf-libs. If you do that then you will also need to edit /deploy/jboss-web.deployer/conf/web.xml and comment out these listeners:

              <!-- Configures JSF for a web application if the javax.faces.webapp.FacesServlet is declared -->
               <!-- in web.xml. -->
               <listener>
               <listener-class>org.jboss.web.jsf.integration.config.JBossJSFConfigureListener</listener-class>
               </listener>
              
               <!-- Listens to all web app lifecycle events so that @PreDestroy can be called on -->
               <!-- JSF managed beans that go out of scope. You can comment this out if you -->
               <!-- don't use JSF or you don't use annotations on your managed beans. -->
               <listener>
               <listener-class>com.sun.faces.application.WebappLifecycleListener</listener-class>
               </listener>
              


              Hope that helps,

              Stan

              • 4. Re: Seam 2.0 and MyFaces
                pietruha

                It is fck-faces. I have changed dependency to tomahawk and now it's working.

                • 5. Re: Seam 2.0 and MyFaces
                  magdam

                  I have the same problem. When I comment listeners in web.xml I have error

                  Failed to load engineOptionsClass
                  java.lang.reflect.InvocationTargetException
                  at sun.reflect.GeneratedConstructorAccessor47.newInstance(Unknown Source)