2 Replies Latest reply on Oct 10, 2007 11:40 AM by Arbi Sookazian

    Problem running MyFaces under JBoss 4.2.1.GA

    Bas Rutten Newbie

      Hello,

      I have a problem I hope you can help me with. I'm trying to deplay an EAR under JBoss 4.2.1.GA. The ear contains Seam 2.0.0.CR1, richfaces 3.1.1 and Facelets 1.1.12.

      Instead of using the Sun RI 1.2 implementation that ships with JBoss I want to use the MyFaces JSF implementation (1.1.4) that we used before migrating to JBoss 4.2.

      I have included the JSF libraries in my WAR file and have included the
      org.jboss.jbossfaces.WAR_BUNDLES_JSF_IMPL param in my web.xml

      web.xml looks like this:

      <?xml version="1.0" encoding="UTF-8"?>
      <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>@Investor</display-name>
      
       <context-param>
       <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
       <param-value>.xhtml</param-value>
       </context-param>
      
       <context-param>
       <param-name>facelets.DEVELOPMENT</param-name>
       <param-value>false</param-value>
       </context-param>
      
       <context-param>
       <param-name>org.jboss.seam.core.init.debug</param-name>
       <param-value>false</param-value>
       </context-param>
      
       <context-param>
       <param-name>org.ajax4jsf.SKIN</param-name>
       <param-value>blueSky</param-value>
       </context-param>
      
       <context-param>
       <param-name>facelets.LIBRARIES</param-name>
       <param-value>/META-INF/nxp.taglib.xml</param-value>
       </context-param>
      
       <context-param>
       <param-name>facelets.SKIP_COMMENTS</param-name>
       <param-value>true</param-value>
       </context-param>
      
       <context-param>
       <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
       <param-value>client</param-value>
       </context-param>
      
       <context-param>
       <param-name>org.ajax4jsf.VIEW_HANDLERS</param-name>
       <param-value>
       org.jboss.seam.ui.facelet.SeamFaceletViewHandler
       </param-value>
       </context-param>
      
       <context-param>
       <param-name>org.jboss.jbossfaces.WAR_BUNDLES_JSF_IMPL</param-name>
       <param-value>true</param-value>
       </context-param>
      
       <listener>
       <listener-class>
       org.jboss.seam.servlet.SeamListener
       </listener-class>
       </listener>
      
       <listener>
       <listener-class>
       org.apache.myfaces.webapp.StartupServletContextListener
       </listener-class>
       </listener>
      
       <filter>
       <filter-name>Seam Filter</filter-name>
       <filter-class>org.jboss.seam.web.SeamFilter</filter-class>
       </filter>
      
       <filter-mapping>
       <filter-name>Seam Filter</filter-name>
       <url-pattern>/*</url-pattern>
       </filter-mapping>
      
      <!--
       <filter>
       <display-name>Ajax4jsf Filter</display-name>
       <filter-name>ajax4jsf</filter-name>
       <filter-class>org.ajax4jsf.Filter</filter-class>
       </filter>
      
       <filter-mapping>
       <filter-name>ajax4jsf</filter-name>
       <url-pattern>*.faces</url-pattern>
       <dispatcher>REQUEST</dispatcher>
       <dispatcher>FORWARD</dispatcher>
       <dispatcher>INCLUDE</dispatcher>
       </filter-mapping>
      
      -->
      
       <session-config>
       <session-timeout>15</session-timeout>
       </session-config>
      
       <!--
       <filter>
       <filter-name>Seam Redirect Filter</filter-name>
       <filter-class>
       org.jboss.seam.servlet.SeamRedirectFilter
       </filter-class>
       </filter>
      
       <filter-mapping>
       <filter-name>Seam Redirect Filter</filter-name>
       <url-pattern>*.faces</url-pattern>
       </filter-mapping>
      
       <filter>
       <filter-name>Seam Exception Filter</filter-name>
       <filter-class>
       org.jboss.seam.servlet.SeamExceptionFilter
       </filter-class>
       </filter>
      
      
       <filter-mapping>
       <filter-name>Seam Exception Filter</filter-name>
       <url-pattern>*.faces</url-pattern>
       </filter-mapping>
       -->
      
       <servlet>
       <servlet-name>Faces Servlet</servlet-name>
       <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
       <load-on-startup>1</load-on-startup>
       </servlet>
      
       <servlet>
       <servlet-name>Seam Resource Servlet</servlet-name>
       <servlet-class>
       org.jboss.seam.servlet.ResourceServlet
       </servlet-class>
       </servlet>
      
       <servlet-mapping>
       <servlet-name>Faces Servlet</servlet-name>
       <url-pattern>*.faces</url-pattern>
       </servlet-mapping>
      
       <!--
       <servlet-mapping>
       <servlet-name>Seam Resource Servlet</servlet-name>
       <url-pattern>/faces/resource/*</url-pattern>
       </servlet-mapping>
       -->
      
       <servlet>
       <servlet-name>jasperreportspdf</servlet-name>
       <servlet-class>
       net.sf.jasperreports.j2ee.servlets.PdfServlet
       </servlet-class>
       </servlet>
      
       <servlet-mapping>
       <servlet-name>jasperreportspdf</servlet-name>
       <url-pattern>/reportpdf/*</url-pattern>
       </servlet-mapping>
      
       <servlet>
       <servlet-name>jasperreportsxls</servlet-name>
       <servlet-class>
       net.sf.jasperreports.j2ee.servlets.XlsServlet
       </servlet-class>
       </servlet>
      
       <servlet-mapping>
       <servlet-name>jasperreportsxls</servlet-name>
       <url-pattern>/reportxls/*</url-pattern>
       </servlet-mapping>
      
       <welcome-file-list>
       <welcome-file>index.html</welcome-file>
       <welcome-file>index.jsp</welcome-file>
       </welcome-file-list>
      </web-app>
      
      
      


      faces-config.xml:

      <?xml version="1.0" encoding="UTF-8"?>
      <!DOCTYPE faces-config PUBLIC "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.1//EN"
       "http://java.sun.com/dtd/web-facesconfig_1_1.dtd">
      <faces-config>
       <lifecycle>
       <phase-listener>
       org.jboss.seam.jsf.TransactionalSeamPhaseListener
       </phase-listener>
       </lifecycle>
      
       <converter>
       <converter-id>userConverter</converter-id>
       <converter-class>
       com.nxp.atinvestor.web.controller.UserConverter
       </converter-class>
       </converter>
      
       <converter>
       <converter-id>emptyStringToNullConverter</converter-id>
       <converter-class>com.nxp.atinvestor.web.controller.EmptyStringToNullConverter</converter-class>
       </converter>
      
       <application>
       <locale-config>
       <default-locale>en</default-locale>
       </locale-config>
       </application>
      </faces-config>
      
      


      When I try to deploy my EAR I get the following stack trace

      
      14:51:00,000 ERROR [[/atinvestor]] Exception starting filter Seam Filter
      java.lang.ClassCastException: org.jboss.seam.web.SeamFilter
       at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:2
      55)
       at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.jav
      a:397)
       at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:108)
      
       at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:3720)
       at org.apache.catalina.core.StandardContext.start(StandardContext.java:4365)
       at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:761)
       at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:741)
       at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:553)
       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:585)
       at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:297)
       at org.jboss.mx.server.RawDynamicInvoker.invoke(RawDynamicInvoker.java:164)
       at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
       at org.apache.catalina.core.StandardContext.init(StandardContext.java:5310)
       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:585)
       at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:297)
       at org.jboss.mx.server.RawDynamicInvoker.invoke(RawDynamicInvoker.java:164)
       at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
       at org.jboss.web.tomcat.service.TomcatDeployer.performDeployInternal(TomcatDeployer.java:301
      )
      etc...
      


      My guess is that somehow JBoss is not using the JSF libraries I want it to use; I'm currently at a loss about how to solve it though.

      I don't know if it matters but my jboss-app.xml reads:

      <jboss-app>
       <loader-repository>seam.jboss.org:loader=atinvestor</loader-repository>
      </jboss-app>
      


      What am I missing here?



        • 1. Re: Problem running MyFaces under JBoss 4.2.1.GA
          Arbi Sookazian Master

          1.11. Running the Seam examples in JBoss using the JSF 1.2 RI
          JBoss AS 4.0 ships with the Apache MyFaces implementation of JSF 1.1. After many months of waiting, there is still no implementation of JSF 1.2 from MyFaces. For this and other reasons, JBoss AS 4.2 will embed the JSF 1.2 Reference Implementation by default. Soon after the release of 4.2, we will migrate the Seam examples to JSF 1.2.
          For those who can't wait, Seam is already compatible with JSF 1.2, and it's easy to get the Seam examples running with JSF 1.2 in JBoss 4.0.5. Let's start with the famous booking example:
          ? copy jsf-api.jar, jsf-impl.jar, el-api.jar, el-ri.jar to server/default/deploy/tomcat/jbossweb-tomcat55.sar/jsf-libs.
          ? delete myfaces-api.jar and myfaces-impl.jar from server/default/deploy/tomcat/jbossweb-tomcat55.sar/jsf-libs.
          ? edit server/default/deploy/tomcat/jbossweb-tomcat55.sar/conf/web.xml, replacing myfaces-impl.jar with jsf-impl.jar.
          ? edit examples/booking/resources/WEB-INF/web.xml, deleting the MyFaces listener, uncommenting the RI listener
          ? edit examples/booking/resources/WEB-INF/faces-config.xml, uncommenting the lines that install the SeamELResolver using the new JSF 1.2 XML schema declaration.
          ? edit examples/booking/resources/META-INF/application.xml, deleting the lines that declare el-api.jar and el-impl.jar as Java modules.
          Restart JBoss, and type ant in the examples/booking directory.
          Source: http://docs.jboss.org/seam/1.2.1.GA/reference/en/html/tutorial.html

          Add commons-digester-*.jar and commons-beanutils-*.jar to the ant build (this mod to the ant build.xml is complete!)
          http://conspicuousmusings.blogspot.com/2007/05/jboss-42-with-seam-12-using-myfaces.html

          • 2. Re: Problem running MyFaces under JBoss 4.2.1.GA
            Arbi Sookazian Master

            sorry ignore my first post above.

            you need to disable the JSF RI libs from your JBoss classpath:

            C:\jboss-4.2.1.GA\server\default\deploy\jboss-web.deployer\jsf-libs

            how are you doing that?