Uploaded image for project: 'Sling'
  1. Sling
  2. SLING-1708

contrib/scripting/velocity is missing suitable resourceloader for the JCR

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • Scripting Velocity 2.0.0
    • Scripting
    • None
    • Felix 1.4, Sling 2.0.7, Apache Velocity 1.6.2

    Description

      Affects: Rev. 989119 of https://svn.apache.org/repos/asf/sling/trunk/contrib/scripting/velocity (2.0.0-SNAPSHOT)

      The velocity resource manager (org.apache.velocity.runtime.resource.ResourceManagerImpl) has, by default, only an org.apache.velocity.runtime.resource.loader.FileResourceLoader instance. This resourceloader cannot load resources JCR resources as it attempts to access the filesystem.

      To reproduce, simply create a .vlt script and add an include directive:

      template1.vlt:
      #include("/path/to/template2.vlt")

      This will fail:

      org.apache.velocity.exception.ResourceNotFoundException: Unable to find resource '/path/to/template2.vlt'
      at org.apache.velocity.runtime.resource.ResourceManagerImpl.loadResource(ResourceManagerImpl.java:483)
      at org.apache.velocity.runtime.resource.ResourceManagerImpl.getResource(ResourceManagerImpl.java:354)
      at org.apache.velocity.runtime.RuntimeInstance.getContent(RuntimeInstance.java:1445)
      at org.apache.velocity.runtime.directive.Include.renderOutput(Include.java:229)
      at org.apache.velocity.runtime.directive.Include.render(Include.java:155)
      at org.apache.velocity.runtime.parser.node.ASTDirective.render(ASTDirective.java:175)
      at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:336)
      at org.apache.velocity.runtime.RuntimeInstance.render(RuntimeInstance.java:1277)
      at org.apache.velocity.runtime.RuntimeInstance.evaluate(RuntimeInstance.java:1216)

      A suitable resource loader should be provided to the VelocityEngine instance (perhaps in the VelocityTemplatesScriptEngine).

      Attachments

        Activity

          People

            mykee Mike Müller
            o.otto Olaf Otto
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - 4h
                4h
                Remaining:
                Remaining Estimate - 4h
                4h
                Logged:
                Time Spent - Not Specified
                Not Specified