Uploaded image for project: 'Tapestry'
  1. Tapestry
  2. TAPESTRY-763

RequestCycle is not available during page initialization

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 4.0
    • Fix Version/s: 4.0
    • Component/s: Framework
    • Labels:
      None

      Description

      I have a page with a property defined as such:

      <property name="query" initial-value="spring('resourceQuery')" />

      This was my simple way to inject Spring services in 3.0 pages. This just uses the requestcycle to get access to the ServletContext and look up the named bean in the Spring Context associated with the ServletContext. Unfortunately it looks like AbstractPage.getRequestCycle() is returning null when the page is being constructed.

      java.lang.NullPointerException

      1. com.webify.framework.bsc.BscPage.getCurrentServletContext(BscPage.java:145)
      2. com.webify.framework.bsc.BscPage.getSpringContext(BscPage.java:137)
      3. com.webify.framework.bsc.BscPage.spring(BscPage.java:66)
      4. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      5. sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java(Compiled Code))
      6. sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java(Compiled Code))
      7. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java(Compiled Code))
      8. java.lang.reflect.Method.invoke(Method.java(Compiled Code))
      9. ognl.OgnlRuntime.invokeMethod(OgnlRuntime.java:491)
      10. ognl.OgnlRuntime.callAppropriateMethod(OgnlRuntime.java:785)
      11. ognl.ObjectMethodAccessor.callMethod(ObjectMethodAccessor.java:61)
      12. ognl.OgnlRuntime.callMethod(OgnlRuntime.java:819)
      13. ognl.ASTMethod.getValueBody(ASTMethod.java:75)
      14. ognl.SimpleNode.evaluateGetValueBody(SimpleNode.java:170)
      15. ognl.SimpleNode.getValue(SimpleNode.java:210)
      16. ognl.Ognl.getValue(Ognl.java:333)
      17. ognl.Ognl.getValue(Ognl.java:310)
      18. org.apache.tapestry.services.impl.ExpressionEvaluatorImpl.readCompiled(ExpressionEvaluatorImpl.java:91)
      19. $ExpressionEvaluator_107a1397f6e.readCompiled($ExpressionEvaluator_107a1397f6e.java)
      20. org.apache.tapestry.binding.ExpressionBinding.resolveExpression(ExpressionBinding.java:110)
      21. org.apache.tapestry.binding.ExpressionBinding.getObject(ExpressionBinding.java:103)
      22. org.apache.tapestry.binding.AbstractBinding.getObject(AbstractBinding.java:87)
      23. $SearchPage_25.finishLoad($SearchPage_25.java)
      24. org.apache.tapestry.pageload.PageLoader.constructComponent(PageLoader.java:424)
      25. org.apache.tapestry.pageload.PageLoader.loadPage(PageLoader.java:593)
      26. $IPageLoader_107a1397f01.loadPage($IPageLoader_107a1397f01.java)
      27. $IPageLoader_107a1397f02.loadPage($IPageLoader_107a1397f02.java)
      28. org.apache.tapestry.pageload.PageSource.getPage(PageSource.java:118)
      29. $IPageSource_107a1397e6d.getPage($IPageSource_107a1397e6d.java)
      30. org.apache.tapestry.engine.RequestCycle.loadPage(RequestCycle.java:265)
      31. org.apache.tapestry.engine.RequestCycle.getPage(RequestCycle.java:248)
      32. org.apache.tapestry.engine.RequestCycle.activate(RequestCycle.java:609)

        Attachments

          Activity

            People

            • Assignee:
              hlship Howard M. Lewis Ship
              Reporter:
              mperham Mike Perham
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: