3 Replies Latest reply on Jul 25, 2013 8:23 AM by jaikiran

    MyFaces on 7.2.0

    nickarls

      Hi,

       

        I'm having trouble running the ICEfaces showcase with MyFaces on 7.1.2. This is what I've done

       

      * Start with a fresh EAP 6.1.0.Alpha

      * Started with install-myfaces-2.1.8.cli.zip from https://community.jboss.org/wiki/DesignOfAS7Multi-JSFFeature (edited absolute paths into the files since on Windows it assumes C:\, changed the jsf injection lib to .Final since the SNAPSHOT was no longer compatible

      * Set default-jsf-impl-slot="myfaces-2.1.8" in the JSF subsystem

      * Remove the faces.jar from the showcase demo and deploy it.

       

      On access I get

       

       

      08:34:01,610 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/showcase].[Faces Servlet]] (http-/127.0.0.1:8080-1) JBWEB000236: Servlet.service() for servlet Faces Servlet threw exception: java.lang.NullPointerException
                at org.apache.myfaces.shared.renderkit.html.util.ResourceUtils.renderDefaultJsfJsInlineIfNecessary(ResourceUtils.java:228) [myfaces-impl-2.1.8.jar:2.1.8]
                at org.apache.myfaces.shared.renderkit.html.HtmlLinkRendererBase.encodeBegin(HtmlLinkRendererBase.java:131) [myfaces-impl-2.1.8.jar:2.1.8]
                at javax.faces.component.UIComponentBase.encodeBegin(UIComponentBase.java:585) [myfaces-api-2.1.8.jar:2.1.8]
                at javax.faces.component.UIComponentBase.encodeAll(UIComponentBase.java:515) [myfaces-api-2.1.8.jar:2.1.8]
                at org.apache.myfaces.view.facelets.component.RepeatRenderer.encodeChildren(RepeatRenderer.java:78) [myfaces-impl-2.1.8.jar:2.1.8]
                at org.apache.myfaces.view.facelets.component.UIRepeat.process(UIRepeat.java:909) [myfaces-impl-2.1.8.jar:2.1.8]
                at org.apache.myfaces.view.facelets.component.UIRepeat.encodeChildren(UIRepeat.java:1587) [myfaces-impl-2.1.8.jar:2.1.8]
                at com.icesoft.faces.renderkit.dom_html_basic.DomBasicRenderer.encodeParentAndChildren(DomBasicRenderer.java:335) [icefaces-compat.jar:]
                at com.icesoft.faces.renderkit.dom_html_basic.GroupRenderer.encodeChildren(GroupRenderer.java:79) [icefaces-compat.jar:]
                at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:632) [myfaces-api-2.1.8.jar:2.1.8]
                at javax.faces.component.UIComponentBase.encodeAll(UIComponentBase.java:530) [myfaces-api-2.1.8.jar:2.1.8]
                at org.apache.myfaces.view.facelets.component.RepeatRenderer.encodeChildren(RepeatRenderer.java:78) [myfaces-impl-2.1.8.jar:2.1.8]
                at org.apache.myfaces.view.facelets.component.UIRepeat.process(UIRepeat.java:909) [myfaces-impl-2.1.8.jar:2.1.8]
                at org.apache.myfaces.view.facelets.component.UIRepeat.encodeChildren(UIRepeat.java:1587) [myfaces-impl-2.1.8.jar:2.1.8]
                at javax.faces.component.UIComponentBase.encodeAll(UIComponentBase.java:530) [myfaces-api-2.1.8.jar:2.1.8]
                at javax.faces.component.UIComponentBase.encodeAll(UIComponentBase.java:539) [myfaces-api-2.1.8.jar:2.1.8]
                at org.apache.myfaces.shared.renderkit.RendererUtils.renderChildren(RendererUtils.java:693) [myfaces-impl-2.1.8.jar:2.1.8]
                at org.apache.myfaces.shared.renderkit.html.HtmlGroupRendererBase.encodeEnd(HtmlGroupRendererBase.java:115) [myfaces-impl-2.1.8.jar:2.1.8]
                at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:663) [myfaces-api-2.1.8.jar:2.1.8]
                at javax.faces.component.UIComponentBase.encodeAll(UIComponentBase.java:543) [myfaces-api-2.1.8.jar:2.1.8]
                at org.apache.myfaces.shared.renderkit.RendererUtils.renderChildren(RendererUtils.java:693) [myfaces-impl-2.1.8.jar:2.1.8]
                at org.apache.myfaces.shared.renderkit.html.HtmlGroupRendererBase.encodeEnd(HtmlGroupRendererBase.java:115) [myfaces-impl-2.1.8.jar:2.1.8]
                at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:663) [myfaces-api-2.1.8.jar:2.1.8]
                at javax.faces.component.UIComponentBase.encodeAll(UIComponentBase.java:543) [myfaces-api-2.1.8.jar:2.1.8]
                at org.apache.myfaces.shared.renderkit.RendererUtils.renderChildren(RendererUtils.java:693) [myfaces-impl-2.1.8.jar:2.1.8]
                at org.apache.myfaces.shared.renderkit.html.HtmlGroupRendererBase.encodeEnd(HtmlGroupRendererBase.java:115) [myfaces-impl-2.1.8.jar:2.1.8]
                at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:663) [myfaces-api-2.1.8.jar:2.1.8]
                at javax.faces.component.UIComponentBase.encodeAll(UIComponentBase.java:543) [myfaces-api-2.1.8.jar:2.1.8]
                at org.apache.myfaces.shared.renderkit.RendererUtils.renderChildren(RendererUtils.java:693) [myfaces-impl-2.1.8.jar:2.1.8]
                at org.apache.myfaces.shared.renderkit.html.HtmlGroupRendererBase.encodeEnd(HtmlGroupRendererBase.java:115) [myfaces-impl-2.1.8.jar:2.1.8]
                at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:663) [myfaces-api-2.1.8.jar:2.1.8]
                at javax.faces.component.UIComponentBase.encodeAll(UIComponentBase.java:543) [myfaces-api-2.1.8.jar:2.1.8]
                at javax.faces.component.UIComponentBase.encodeAll(UIComponentBase.java:539) [myfaces-api-2.1.8.jar:2.1.8]
                at javax.faces.component.UIComponentBase.encodeAll(UIComponentBase.java:539) [myfaces-api-2.1.8.jar:2.1.8]
                at org.apache.myfaces.view.facelets.FaceletViewDeclarationLanguage.renderView(FaceletViewDeclarationLanguage.java:1972) [myfaces-impl-2.1.8.jar:2.1.8]
                at org.apache.myfaces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:285) [myfaces-impl-2.1.8.jar:2.1.8]
                at org.apache.myfaces.lifecycle.RenderResponseExecutor.execute(RenderResponseExecutor.java:116) [myfaces-impl-2.1.8.jar:2.1.8]
                at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:241) [myfaces-impl-2.1.8.jar:2.1.8]
                at javax.faces.webapp.FacesServlet.service(FacesServlet.java:199) [myfaces-api-2.1.8.jar:2.1.8]
                at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:295) [jbossweb-7.2.0.Final.jar:7.2.0.Final]
                at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214) [jbossweb-7.2.0.Final.jar:7.2.0.Final]
                at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230) [jbossweb-7.2.0.Final.jar:7.2.0.Final]
                at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:149) [jbossweb-7.2.0.Final.jar:7.2.0.Final]
                at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:169) [jboss-as-web-7.2.0.Alpha1-redhat-4.jar:7.2.0.Alpha1-redhat-4]
                at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:145) [jbossweb-7.2.0.Final.jar:7.2.0.Final]
                at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:97) [jbossweb-7.2.0.Final.jar:7.2.0.Final]
                at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:102) [jbossweb-7.2.0.Final.jar:7.2.0.Final]
                at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:336) [jbossweb-7.2.0.Final.jar:7.2.0.Final]
                at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856) [jbossweb-7.2.0.Final.jar:7.2.0.Final]
                at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:653) [jbossweb-7.2.0.Final.jar:7.2.0.Final]
                at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:920) [jbossweb-7.2.0.Final.jar:7.2.0.Final]
                at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0_07]
      
      

       

      The stacktrace does include myfaces so I think for some part it is recognized.

      It's of course a possibility that the showcase has some bug but it is known to work with mojarra and myfaces on tomcats OOTB.

       

      Where to start looking?

        • 1. Re: MyFaces on 7.2.0
          jaikiran

          Based on that stacktrace the only object that can be null on that line is "resource" http://grepcode.com/file/repo1.maven.org/maven2/org.apache.myfaces.core.internal/myfaces-impl-shared/2.1.8/org/apache/myfaces/shared/renderkit/html/util/ResourceUtils.java/#228 which is being created on line 223. So you might have to figure out why it's being created as null.

          • 2. Re: MyFaces on 7.2.0
            nickarls

            One mailing list archive had a similar post saying

             

            > The problem presented here is related to the custom OSGi setup used. In

            > theory, the default ResourceHandler implementation uses the Thread Context

            > Class Loader (TCCL) to load its resources. That includes everything inside

            > META-INF/resources and for MyFaces everything inside

            > META-INF/internal-resources, but across jar files. OSGi by default does not

            > set the TCCL, but MyFaces expects that, so the problem finally appears.

            >

            > The first consideration is the fix on the manifest proposed is questionable.

            > At start META-INF/resources/javax.faces is not a java package!. Why should

            > MyFaces export that as a package?. That just does not make sense. Even if it

            > works, it is a quick fix that does not solves the main problem.

            >

            > The problem is similar to the one with OSGi and SPI interfaces (scan files

            > through META-INF/services in different jars using a discovery mechanism). To

            > solve this problem in a friendly way, MyFaces has a new interface called

            > org.apache.myfaces.spi.ServiceProviderFinder, so users can implement this

            > interface to help MyFaces to find the files through bundles.

             

            Even if it's not OSGI in this cases, but it does speak of TCCLs

            • 3. Re: MyFaces on 7.2.0
              jaikiran

              I wonder if this can be worked around if you add a filter (with an appropriate filter mapping) in there which would switch the TCCL to the application class' classloader being letting the call proceed and then resetting it back to the orignal TCCL. The filter would have to run before the control reaches FacesServlet, in that stacktrace.

               

              That might tell us whether this is really some kind of incorrect TCCL issue.