I decided to see how much of a challange it would be to upgrade our 6.2 code base to 6.3
Turns out almost everything just works :)
However some of our unit tests that make use of the AEM Mocks framework specifically those using the JCR_OAK mock resource resolver wont pass
public final AemContext context = new AemContext(ResourceResolverType.JCR_OAK);
I'm currently getting a stacktrace (shown at bottom of post). The dependencies that I'm using that I think are important to this are:
<dependency> <groupId>io.wcm</groupId> <artifactId>io.wcm.testing.aem-mock</artifactId> <version>2.2.2</version> </dependency> <dependency> <groupId>org.apache.sling</groupId> <artifactId>org.apache.sling.testing.sling-mock-oak</artifactId> <version>2.0.2</version> <scope>test</scope> </dependency>
Stacktrace is:
java.lang.RuntimeException: Unable to initialize JCR_OAK resource resolver factory: Unable to invoke method 'activate' for class org.apache.sling.testing.mock.sling.oak.OakMockSlingRepository at io.wcm.testing.mock.aem.context.ContextResourceResolverFactory.get(ContextResourceResolverFactory.java:69) at io.wcm.testing.mock.aem.context.AemContextImpl.newResourceResolverFactory(AemContextImpl.java:69) at org.apache.sling.testing.mock.sling.context.SlingContextImpl.setUp(SlingContextImpl.java:121) at io.wcm.testing.mock.aem.context.AemContextImpl.setUp(AemContextImpl.java:74) at io.wcm.testing.mock.aem.junit.AemContext.access$100(AemContext.java:48) at io.wcm.testing.mock.aem.junit.AemContext$1.before(AemContext.java:156) at org.junit.rules.ExternalResource$1.evaluate(ExternalResource.java:46) at org.junit.rules.RunRules.evaluate(RunRules.java:20) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) at org.junit.runners.ParentRunner.run(ParentRunner.java:363) at org.mockito.internal.runners.JUnit45AndHigherRunnerImpl.run(JUnit45AndHigherRunnerImpl.java:37) at org.mockito.runners.MockitoJUnitRunner.run(MockitoJUnitRunner.java:62) at org.junit.runner.JUnitCore.run(JUnitCore.java:137) at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68) at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:51) at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:237) at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70) Caused by: java.lang.RuntimeException: Unable to invoke method 'activate' for class org.apache.sling.testing.mock.sling.oak.OakMockSlingRepository at org.apache.sling.testing.mock.osgi.OsgiServiceUtil.invokeMethod(OsgiServiceUtil.java:320) at org.apache.sling.testing.mock.osgi.OsgiServiceUtil.invokeLifecycleMethod(OsgiServiceUtil.java:149) at org.apache.sling.testing.mock.osgi.OsgiServiceUtil.activateDeactivate(OsgiServiceUtil.java:84) at org.apache.sling.testing.mock.osgi.MockOsgi.activate(MockOsgi.java:171) at org.apache.sling.testing.mock.sling.ResourceResolverFactoryInitializer.registerServiceIfNotPresent(ResourceResolverFactoryInitializer.java:157) at org.apache.sling.testing.mock.sling.ResourceResolverFactoryInitializer.registerServiceIfNotPresent(ResourceResolverFactoryInitializer.java:142) at org.apache.sling.testing.mock.sling.ResourceResolverFactoryInitializer.setUp(ResourceResolverFactoryInitializer.java:62) at org.apache.sling.testing.mock.sling.MockSling.newResourceResolverFactory(MockSling.java:75) at io.wcm.testing.mock.aem.context.ContextResourceResolverFactory.get(ContextResourceResolverFactory.java:47) ... 23 more Caused by: java.lang.NoClassDefFoundError: org/apache/jackrabbit/oak/plugins/document/bundlor/BundlingConfigInitializer at org.apache.jackrabbit.oak.plugins.nodetype.write.InitialContent.initialize(InitialContent.java:88) at org.apache.jackrabbit.oak.plugins.nodetype.write.InitialContent.createInitialContent(InitialContent.java:61) at org.apache.jackrabbit.oak.plugins.nodetype.write.InitialContent.<clinit>(InitialContent.java:57) at org.apache.jackrabbit.oak.jcr.Jcr.<init>(Jcr.java:114) at org.apache.jackrabbit.oak.jcr.Jcr.<init>(Jcr.java:141) at org.apache.sling.testing.mock.sling.oak.OakMockSlingRepository.activate(OakMockSlingRepository.java:75) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:497) at org.apache.sling.testing.mock.osgi.OsgiServiceUtil.invokeMethod(OsgiServiceUtil.java:311) ... 31 more Caused by: java.lang.ClassNotFoundException: org.apache.jackrabbit.oak.plugins.document.bundlor.BundlingConfigInitializer at java.net.URLClassLoader.findClass(URLClassLoader.java:381) at java.lang.ClassLoader.loadClass(ClassLoader.java:424) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ... 42 more
Solved! Go to Solution.
Can you compare too with the core components?
They run on 6.3
https://github.com/Adobe-Marketing-Cloud/aem-core-wcm-components
Can you compare too with the core components?
They run on 6.3
https://github.com/Adobe-Marketing-Cloud/aem-core-wcm-components
Thanks, I'll take a more detailed look at the samples and how it compares to my code. Hopefully get some time tomorrow, will report back with my findings!
Views
Replies
Total Likes
Views
Likes
Replies