4 Replies Latest reply on Sep 16, 2007 12:55 PM by Anton Anton

    Migrating JSF app from JBOSS AS 4.0.5 to 4.2.0

    Anton Anton Newbie

      Hi all!
      I have JSF App which is based on MyFaces impl 1.1.5 ver + Tomahawk and it is using Tiles (by special filter from Tomahauk) It works fine on 4.0.5, but when I'm trying to migrate on 4.2.0 - it didn't work.
      My steps:
      due WIKI I decided to use JSF Impl which is bundled with new JBOSS.
      I had changed header in my web.xml

      <web-app 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_5.xsd" version="2.5">

      , deleted MyFaces impl and deploy app - all what I saw were errors
      2007-07-02 01:19:39,453 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost].[/hotel].[jsp]] Servlet.service() for servlet jsp threw exception
      java.lang.RuntimeException: Cannot find FacesContext
       at javax.faces.webapp.UIComponentClassicTagBase.getFacesContext(UIComponentClassicTagBase.java:1797)
       at javax.faces.webapp.UIComponentClassicTagBase.setJspId(UIComponentClassicTagBase.java:1614)
       at org.apache.jsp.jsp.component.mainlogin_jsp._jspx_meth_f_005fview_005f0(mainlogin_jsp.java:133)
       at org.apache.jsp.jsp.component.mainlogin_jsp._jspService(mainlogin_jsp.java:105)
       at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
       at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
       at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:387)
       at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
       at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
       at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
       at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:687)
       at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:469)
       at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:403)
       at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:301)
       at org.apache.myfaces.context.servlet.ServletExternalContextImpl.dispatch(ServletExternalContextImpl.java:419)
       at org.apache.myfaces.tomahawk.application.jsp.JspTilesViewHandlerImpl.dispatch(JspTilesViewHandlerImpl.java:236)
       at org.apache.myfaces.tomahawk.application.jsp.JspTilesViewHandlerImpl.renderView(JspTilesViewHandlerImpl.java:222)
       at org.apache.myfaces.lifecycle.RenderResponseExecutor.execute(RenderResponseExecutor.java:41)
       at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:132)
       at javax.faces.webapp.FacesServlet.service(FacesServlet.java:140)
       at com.hms.view.utils.CustomFacesServlet.service(CustomFacesServlet.java:48)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
       at org.ajax4jsf.framework.ajax.xmlfilter.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:67)
       at org.ajax4jsf.framework.ajax.xmlfilter.BaseFilter.doFilter(BaseFilter.java:223)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
       at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:687)
       at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:469)
       at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:403)
       at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:301)
       at org.apache.jasper.runtime.PageContextImpl.doForward(PageContextImpl.java:699)
       at org.apache.jasper.runtime.PageContextImpl.forward(PageContextImpl.java:670)
       at org.apache.jsp.jsp.index_jsp._jspService(index_jsp.java:56)
       at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
       at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
       at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:387)
       at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
       at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
       at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
       at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
       at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
       at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
       at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
       at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
       at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
       at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
       at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
       at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
       at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:241)
       at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
       at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:580)
       at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
       at java.lang.Thread.run(Thread.java:595)
      2007-07-02 01:19:39,468 INFO [org.apache.myfaces.shared_tomahawk.config.MyfacesConfig] No context init parameter 'org.apache.myfaces.READONLY_AS_DISABLED_FOR_SELECTS' found, using default value true
      2007-07-02 01:19:39,468 INFO [org.apache.myfaces.shared_tomahawk.config.MyfacesConfig] No context init parameter 'org.apache.myfaces.RESOURCE_VIRTUAL_PATH' found, using default value /faces/myFacesExtensionR
      source
      



      Ok, next:
      I changed web.xml and put context parameter which point Jboss to not use built in JSF Impl
      I saw the error again.

      During deployment of both version were not any errors.
      Errors happened on calling of JSF views.

      What I did wrong?





        • 1. Re: Migrating JSF app from JBOSS AS 4.0.5 to 4.2.0
          Anton Anton Newbie

          Is it possible that only I have this trouble???

          • 2. Re: Migrating JSF app from JBOSS AS 4.0.5 to 4.2.0
            Roberto Parra Newbie

            You are trying to request a .jsp without inicialize the faces contex, try
            in web.xml
            <servlet-mapping>
            <servlet-name>Faces Servlet</servlet-name>
            <url-pattern>/faces/*</url-pattern>
            </servlet-mapping>

            and set the prefix faces/[your jsp]

            • 3. Re: Migrating JSF app from JBOSS AS 4.0.5 to 4.2.0
              Anton Anton Newbie

              Ok, I will try this...

              • 4. Re: Migrating JSF app from JBOSS AS 4.0.5 to 4.2.0
                Anton Anton Newbie

                Ok, next approach:
                prehistory
                JBoss 4.0.5
                MyFaces 1.1 + Tomahawk 1.6 - everything is fine and work

                trying
                JBoss 4.2.1 - internal JSF 1.2 RI + Tomahawk 1.6

                tiles definition

                <?xml version="1.0"?>
                <!DOCTYPE tiles-definitions PUBLIC
                 "-//Apache Software Foundation//DTD Tiles Configuration 1.1//EN"
                 "http://jakarta.apache.org/struts/dtds/tiles-config_1_1.dtd">
                <tiles-definitions>
                 <definition name="login.tiles" path="/jsp/component/mainlogin.jsp" />
                </tiles-definitions>



                web.xml
                <?xml version="1.0" encoding="UTF-8"?>
                <web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
                 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                 xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
                 <context-param>
                 <param-name>javax.faces.CONFIG_FILES</param-name>
                 <param-value>
                 /WEB-INF/config/faces-config.xml
                 </param-value>
                 </context-param>
                 <!-- Tiles ViewHandler config file -->
                 <context-param>
                 <param-name>tiles-definitions</param-name>
                 <param-value>
                 /WEB-INF/config/faces-tiles.xml
                 </param-value>
                 </context-param>
                 <servlet>
                 <servlet-name>Faces Servlet</servlet-name>
                 <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
                 </servlet>
                 <servlet-mapping>
                 <servlet-name>Faces Servlet</servlet-name>
                 <url-pattern>*.jsf</url-pattern>
                 </servlet-mapping>
                 <filter>
                 <filter-name>richfaces</filter-name>
                 <filter-class>org.ajax4jsf.Filter</filter-class>
                 </filter>
                 <filter-mapping>
                 <filter-name>richfaces</filter-name>
                 <servlet-name>Faces Servlet</servlet-name>
                 <dispatcher>REQUEST</dispatcher>
                 <dispatcher>FORWARD</dispatcher>
                 <dispatcher>INCLUDE</dispatcher>
                 </filter-mapping>
                 <filter>
                 <filter-name>extensionsFilter</filter-name>
                 <filter-class>org.apache.myfaces.webapp.filter.ExtensionsFilter</filter-class>
                 <init-param>
                 <param-name>uploadMaxFileSize</param-name>
                 <param-value>100m</param-value>
                 </init-param>
                 <init-param>
                 <param-name>uploadThresholdSize</param-name>
                 <param-value>100k</param-value>
                 </init-param>
                 </filter>
                
                 <filter-mapping>
                 <filter-name>extensionsFilter</filter-name>
                 <url-pattern>*.jsf</url-pattern>
                 </filter-mapping>
                
                </web-app>


                /jsp/component/mainlogin.jsp
                <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
                <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
                1
                <f:view> 2
                 <h:form> 3
                 <h:outputText value="Enter your name:"/>
                 </h:form>
                </f:view>


                faces-config.xml

                <?xml version="1.0"?>
                <faces-config xmlns="http://java.sun.com/xml/ns/javaee"
                 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                 xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/j2ee/web-facesconfig_1_2.xsd"
                 version="1.2">
                 <application>
                 <view-handler>org.apache.myfaces.tomahawk.application.jsp.JspTilesViewHandlerImpl</view-handler>
                 </application>
                </faces-config>


                During deployment all is fine, but when I invoke
                http://localhost/app/login.jsf , I see only single "1", which are writed before
                f:view
                tag - I assume content of the tag was not rendered.

                So what is wrong?