Hi ,
Just updating the post again on what all outstanding issues we have apart from the below one
1. Open SSO login is not working for us after SP19 upgrade. - We are working with Adobe on this one
2. Our delete functionality is custom to move it to a recycle bin folder, this too not working due to some JavaScript issues. We are on this one too
These are the major ones
We are trying to upgrade our environment to SP19 and seeing lot of issues. Among it, one of it is while updating uber jar to 6.5.19 as below.
<dependency>
<groupId>com.adobe.aem</groupId>
<artifactId>uber-jar</artifactId>
<version>6.5.19</version>
<classifier>apis-with-deprecations</classifier>
<scope>provided</scope>
</dependency>
We are using junit version as below
<dependency>
<groupId>org.junit</groupId>
<artifactId>junit-bom</artifactId>
<version>5.4.1</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>3.4.6</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-junit-jupiter</artifactId>
<version>3.4.6</version>
<scope>test</scope>
</dependency>
The issue is that most of our test class where we use AEMContext
For eg:
Asset asset1 = context.create().asset("/content/dam/asset.jpg", new InputStream() {
@Override
public int read() throws IOException {
return -1;
}
}, "image/jpg", ImmutableMap.<String, Object>builder()
.put("prism:expirationDate", "2020-03-25T11:51:00.000-04:00")
.put(com.day.cq.dam.api.DamConstants.DC_FORMAT, "image/jpeg")
.put(com.day.cq.dam.scene7.api.constants.Scene7Constants.PN_S7_FILE_AVS, "Asset-AVS")
.build()
);
This fails and the error is
java.lang.NoClassDefFoundError: org/apache/commons/io/build/AbstractStreamBuilder
Any thoughts here? Has anyone recently upgraded to SP19 and facing issues with test classes failing?
Also, is it mandatory to update the uber jar when we do Service pack updates?
Update:
We commented the problematic junit classes and did the deployment with uber jar update. Still SSO login issue and other SP19 issues are outstanding.
Solved! Go to Solution.
Views
Replies
Total Likes
I also bumped into the "java.lang.NoClassDefFoundError: org/apache/commons/io/build/AbstractStreamBuilder" unit test error after upgrading to SP19.
I checked in the depfinder for org.apache.commons.io, bundle was found, Maven dependency on the right column:
<dependency>
<artifactId>commons-io</artifactId>
<version>2.13.0</version>
<groupId>commons-io</groupId>
<scope>provided</scope>
</dependency>
Once I added this dependency to my parent pom.xml file, unit tests were no longer broken, all passed.
(I'm running into other issues but not related to unit tests).
You need to update the Uber jar dependency as <dependency>
<groupId>com.adobe.aem</groupId>
<artifactId>uber-jar</artifactId>
<version>6.5.19</version>
<scope>provided</scope>
</dependency>
now there is no classifier as explained on https://experienceleague.adobe.com/docs/experience-manager-65/content/release-notes/release-notes.ht...
I haven’t upgraded to sp 19 but it seems mockito-core 3.4.6 version is very old. May be try to update the version of mockito and junit-bom to latest one. May I now the prior version from which you are upgrading to 6.5.19?
Sure @DPrakashRaj Let me try that.
We are trying to upgrade from SP16 to SP19 now, since we have a thread lock issue for scene7 when multiple scene 7 threads are running in SP16 and Adobe advised the permanent hotfix for that is available only from SP19.
@DPrakashRaj I did the below
1. Removed the classifier from uber jar update.
<dependency>
<groupId>com.adobe.aem</groupId>
<artifactId>uber-jar</artifactId>
<version>6.5.19</version>
<scope>provided</scope>
</dependency>
2. Updated mockito-core and junit-bom to latest as below
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>5.8.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-junit-jupiter</artifactId>
<version>5.8.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-inline</artifactId>
<version>5.8.0</version>
<scope>test</scope>
</dependency>
and
<dependency>
<groupId>org.junit</groupId>
<artifactId>junit-bom</artifactId>
<version>5.10.1</version>
<type>pom</type>
<scope>import</scope>
</dependency>
Earlier org.junit.junit-bom was 5.4.1 and mockito was 3.4.6
But after this changes, I get the below error. Its seems not able to download the dependency
The above error shows that mockito-inline:5.8.0 is not present in the repository. Check on https://repo.maven.apache.org/maven2. It seems latest version there is 5.2.0. Try with that one.you can’t browse repo.abobe.com so try with some lower version to check if it downloads. Hope that helps
Thanks @DPrakashRaj . Did this change as well. Now it's a different error, I am looking into after the change you mentioned.
If, I comment the full class, it throws another mockito error with a different error in another class.
Seems like some classes have changed with dependencies on uber jar update.
Curious to see, if anyone has done SP19 upgrade successfully.
@DPrakashRaj Seeing the latest error I got and this post - https://stackoverflow.com/questions/60612488/error-class-file-has-wrong-version-55-0-should-be-52-0-.... and https://github.com/digital-preservation/droid/issues/914 It seems like some of the API compiles only in java 11. we are using java 8. Do you think that could be an issue to upgrade to SP19? I have updated it to 4.9.0, which is the latest in the 4.x series and now working through the errors as lot of other methods deprecated in it
Ok it seems mockito 5.0.0 and above are not compatible with jdk 8. If you are using jdk can you try mockito4.9.0 and see if it gets resolved?
@DPrakashRaj Yes. Like I commented above using 4.9.0 now since I found mockito 5 and above doesn't work for java8, but still lot of errors as below and working through it
@DPrakashRaj I was able to progress a bit further with that error by creating a reflection class inside the class instead of using internal method as below, but still build is a failure and came back to original errors. Please find details below. We also opened a ticket with Adobe for the build issues after SP19
import java.lang.reflect.Field;
public class ReflectUtils {
private ReflectUtils() {}
public static void setField(Object object, String fieldName, Object value) {
try {
Field field = object.getClass().getDeclaredField(fieldName);
field.setAccessible(true);
field.set(object, value);
} catch (NoSuchFieldException | IllegalAccessException e) {
throw new RuntimeException("Failed to set " + fieldName + " of object", e);
}
}
public static void setField(Object object, Field fld, Object value) {
try {
fld.setAccessible(true);
fld.set(object, value);
} catch (IllegalAccessException e) {
String fieldName = null == fld ? "n/a" : fld.getName();
throw new RuntimeException("Failed to set " + fieldName + " of object", e);
}
}
}
But, no luck at all. After this fix, build ran and it did some progress and now flags all the test classes which was failing and with the same error
java.lang.NoClassDefFoundError: org/apache/commons/io/build/AbstractStreamBuilder
Currently i use mockito 4.9.0 and junit-bom 5.10.1
@P_V_Nair before you try below steps make sure to have proper back up.
1. Have tried removing the jar frm .m2 folder?
2. Are you getting class not found error in buiild or after deployment?
3. Have you tried removing the old jars from system console and try to install the package with new versions?
4. Have you updated the wcm core bundle version to latest?
5. Have you tried updating the Apache Commons IOorg.apache.commons.commons-io version or restarting the bundle in system console.
Thanks!
I am able to build and deploy AEM maven project with aem-uber jar 6.5.19 without any issue after upgradimg AEM to 6.5.19 with java 8
1) uber jar depenedency
<!-- Adobe AEM Dependencies -->
<dependency>
<groupId>com.adobe.aem</groupId>
<artifactId>uber-jar</artifactId>
<version>6.5.19</version>
<scope>provided</scope>
</dependency>
2) mockito and junit
<!-- Testing -->
<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>4.1.8</version>
<scope>test</scope>
</dependency>
can you check the class for context object
Asset asset1 = context.create().asset("/content/dam/asset.jpg", new InputStream() {
Views
Replies
Total Likes
@DPrakashRaj That is good that worked for you. But can you confirm if you have aem context used in any of your junit classes to set objects?
I tried with the same versions as you pinged above, but the failure is the same as below. I think the below class is deprecated.
Please find my test class below.
This is the reason I created an internal class for field setter , as I posted above, but that too didn't help, though I removed that now for testing the version changes alone as per your last post.
But we tried commenting these classes to make sure uber jar update to the instance will fix the SSO issue and other outstanding issues we have with respect to SP19 upgrade. So that test was done, but all issues still persist. we have opened separate adobe support ticket for each issue, but they are all slowly progressing.
Views
Replies
Total Likes
private final AemContext context = AppAemContext.newAemContext();
private TestClass hello;
private Page page;
private Resource resource;
@BeforeEach
public void setup() throws Exception {
// prepare a page with a test resource
page = context.create().page("/content/mypage");
resource = context.create().resource(page, "hello",
"sling:resourceType", "site/components/test");
// create sling model
hello = resource.adaptTo(TestClass.class);
}
@test
void testGetMessage() throws Exception {
// some very basic junit tests
String msg = hello.getMessage();
assertNotNull(msg);
assertTrue(StringUtils.contains(msg, resource.getResourceType()));
assertTrue(StringUtils.contains(msg, page.getPath()));
}
Views
Replies
Total Likes
Seems like you are not using Field setter methods in your test class and hence no failure.
Recommendation is to update the uber jar corresponding to the AEM version + SP.
This assure we are using the latest features and fixes
You might want to consider updating versions of all dependencies. All of them seem to be pretty old versions.
@P_V_Nair Did you find the suggestions from users helpful? Please let us know if more information is required. Otherwise, please mark the answer as correct for posterity. If you have found out solution yourself, please share it with the community.
Views
Replies
Total Likes
@kautuk_sahni I have updated the reply to @DPrakashRaj . Unfortunately, build issue is still not fixed.
@kautuk_sahni I am not sure you got a chance to check through my full comments. This issue is still open and build is a failure after SP19. I was able to progress with some changes in dependencies, but it is back to the same state with errors. Do you have insights into any customers did SP19 upgrade successfully?
@P_V_Nair have you tried upgrading the dependencies to latest version ?
<dependency>
<groupId>org.junit</groupId>
<artifactId>junit-bom</artifactId>
<version>5.10.1</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>5.8.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-junit-jupiter</artifactId>
<version>5.8.0</version>
<scope>test</scope>
</dependency>
Also before you upgrade make sure old versions are removed in system/console/bundles, try removing the jars and installing the package again.
Thank you!!