Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.
SOLVED

Upgrade from AEM 6.1 to 6.4 Maven run time errors

Avatar

Level 4

I am trying to migrate my code base from AEM 6.1 to 6.4. When I do >mvn clean compile -Pauto-deploy. Build is success and able to see bundles in AEM System console.  But couple of bundles are in Installed state. I am seeing lot of "Cannot be resolved but is not required" errors.

But the same code is working as expected when deployed to AEM 6.1 instance.

Note : I have added below dependency for uber.

<dependency>

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

      <artifactId>uber-jar</artifactId>

      <version>6.4.0</version>

      <classifier>apis</classifier>

      <scope>provided</scope>

  </dependency>

I have solved majority of the them by adding corresponding maven dependencies in my pom file.  But not able to figure out how to solve the below errors. If I add one dependency it is showing lot of errors for other packages which are defined as part of that.

For example if add dependency in my pom for solving "com.google.appengine.api.urlfetch". I am getting lot of other not required errors within google app engine.

Can you please help me here.

com.google.appengine.api.urlfetch -- Cannot be resolved but is not required

com.google.javascript.jscomp -- Cannot be resolved but is not required

com.thoughtworks.xstream -- Cannot be resolved but is not required

javax.annotation,version=[1.2,2) -- Cannot be resolved but is not required

jline -- Cannot be resolved but is not required

junit.framework -- Cannot be resolved but is not required

junit.textui -- Cannot be resolved but is not required

nu.xom -- Cannot be resolved but is not required

oauth.signpost -- Cannot be resolved but is not required

oauth.signpost.basic -- Cannot be resolved but is not required

oauth.signpost.commonshttp -- Cannot be resolved but is not required

oauth.signpost.exception -- Cannot be resolved but is not required

oauth.signpost.http -- Cannot be resolved but is not required

org.apache.avalon.framework.logger -- Cannot be resolved but is not required

org.apache.bsf -- Cannot be resolved but is not required

org.apache.bsf.util -- Cannot be resolved but is not required

org.apache.commons.cli -- Cannot be resolved but is not required

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

You can keep that jar in local/central repository and embed it in maven-bundle-plugin in pom.xml of your project's bundle. It will be available with your project bundle. You might get import errors of few the packages which might not be needed in run time. You can neglect those packages as well. Refer this article for details.

View solution in original post

5 Replies

Avatar

Administrator

Check this similar thread:- Maven Dependencies

The reason why this is occurring is because these Java libs are not part of the OSGi service container.  Just by referencing them in your project's POM does not get them into the OSGi service container.

You need to create an OSGi bundle that contains the missing JAR files (which contains these Java packages). Then you need to deploy the bundle and place into an active state.

The best solution is import the jar in the osgi console and use that reference in my other project pom.xml.



Kautuk Sahni

Avatar

Level 4

Same code working fine with out any errors when deployed to AEM 6.1. Getting errors only in 6.4.  Do I have to get all the jars for those which I am getting Cannot be resolved but is not required  errors, add those jar files to one and convert that to OSGI bundle and deploy that to OSGI console?

Avatar

Level 10

I believe in 6.1 - you had these Java LIBS as part of the OSGi service container. As Kautuk suggests - you need to wrap these Java LIBs into an OSGi bundle and deploy to AEM. That is how you will resolve this dependency errors. Every OSGi in AEM that references a Java LIB needs to be able to resolve that dependency.

Avatar

Level 4

Understood. Thank you for the response. Do we have any Adobe documentation where we have them in OSGI service container in 6.1 and we have to wrap those Java LIBs into an OSGi bundle and deploy to AEM in 6.4 instance. Currently I am trying to solve these issues in my local 6.4 instance.

Can you please let me know How I can make sure that I can do this as part of my application build/deploy process once I solve these issues and come up with one OSGI bundle with all missed Java Libs/jar files. So that no manual work of uploading these newly created bundle to system console in qa/stage/prod environments?

Avatar

Correct answer by
Community Advisor

You can keep that jar in local/central repository and embed it in maven-bundle-plugin in pom.xml of your project's bundle. It will be available with your project bundle. You might get import errors of few the packages which might not be needed in run time. You can neglect those packages as well. Refer this article for details.