Sling
  1. Sling
  2. SLING-1414

JSP Expression Language (eg: "${resource.path}") to call the getPath() method of a Resource object returned by ResourceResolver.findResources() result in error.

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: JCR Resource 2.0.6
    • Fix Version/s: JCR Resource 2.0.8
    • Component/s: JCR
    • Labels:
      None
    • Environment:
      CQ5.2.1/CQ5.3

      Description

      Often in the JSPs, we call the ResourceResolver.findResources(query, "xpath") method to return an Iterator<Resource> object, which we iterate through using JSTL and EL syntax. When we attempt to access the getPath() method of each Resource, the following exception is thrown:

      java.lang.IllegalAccessException: Class javax.el.BeanELResolver can not access a member of class org.apache.sling.jcr.resource.internal.helper.jcr.JcrItemResource with modifiers "public".

      This works with CQ5.2.1 with no problem before. The issue happens on CQ5.3 GA release.

      Example codes to re-produce the error in CQ5.3.

      Iterator<Resource> found = resourceResolver.findResources("//element(*, nt:unstructured)","xpath");
      while(found.hasNext()){
      try{
      Resource foundResource = found.next();
      pageContext.setAttribute("foundResource", foundResource);
      %>$

      {foundResource.path}

      <%
      }
      catch(Exception e)

      { %><%=e.getMessage()%><% }

      }

        Activity

        Gavin made changes -
        Workflow re-open possible,doc-test-required [ 12789924 ] no-reopen-closed,doc-test-required [ 12791790 ]
        Gavin made changes -
        Workflow no-reopen-closed,doc-test-required [ 12767856 ] re-open possible,doc-test-required [ 12789924 ]
        Gavin made changes -
        Workflow Copy of no-reopen-closed,doc-test-required [ 12765097 ] no-reopen-closed,doc-test-required [ 12767856 ]
        Gavin made changes -
        Workflow no-reopen-closed,doc-test-required [ 12500417 ] Copy of no-reopen-closed,doc-test-required [ 12765097 ]
        Carsten Ziegeler made changes -
        Status Resolved [ 5 ] Closed [ 6 ]
        Felix Meschberger made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Fix Version/s JCR Resource 2.0.8 [ 12314286 ]
        Resolution Fixed [ 1 ]
        Felix Meschberger made changes -
        Assignee Felix Meschberger [ fmeschbe ]
        Carsten Ziegeler made changes -
        Field Original Value New Value
        Affects Version/s JCR Resource 2.0.6 [ 12313960 ]
        zhangchunlong created issue -

          People

          • Assignee:
            Felix Meschberger
            Reporter:
            zhangchunlong
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development