ICEfaces
  1. ICEfaces
  2. ICE-1084

Seam: sample seam app produces an NPE when using debug.seam

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.5.1
    • Fix Version/s: 1.6DR#3, 1.6
    • Component/s: Framework
    • Labels:
      None
    • Environment:
      Operating System: Windows XP
      Platform: PC

      Description

      noted in the forum: http://www.icefaces.org/JForum/posts/list/3071.page

      using debug.seam in the demo app produces the enhanceAndFixDocument NPE when
      html Element is null.

      java.lang.NullPointerException
       com.icesoft.faces.context.DOMResponseWriter.enhanceAndFixDocument(DOMResponseWriter.java:394)
       com.icesoft.faces.context.DOMResponseWriter.writeDOM(DOMResponseWriter.java:312)
       com.icesoft.faces.application.D2DViewHandler.renderView(D2DViewHandler.java:161)
      ...

        Issue Links

          Activity

          Hide
          Mark Collette added a comment -

          I have yet to try this with the 1.5.x branch, but with the HEAD code and newest
          Seam release, we get a totally different situation. Basically, the debug.seam
          or debug.jsf page will show, but the output is garbled.

          Comparing the dvdstore app (with ICEfaces) with the hibernate app (without
          ICEfaces) shows that the stock JSF components, like h:outputText and
          h:dataTable, are not being rendered. I found that
          org.jboss.seam.debug.jsf.SeamDebugPhaseListener is responsible for serving out
          the applications\jboss-seam-1.1.0.BETA2\src\debug\META-INF\debug.xhtml file
          using Facelets directly, instead of using the ViewHandler mechanism. This
          PhaseListener is auto-wired by
          applications\jboss-seam-1.1.0.BETA2\src\debug\META-INF\faces-config.xml

          I think that the easiest approach will be to make a Seam
          com.sun.facelets.impl.ResourceResolver that knows how to get at this
          debug.xhtml file, and just use the existing facelets.RESOURCE_RESOLVER
          parameter to access it.

          Some sort of chaining of ResourceResolvers should be done, so that apps with an
          existing ResourceResolver will work. My preference would be for Facelets core
          to alter its use of the facelets.RESOURCE_RESOLVER parameter, to treat it as
          an ordered list of ResourceResolvers, much like how the facelets.LIBRARIES and
          facelets.DECORATORS parameters work.

          In the immediate term, to simplify my proof of concept code, I will add a second
          parameter called seam.RESOURCE_RESOLVER which
          org.jboss.seam.debug.jsf.SeamDebugResourceResolver will delegate to.

          So, to recap, here are some configuration examples:

          Current way, with a custom ResourceResolver:

          web.xml
          <context-param>
          <param-name>facelets.RESOURCE_RESOLVER</param-name>
          <param-value>com.mycompany.CustomResourceResolver</param-value>
          </context-param>

          Short-term solution, with Seam debug ResourceResolver, and no other custom
          ResourceResolver:

          web.xml
          <context-param>
          <param-name>facelets.RESOURCE_RESOLVER</param-name>
          <param-value>org.jboss.seam.debug.jsf.SeamDebugResourceResolver</param-value>
          </context-param>

          Short-term solution, with Seam debug ResourceResolver, and a custom
          ResourceResolver:

          web.xml
          <context-param>
          <param-name>facelets.RESOURCE_RESOLVER</param-name>
          <param-value>org.jboss.seam.debug.jsf.SeamDebugResourceResolver</param-value>
          </context-param>
          <context-param>
          <param-name>seam.RESOURCE_RESOLVER</param-name>
          <param-value>com.mycompany.CustomResourceResolver</param-value>
          </context-param>

          Long-term solution, with Seam debug ResourceResolver, and a custom
          ResourceResolver, chained:

          web.xml
          <context-param>
          <param-name>facelets.RESOURCE_RESOLVER</param-name>

          <param-value>org.jboss.seam.debug.jsf.SeamDebugResourceResolver;com.mycompany.CustomResourceResolver</param-value>
          </context-param>

          Show
          Mark Collette added a comment - I have yet to try this with the 1.5.x branch, but with the HEAD code and newest Seam release, we get a totally different situation. Basically, the debug.seam or debug.jsf page will show, but the output is garbled. Comparing the dvdstore app (with ICEfaces) with the hibernate app (without ICEfaces) shows that the stock JSF components, like h:outputText and h:dataTable, are not being rendered. I found that org.jboss.seam.debug.jsf.SeamDebugPhaseListener is responsible for serving out the applications\jboss-seam-1.1.0.BETA2\src\debug\META-INF\debug.xhtml file using Facelets directly, instead of using the ViewHandler mechanism. This PhaseListener is auto-wired by applications\jboss-seam-1.1.0.BETA2\src\debug\META-INF\faces-config.xml I think that the easiest approach will be to make a Seam com.sun.facelets.impl.ResourceResolver that knows how to get at this debug.xhtml file, and just use the existing facelets.RESOURCE_RESOLVER parameter to access it. Some sort of chaining of ResourceResolvers should be done, so that apps with an existing ResourceResolver will work. My preference would be for Facelets core to alter its use of the facelets.RESOURCE_RESOLVER parameter, to treat it as an ordered list of ResourceResolvers, much like how the facelets.LIBRARIES and facelets.DECORATORS parameters work. In the immediate term, to simplify my proof of concept code, I will add a second parameter called seam.RESOURCE_RESOLVER which org.jboss.seam.debug.jsf.SeamDebugResourceResolver will delegate to. So, to recap, here are some configuration examples: Current way, with a custom ResourceResolver: web.xml <context-param> <param-name>facelets.RESOURCE_RESOLVER</param-name> <param-value>com.mycompany.CustomResourceResolver</param-value> </context-param> Short-term solution, with Seam debug ResourceResolver, and no other custom ResourceResolver: web.xml <context-param> <param-name>facelets.RESOURCE_RESOLVER</param-name> <param-value>org.jboss.seam.debug.jsf.SeamDebugResourceResolver</param-value> </context-param> Short-term solution, with Seam debug ResourceResolver, and a custom ResourceResolver: web.xml <context-param> <param-name>facelets.RESOURCE_RESOLVER</param-name> <param-value>org.jboss.seam.debug.jsf.SeamDebugResourceResolver</param-value> </context-param> <context-param> <param-name>seam.RESOURCE_RESOLVER</param-name> <param-value>com.mycompany.CustomResourceResolver</param-value> </context-param> Long-term solution, with Seam debug ResourceResolver, and a custom ResourceResolver, chained: web.xml <context-param> <param-name>facelets.RESOURCE_RESOLVER</param-name> <param-value>org.jboss.seam.debug.jsf.SeamDebugResourceResolver;com.mycompany.CustomResourceResolver</param-value> </context-param>
          Hide
          Mark Collette added a comment -

          Created an attachment (id=127)
          SeamDebugResourceResolver.java

          Replacement for SeamDebugPhaseListener.java

          Show
          Mark Collette added a comment - Created an attachment (id=127) SeamDebugResourceResolver.java Replacement for SeamDebugPhaseListener.java
          Hide
          Mark Collette added a comment -

          Yay, it works for me Here's what I did:

          1. Disable the SeamDebugPhaseListener by commenting out the lifecycle
          phase-listener block in
          applications\jboss-seam-1.1.0.BETA2\src\debug\META-INF\faces-config.xml

          2. Download the attched SeamDebugResourceResolver.java file, and save it to
          applications\jboss-seam-1.1.0.BETA2\src\debug\org\jboss\seam\debug\jsf\SeamDebugResourceResolver.java

          3. Tell the web app about SeamDebugResourceResolver. I added the following
          block to both
          applications\jboss-seam-1.1.0.BETA2\examples\dvdstore\resources\WEB-INF\web.xml
          and
          applications\jboss-seam-1.1.0.BETA2\examples\hibernate\resources\WEB-INF\web.xml

          <context-param>
          <param-name>facelets.RESOURCE_RESOLVER</param-name>
          <param-value>org.jboss.seam.debug.jsf.SeamDebugResourceResolver</param-value>
          </context-param>

          3. Rebuild Seam so that the change to the phase-listener will take effect.

          4. Build and deploy the web apps

          Show
          Mark Collette added a comment - Yay, it works for me Here's what I did: 1. Disable the SeamDebugPhaseListener by commenting out the lifecycle phase-listener block in applications\jboss-seam-1.1.0.BETA2\src\debug\META-INF\faces-config.xml 2. Download the attched SeamDebugResourceResolver.java file, and save it to applications\jboss-seam-1.1.0.BETA2\src\debug\org\jboss\seam\debug\jsf\SeamDebugResourceResolver.java 3. Tell the web app about SeamDebugResourceResolver. I added the following block to both applications\jboss-seam-1.1.0.BETA2\examples\dvdstore\resources\WEB-INF\web.xml and applications\jboss-seam-1.1.0.BETA2\examples\hibernate\resources\WEB-INF\web.xml <context-param> <param-name>facelets.RESOURCE_RESOLVER</param-name> <param-value>org.jboss.seam.debug.jsf.SeamDebugResourceResolver</param-value> </context-param> 3. Rebuild Seam so that the change to the phase-listener will take effect. 4. Build and deploy the web apps
          Hide
          Mark Collette added a comment -

          I posted my recommendation about this issue to the JBoss Seam forum:
          http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3994352#3994352

          And I also cross-posted it to a more ICEfaces specific thread:
          http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3991530#3991530

          And emailed the Facelets Dev mailing list:
          https://facelets.dev.java.net/servlets/BrowseList?listName=dev&from=2006-12-01&to=2006-12-31&count=18&by=date&paged=false

          Show
          Mark Collette added a comment - I posted my recommendation about this issue to the JBoss Seam forum: http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3994352#3994352 And I also cross-posted it to a more ICEfaces specific thread: http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3991530#3991530 And emailed the Facelets Dev mailing list: https://facelets.dev.java.net/servlets/BrowseList?listName=dev&from=2006-12-01&to=2006-12-31&count=18&by=date&paged=false
          Hide
          Ken Fyten added a comment -

          Mark,

          Do we have any code changes to correct this, or can this be closed in some fashion?

          Ken

          Show
          Ken Fyten added a comment - Mark, Do we have any code changes to correct this, or can this be closed in some fashion? Ken
          Hide
          Mark Collette added a comment -

          Right now discussions are ongoing in the JBoss Seam and Facelets Dev newsgroups
          about solutions for this. Currently it looks like my ResourceResolver is going
          to be paired with a backport of a Facelets 1.2 feature. I'm still monitoring
          and coordinating the situation.

          Show
          Mark Collette added a comment - Right now discussions are ongoing in the JBoss Seam and Facelets Dev newsgroups about solutions for this. Currently it looks like my ResourceResolver is going to be paired with a backport of a Facelets 1.2 feature. I'm still monitoring and coordinating the situation.
          Hide
          Mark Collette added a comment -

          This works with the latest 1.5.2 build JARs.

          Show
          Mark Collette added a comment - This works with the latest 1.5.2 build JARs.
          Hide
          Ken Fyten added a comment -

          This issue needs to be analyzed along with other Seam related issues and distilled to root causes.

          Show
          Ken Fyten added a comment - This issue needs to be analyzed along with other Seam related issues and distilled to root causes.
          Hide
          Mark Collette added a comment -

          I had to go to where the Lifecycle is created, in the Servlets, to access the PhaseListeners, to remove the default SeamDebugPhaseListener. Then, D2DFaceletViewHandler allowed a callback for chaining ResourceResolvers, so D2DSeamFaceletViewHandler could add SeamDebugResourceResolver to the beginning of the chain. This allows SeamDebugResourceResolver to access the Seam debug.xhtml file, via SeamDebugPhaseListener's ClassLoader.

          The point being, now it all works automatically, without any configuration changes, and without any Seam code changes.

          Subversion 13434 : Now the Seam debug page will work, without any user configuration required

          icefaces\core\src\com\icesoft\faces\facelets\SeamDebugResourceResolver.java
          icefaces\core\src\com\icesoft\util\SeamUtilities.java
          icefaces\core\src\com\icesoft\faces\webapp\http\core\ReceiveSendUpdates.java
          icefaces\core\src\com\icesoft\faces\webapp\http\core\PageServer.java
          icefaces\core\src\com\icesoft\faces\facelets\D2DSeamFaceletViewHandler.java
          icefaces\core\src\com\icesoft\faces\facelets\D2DFaceletViewHandler.java

          Show
          Mark Collette added a comment - I had to go to where the Lifecycle is created, in the Servlets, to access the PhaseListeners, to remove the default SeamDebugPhaseListener. Then, D2DFaceletViewHandler allowed a callback for chaining ResourceResolvers, so D2DSeamFaceletViewHandler could add SeamDebugResourceResolver to the beginning of the chain. This allows SeamDebugResourceResolver to access the Seam debug.xhtml file, via SeamDebugPhaseListener's ClassLoader. The point being, now it all works automatically, without any configuration changes, and without any Seam code changes. Subversion 13434 : Now the Seam debug page will work, without any user configuration required icefaces\core\src\com\icesoft\faces\facelets\SeamDebugResourceResolver.java icefaces\core\src\com\icesoft\util\SeamUtilities.java icefaces\core\src\com\icesoft\faces\webapp\http\core\ReceiveSendUpdates.java icefaces\core\src\com\icesoft\faces\webapp\http\core\PageServer.java icefaces\core\src\com\icesoft\faces\facelets\D2DSeamFaceletViewHandler.java icefaces\core\src\com\icesoft\faces\facelets\D2DFaceletViewHandler.java

            People

            • Assignee:
              Unassigned
              Reporter:
              Philip Breau
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: