Expand my Community achievements bar.

Unable to initialize JCR_MOCK resource resolver in Cloud Pipeline

Avatar

Level 1

Hi Geeks,

Getting below error for a Junit in cloud pipeline. Local build is working fine.

Please advice 

 

Unable to initialize JCR_MOCK resource resolver factory: Unable to invoke method 'activate' for class org.apache.sling.testing.mock.sling.MockJcrSlingRepository
Caused by: java.lang.RuntimeException: Unable to invoke method 'activate' for class org.apache.sling.testing.mock.sling.MockJcrSlingRepository
Caused by: java.lang.UnsupportedClassVersionError: org/apache/jackrabbit/api/observation/JackrabbitObservationManager has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0

 

java.lang.RuntimeException: Unable to initialize JCR_MOCK resource resolver factory: Unable to invoke method 'activate' for class org.apache.sling.testing.mock.sling.MockJcrSlingRepository
Caused by: java.lang.RuntimeException: Unable to invoke method 'activate' for class org.apache.sling.testing.mock.sling.MockJcrSlingRepository
Caused by: java.lang.UnsupportedClassVersionError: org/apache/sling/testing/mock/jcr/MockObservationManager

 

 

below is my project POM dependency 

 

 

<dependency>                
        <groupId>org.junit</groupId>
        <artifactId>junit-bom</artifactId>
        <version>5.8.2</version>
        <type>pom</type>
        <scope>import</scope>
      </dependency>
      <dependency>
        <groupId>org.mockito</groupId>
        <artifactId>mockito-core</artifactId>
        <version>4.1.0</version>
        <scope>test</scope>
      </dependency>
      <dependency>
        <groupId>org.mockito</groupId>
        <artifactId>mockito-junit-jupiter</artifactId>
        <version>4.1.0</version>
        <scope>test</scope>
      </dependency>
      <dependency>
        <groupId>junit-addons</groupId>
        <artifactId>junit-addons</artifactId>
        <version>1.4</version>
        <scope>test</scope>
      </dependency>
      <dependency>
        <groupId>io.wcm</groupId>
        <artifactId>io.wcm.testing.aem-mock.junit5</artifactId>
        <version>5.1.2</version>
        <scope>test</scope>
        <exclusions>
          <exclusion>
            <groupId>org.apache.sling</groupId>
            <artifactId>org.apache.sling.scripting.api</artifactId>
          </exclusion>
        </exclusions>
      </dependency>
      <dependency>
        <groupId>org.apache.sling</groupId>
        <artifactId>org.apache.sling.testing.caconfig-mock-plugin</artifactId>
        <version>1.4.0</version>
        <exclusions>
          <exclusion>
            <groupId>commons-collections</groupId>
            <artifactId>commons-collections</artifactId>
          </exclusion>
        </exclusions>
      </dependency>
      <dependency>
        <groupId>commons-collections</groupId>
        <artifactId>commons-collections</artifactId>
        <version>3.2.2</version>
        <scope>provided</scope>
      </dependency>
      <dependency>
        <groupId>com.adobe.cq</groupId>              
        <artifactId>core.wcm.components.testing.aem-mock-plugin</artifactId>              
        <version>${core.wcm.components.version}</version>                
        <scope>test</scope>                
        <exclusions>                    
          <exclusion>                      
            <groupId>org.apache.sling</groupId>                        
            <artifactId>org.apache.sling.scripting.api</artifactId>                    
          </exclusion>                
        </exclusions>            
      </dependency>          
      <dependency>              
        <groupId>uk.org.lidalia</groupId>              
        <artifactId>slf4j-test</artifactId>                
        <version>1.0.1</version>                
        <scope>test</scope>              
      </dependency>
</dependencies>
 
Thanks
Vishnu

 

2 Replies

Avatar

Community Advisor

Hi @vishnu_reddy31 ,

What is JAVA version you are using, please upgrade java to 11 locally and then try to build.
Most probably you will have to upgrade few more dependencies which are not compatible .
Once this is done locally upgrade java version to cloud as well.

Thanks
Tarun