5 Replies Latest reply on Nov 2, 2007 11:11 AM by Maykell Frometa

    MyFaces, Seam and JBoss 4.2.1 GA problem

    Maykell Frometa Newbie

      Hi all, i have an old MyFaces-EJB3 sample application that i'm refactoring to use Seam, i set every single datail (i've read a lot of tutorial and forum's posts about the topic ) in order to integrate Seam with my old myfaces application but when i try to run it on server i get the following error:

      [quoted]
      23:51:06,875 INFO [STDOUT] 23:51:06,859 ERROR [StartupServletContextListener] Error initializing ServletContext
      java.lang.IllegalArgumentException: Class org.jboss.seam.jsf.SeamApplicationFactory is no javax.faces.application.ApplicationFactory
      at javax.faces.FactoryFinder.newFactoryInstance(FactoryFinder.java:132)
      at javax.faces.FactoryFinder.getFactory(FactoryFinder.java:107)
      at org.apache.myfaces.config.FacesConfigurator.configureApplication(FacesConfigurator.java:439)
      [/quoted]

      If i let the Myfaces jar files in web-inf/lib but delete the myfaces listener entry from web.xml the application get the following error:

      [quoted]
      00:27:19,234 INFO [STDOUT] 00:27:19,234 ERROR [[/jsfTest]] StandardWrapper.Throwable
      java.lang.IllegalStateException: No Factories configured for this Application. This happens if the faces-initialization does not work at all - make sure that you properly include all configuration settings necessary for a basic faces application and that all the necessary libs are included. Also check the logging output of your web application and your container for any exceptions!
      If you did that and find nothing, the mistake might be due to the fact that you use some special web-containers which do not support registering context-listeners via TLD files and a context listener is not setup in your web.xml.
      A typical config looks like this;

      <listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class>


      at javax.faces.FactoryFinder.getFactory(FactoryFinder.java:90)
      at javax.faces.webapp.FacesServlet.init(FacesServlet.java:88)
      at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1161)
      at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:981)
      at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4069)
      at org.apache.catalina.core.StandardContext.start(StandardContext.java:4373)
      at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:761)
      at org.apache.catalina.
      [/quoted]

      If i eliminate the myfaces jar, and the myfaces listener declaration in web.xml the application works well, then the error is exclusively related to the use of Myfaces, i think some kind of conflict between Seam listener and Myfaces Listener, but i don't know why and how solve this.

      This is my web.xml:
      [qouted]
      <?xml version="1.0"?>
      <!--
      * Copyright 2004 The Apache Software Foundation.
      *
      * Licensed under the Apache License, Version 2.0 (the "License");
      * you may not use this file except in compliance with the License.
      * You may obtain a copy of the License at
      *
      * http://www.apache.org/licenses/LICENSE-2.0
      *
      * Unless required by applicable law or agreed to in writing, software
      * distributed under the License is distributed on an "AS IS" BASIS,
      * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
      * See the License for the specific language governing permissions and
      * limitations under the License.
      -->
      <web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
      <display-name>jsfTest</display-name>
      <context-param>
      <param-name>org.ajax4jsf.SKIN</param-name>
      <param-value>blueSky</param-value>
      </context-param>

      <context-param>
      <param-name>javax.faces.CONFIG_FILES</param-name>
      <param-value>/WEB-INF/navigation-rule.xml</param-value>
      </context-param>

      <context-param>
      State saving method: "client" or "server" (= default)
      See JSF Specification 2.5.2
      <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
      <param-value>client</param-value>
      </context-param>

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


      <display-name>Ajax4jsf Filter</display-name>
      <filter-name>ajax4jsf</filter-name>
      <filter-class>org.ajax4jsf.Filter</filter-class>
      <init-param>
      <param-name>forceparser</param-name>
      <param-value>false</param-value>
      </init-param>



      <filter-mapping>
      <filter-name>ajax4jsf</filter-name>
      <servlet-name>Faces Servlet</servlet-name>
      REQUEST
      FORWARD
      INCLUDE
      </filter-mapping>




      <!-- Listener, that does all the startup work (configuration, init). -->

      <listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class>




      <listener-class>org.jboss.seam.servlet.SeamListener</listener-class>





      <!-- Faces Servlet -->

      <servlet-name>Faces Servlet</servlet-name>
      <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
      <load-on-startup>1</load-on-startup>

      <servlet-mapping>
      <servlet-name>Faces Servlet</servlet-name>
      <url-pattern>*.jsf</url-pattern>
      </servlet-mapping>
      <servlet-mapping>
      <servlet-name>Faces Servlet</servlet-name>
      <url-pattern>/faces/*</url-pattern>
      </servlet-mapping>
      <login-config>
      <auth-method>BASIC</auth-method>
      </login-config>
      </web-app>
      [/qouted]

      I'm using JBoss 4.2.1 GA, seam 1.2.0.AP and Myfaces 1.1.4

      I hope you can help me