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

Misleading Artifact Coordinates message for ResourceResolverType.JCR_OAK

    XMLWordPrintableJSON

Details

    Description

      When you create a SlingContext using ResourceResolverType.JCR_OAK you get the following error if you do not have the required dependency:

      java.lang.RuntimeException: Unable to initialize JCR_OAK resource resolver factory: Unable to instantiate resourcer resolver: org.apache.sling.testing.mock.sling.oak.OakMockResourceResolverAdapter. Make sure this maven dependency is included: org.apache.sling:org.apache.sling.testing.sling-mock-jackrabbit-oak

      The message contains the groupId and artifactId of the dependency you are supposed to add to your project:

      org.apache.sling:org.apache.sling.testing.sling-mock-jackrabbit-oak

      The problem is that this dependency does not seem to exist. I was able to solve this issue by adding the following dependency:

      <dependency>
          <groupId>org.apache.sling</groupId>
          <artifactId>org.apache.sling.testing.sling-mock-oak</artifactId>
          <version>2.0.2</version>
       </dependency>
      

      This dependency does include the class org.apache.sling.testing.mock.sling.oak.OakMockResourceResolverAdapter which is apparently the class that is supposed to be loaded by all of this.

      Therefore, I would propose to update the artifact coordinates in the error message.

      I added a demo project that can be used to re-produce this issue:

      1. Extract the attached archive
      2. Run mvn clean test
      3. Error occurs
      4. Uncomment dependency in pom.xml
      5. Run mvn clean test
      6. Error is gone

      Attachments

        1. sling-7189.patch
          0.9 kB
          Jens Lauterbach
        2. sling-7189-code.zip
          6 kB
          Jens Lauterbach

        Activity

          People

            sseifert Stefan Seifert
            jenslauterbach Jens Lauterbach
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: