4 Replies Latest reply on Dec 14, 2010 2:32 AM by desertrose_ik

    JBoss 4.2.2 with myfaces - java.lang.RuntimeException: Canno

    javatwo

      Everything is runing well in JBoss 4.0.5GA with myfaces.

      For JBoss 4.2.2GA, I uses myfaces jars bundled in web-inf/lib and add the following in web.xml, and remove all libs under jsf-libs.

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

      I got the following exception: Thanks for help.

      java.lang.RuntimeException: Cannot find FacesContext
      at javax.faces.webapp.UIComponentClassicTagBase.getFacesContext(UIComponentClassicTagBase.java:1835)
      at javax.faces.webapp.UIComponentClassicTagBase.setJspId(UIComponentClassicTagBase.java:1652)
      at org.apache.jsp.index_jsp._jspx_meth_f_005fview_005f0(index_jsp.java:124)
      at org.apache.jsp.index_jsp._jspService(index_jsp.java:93)
      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:373)
      at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:336)
      at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
      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:654)
      at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:445)
      at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:379)
      at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:292)
      at org.apache.myfaces.context.servlet.ServletExternalContextImpl.dispatch(ServletExternalContextImpl.java:419)
      at org.apache.myfaces.application.jsp.JspViewHandlerImpl.renderView(JspViewHandlerImpl.java:211)
      at org.ajax4jsf.framework.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:108)
      at org.ajax4jsf.framework.ajax.AjaxViewHandler.renderView(AjaxViewHandler.java:229)
      at org.ajax4jsf.framework.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:108)
      at org.ajax4jsf.framework.ajax.AjaxViewHandler.renderView(AjaxViewHandler.java:229)
      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 org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)

        • 1. Re: JBoss 4.2.2 with myfaces - java.lang.RuntimeException: C
          jaikiran

          I dont have experience with JSF. Based on the wiki entry at http://wiki.jboss.org/wiki/Wiki.jsp?page=JBoss5AndMyFaces

          There is no technical reason to use MyFaces Core on JBoss 4.2 or JBoss 5.x. But there are other reasons you might want to bundle it with your WAR. For instance, you might have an old JSF application that already uses MyFaces and you don't want to retest your app on a new JSF implementation. In that case, you can bundle the JSF implementation with your WAR and add this to your web.xml:
          <context-param>
           <param-name>org.jboss.jbossfaces.WAR_BUNDLES_JSF_IMPL</param-name>
           <param-value>true</param-value>
          </context-param>


          This will cause JBoss to ignore the built-in JSF implementation as long as you use the default classloader settings. If you declare a classloader in jboss-web.xml or set useJBossWebLoader = true then the above <context-param> will not work.


          So have you declared your own classloder for your application, which might be the reason why its not working.


          • 2. Re: JBoss 4.2.2 with myfaces - java.lang.RuntimeException: C
            javatwo

            I did not define my own classloader.
            Actually I followed the same instruction you specified.

            • 3. Re: JBoss 4.2.2 with myfaces - java.lang.RuntimeException: C
              michele.curioni

              Although this post is quite old, I see there is no final solution, so I'll post something I discovered:

              - when I deploy the war as part of an ear file, I could not get it to work;
              - when I deploy the way file separately, it works as long as I don't specify a <context-root> in jboss-web.xml.

              It seems as if when you specify a context-root, JBoss behaves as if you specified your own classloader (don't quote me on this...)
              Same for when the war is deployed inside a ear.

              Hope this helps
              Regards.
              Michele


              • 4. Re: JBoss 4.2.2 with myfaces - java.lang.RuntimeException: C
                desertrose_ik

                Hi Dave,

                I hope you got solution for your problem. I just posted who has same problem.

                 

                I used myfaces1.2.9. Its working with following solution.

                 

                insert in application web.xml

                 

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

                 

                 

                 

                 

                 

                comment below code in   jboss-4.2.2.GA\server\all\deploy\jboss-web.deployer\conf\web.xml file

                and  jboss-4.2.2.GA\server\default\deploy\jboss-web.deployer\conf\web.xml file

                <listener>
                     <listener-class>org.jboss.web.jsf.integration.config.JBossJSFConfigureListener</listener-class>
                </listener>

                 

                <listener>
                     <listener-class>com.sun.faces.application.WebappLifecycleListener</listener-class>
                </listener>

                 

                <init-param>
                           <description>JSF standard tlds</description>
                           <param-name>tagLibJar0</param-name>
                           <param-value>jsf-libs/jsf-impl.jar</param-value>
                        </init-param>
                        <init-param>
                           <description>JSTL standard tlds</description>
                           <param-name>tagLibJar1</param-name>
                           <param-value>jstl.jar</param-value>
                        </init-param>

                 

                Regards,

                Irfan