Up gradation of code base from AEM 6.1 to 6.4 (Upgrade WCMUse to WCMUsePojo)

sayalichougale

26-08-2019

Hi,

As I am trying to upgrade from AEM 6.1 to AEM 6.4, I need to change the extension of all the classes from WCMUse to WCMUsePojo. Have added the required dependency in the projects parent pom.xml as well :

   <dependency>

            <groupId>com.adobe.aem</groupId>

            <artifactId>uber-jar</artifactId>

             <version>6.4.0</version>

            <classifier>obfuscated-apis</classifier>

            <scope>provided</scope>

        </dependency>

But I am getting the following error during the maven build of the project:

[ERROR] Failed to execute goal org.apache.felix:maven-scr-plugin:1.7.4:scr (generate-scr-descriptor) on project abcd: Execution generate-scr-descriptor of goal org.apache.felix:maven-scr-plugin:1.7.4:scr failed: An API incompatibility was encountered while executing org.apache.felix:maven-scr-plugin:1.7.4:scr: java.lang.VerifyError: Constructor must call super() or this() before return

[ERROR] Exception Details:

[ERROR] Location:

[ERROR] com/adobe/cq/sightly/WCMUsePojo.<init>()V @1: return

[ERROR] Reason:

[ERROR] Error exists in the bytecode

[ERROR] Bytecode:

[ERROR] 0x0000000: 2ab1

[ERROR]

[ERROR] -----------------------------------------------------

[ERROR] realm =    plugin>org.apache.felix:maven-scr-plugin:1.7.4

[ERROR] strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy

[ERROR] urls[0] = file:/D:/aem_local_repo/org/apache/felix/maven-scr-plugin/1.7.4/maven-scr-plugin-1.7.4.jar

[ERROR] urls[1] = file:/D:/aem_local_repo/org/apache/maven/maven-archiver/2.2/maven-archiver-2.2.jar

[ERROR] urls[2] = file:/D:/aem_local_repo/org/codehaus/plexus/plexus-utils/1.0.4/plexus-utils-1.0.4.jar

[ERROR] urls[3] = file:/D:/aem_local_repo/junit/junit/3.8.1/junit-3.8.1.jar

[ERROR] urls[4] = file:/D:/aem_local_repo/org/codehaus/plexus/plexus-archiver/1.0-alpha-7/plexus-archiver-1.0-alpha-7.jar

[ERROR] urls[5] = file:/D:/aem_local_repo/org/apache/felix/org.apache.felix.scr.generator/1.1.4/org.apache.felix.scr.generator-1.1.4.jar

[ERROR] urls[6] = file:/D:/aem_local_repo/com/thoughtworks/qdox/qdox/1.12/qdox-1.12.jar

[ERROR] urls[7] = file:/D:/aem_local_repo/asm/asm-all/3.1/asm-all-3.1.jar

[ERROR] Number of foreign imports: 1

[ERROR] import: Entry[import  from realm ClassRealm[project> abcd:1.0-SNAPSHOT, parent: ClassRealm[maven.api, parent: null]]]

[ERROR]

[ERROR] -----------------------------------------------------

[ERROR] -> [Help 1]

[ERROR]

[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.

[ERROR] Re-run Maven using the -X switch to enable full debug logging.

[ERROR]

[ERROR] For more information about the errors and possible solutions, please read the following articles:

[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginContainerException

[ERROR]

[ERROR] After correcting the problems, you can resume the build with the command

[ERROR]   mvn <goals> -rf :

Also I have a doubt if it is compatible to use Maven Archtype 11 in AEM 6.4

Accepted Solutions (1)

Accepted Solutions (1)

Nirmal_Jose

MVP

26-08-2019

SCR annotations are deprecated from 6.2 and hence the dependencies needs to be added separately to the POM. Can you please add

<dependency>

    <groupId>org.osgi</groupId>

    <artifactId>osgi.cmpn</artifactId>

    <version>6.0.0</version>

</dependency>

as mentioned in [1]

It is recommeded to migrate to osgi R6/R7 as part of upgrade process. I used [2] as the reference.

[1] - Adobe Experience Manager Help | Developing for AEM 6.4

[2]- AEM Developer Learning : Migration of SCR annotations to OSGi R6 annotations in AEM 6.3

Answers (4)

Answers (4)

Gaurav-Behl

MVP

26-08-2019

Is maven-scr-plugin:1.7.4 generated by archetype 11 or is it carried over from your 6.1 pom.xml?

A best practice - It’s recommended to place Uber jar at the bottom of the dependency list so that Maven will honor any newer versions of dependencies that is explicitly declared inside the project POM.

Gaurav-Behl

MVP

27-08-2019

If you plan to keep SCR annotations in 6.4 then update the jar versions. e.g. try using 1.20.0 or above for maven-scr-plugin and 1.9.0 for scr-annotations. Similar approach goes for compile time dependencies/plugins like 'servlet-api' etc.

A clean & time saving approach would be to use maven archetype and create a new project from scratch if that's feasible.

You could also choose a hit n trial approach - create a reference project using maven archetype and then utilize specific jar/versions into your existing project as required.

As Nirmal mentioned above, if you plan to utilize OSGI annotations, then update osgi related artifacts & versions.

sayalichougale

26-08-2019

Hi gauravb10066713,

Is maven-scr-plugin:1.7.4 generated by archetype 11 or is it carried over from your 6.1 pom.xml?

Ans:::::::::: The maven-scr-plugin:1.7.4 is carried over from 6.1 pom.xml.

As I am working on migration from AEM 6.1 to 6.4, I am slow and steadily changing the existing code targeting the backward incompatible code first.

As suggested I have kept the Uber jar at the bottom of the dependency list.