2 Replies Latest reply on Jul 13, 2006 12:25 PM by holgerprause

    ajax4js and seam integration - my guide

    holgerprause Newbie

      Hello,

      after spending 3 days with trying to integrate ajax framworks with jboss seam i finally get a integration with ajax4jsf working

      1) first download ajax4js https://ajax4jsf.dev.java.net/nonav/ajax/ajax-jsf/

      2) copy the following jars to $JBOSSSERVERHOME/default/lib

      el-api.jar
      el-ri.jar
      jsf-facelets.jar
      ajax4jsf.jar
      oscache-2.2.jar

      this has to be done becourse of a global JBoss Classloader Issue (cant find the the posting i found for that, i am sorry) , when i deployed these jars with my application i got a lot of problems, well u can try out maybe u get it working.

      Also make sure sure the jars mentionend above are not deployed with your application!

      3)

      change web.xml to and make sure no application view handler is defined.

      <?xml version="1.0" encoding="UTF-8"?>
      <!DOCTYPE faces-config
       PUBLIC "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.0//EN"
       "http://java.sun.com/dtd/web-facesconfig_1_0.dtd">
      
      <faces-config>
       <lifecycle>
       <phase-listener>
       org.jboss.seam.jsf.SeamExtendedManagedPersistencePhaseListener
       </phase-listener>
       </lifecycle>
      
      </faces-config>
      



      change faces-config.xml to
      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">
      
       <!-- Seam -->
       <listener>
       <listener-class>org.jboss.seam.servlet.SeamListener</listener-class>
       </listener>
      
       <!-- Propagate conversations across redirects -->
       <filter>
       <filter-name>Seam Redirect Filter</filter-name>
       <filter-class>org.jboss.seam.servlet.SeamRedirectFilter</filter-class>
       </filter>
      
       <!-- ajax4jsf -->
       <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>*.seam</url-pattern>
       </filter-mapping>
      
      
      
       <filter-mapping>
       <filter-name>Seam Redirect Filter</filter-name>
       <url-pattern>*.seam</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>*.jsf</url-pattern>
       </filter-mapping>
      
      
       <!-- JSF -->
       <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>com.sun.facelets.FaceletViewHandler</param-value>
       </context-param>
       <context-param>
       <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
       <param-value>.xhtml</param-value>
       </context-param>
       <context-param>
       <param-name>facelets.REFRESH_PERIOD</param-name>
       <param-value>2</param-value>
       </context-param>
       <context-param>
       <param-name>facelets.DEVELOPMENT</param-name>
       <param-value>true</param-value>
       </context-param>
       <context-param>
       <param-name>com.sun.faces.validateXml</param-name>
       <param-value>true</param-value>
       </context-param>
       <context-param>
       <param-name>com.sun.faces.verifyObjects</param-name>
       <param-value>true</param-value>
       </context-param>
       <context-param>
       <param-name>org.ajax4jsf.SKIN</param-name>
       <param-value>DEFAULT</param-value>
       </context-param>
      
       <servlet>
       <servlet-name>Faces Servlet</servlet-name>
       <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
       <load-on-startup>1</load-on-startup>
       </servlet>
      
       <!-- Faces Servlet Mapping -->
       <servlet-mapping>
       <servlet-name>Faces Servlet</servlet-name>
       <url-pattern>*.seam</url-pattern>
       </servlet-mapping>
      
       <!-- MyFaces -->
       <listener>
       <listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class>
       </listener>
      </web-app>
      
      



      4) if u have a have any h:commandLink with parameters (f:param)
      replace them with a4j:commandLink or the parameter will get lost

      It works good for me even conversations seems (what a wordplay) to work.

      Thats it, well its only a temporary guide until maybe some of the jboss crew can give a more detailed and better solution, hopefully its integrated in the next release :-) (copying the jars in the servers /default/lib directory really gives me a bad taste)

      Hope i could help someone,

      Bye,

      Holger





        • 1. Re: ajax4js and seam integration - my guide
          Gus Gu Expert

          Hi Holger,

          Thank you very much for your guidance. Now, I did not get the "java.lang.ClassNotFoundException: No ClassLoaders found for:
          org.ajax4jsf.framework.util.config.FilterBean" when I start the JBoss4.0.4.GA. However, when I run my application from browser, I got another exceptions:

          javax.servlet.ServletException: org.apache.jasper.JasperException
           at javax.faces.webapp.FacesServlet.service(FacesServlet.java:152)
           at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
           at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
           at org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:144)
           at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
           at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
           at org.jboss.seam.servlet.SeamExceptionFilter.doFilter(SeamExceptionFilter.java:45)
           at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
           at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
           at org.ajax4jsf.framework.ajax.xmlfilter.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:64)
           at org.ajax4jsf.framework.ajax.xmlfilter.BaseFilter.doFilter(BaseFilter.java:224)
           at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
           at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
           at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
           at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
           at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
           at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
           at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
           at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
           at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
           at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
           at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
           at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
           at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
           at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
           at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
           at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
           at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
           at java.lang.Thread.run(Thread.java:595)
          

          I did put all the libs:
          el-api.jar
          el-ri.jar
          jsf-facelets.jar
          ajax4jsf.jar
          oscache-2.2.jar
          in $JBOSSSERVERHOME/default/lib. Thank you and anybody in advance for further guidance.

          • 2. Re: ajax4js and seam integration - my guide
            holgerprause Newbie

            Hello,


            well thats strange, i somehow remember this error but i dindt get it anymore for 1 day,maybe u deploy the jars u copied to $JBOSSSERVERHOME/default/lib
            with your application? (look at build.xml)

            If all dont helps, try cleaning up/reinstalling everything, sorry i couldnt help anyfurther,

            Bye,

            Holger