com.jcraft.jsch -- Cannot be resolved , AEM as a Cloud | Community
Skip to main content
Prince_Shivhare
Community Advisor
Community Advisor
April 17, 2021
Solved

com.jcraft.jsch -- Cannot be resolved , AEM as a Cloud

  • April 17, 2021
  • 1 reply
  • 11334 views

Hi All,

 

I have added this dependency in the POM file to work on the SFTP file transfer.

 

I am able to run this code using the main function. but when it comes to deploy it to AEM it is giving me an error.

 

17.04.2021 17:24:55.615 *INFO* [OsgiInstallerImpl] org.apache.sling.installer.core.impl.tasks.BundleStartTask Could not start bundle project.core [548]. Reason: {}. Will retry.
org.osgi.framework.BundleException: Unable to resolve project.core [548](R 548.21): missing requirement [project.core [548](R 548.21)] osgi.wiring.package; (osgi.wiring.package=com.jcraft.jsch) Unresolved requirements: [[project.core [548](R 548.21)] osgi.wiring.package; (osgi.wiring.package=com.jcraft.jsch)]

 

 

Parent POM - 

<dependency>
<groupId>com.jcraft</groupId>
<artifactId>jsch</artifactId>
<version>0.1.54</version>
</dependency>

 

Core POM -

<dependency>
<groupId>com.jcraft</groupId>
<artifactId>jsch</artifactId>
</dependency>

 

One More Error i observed -

[ERROR] com.project:project.core:1.0.0-SNAPSHOT: Bundleproject.core:1.0.0-SNAPSHOT is importing package(s) com.jcraft.jsch in start level 20 but no bundle is exporting these for that start level.
[ERROR] Analyser detected errors on feature 'com.project:project.analyse:slingosgifeature:aggregated-author.stage:1.0.0-SNAPSHOT'. See log output for error messages.

 

Can anyone help me on it?

 

 

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Asutosh_Jena_

Hi @prince_shivhare 

 

This issue is due to AEM not able to resolve the external dependency with com.jcraft.

You need to wrap the dependent JAR into an OSGi bundle and that needs to be deployed into AEM.

 

Please include the below 2 dependency with version number in main pom.xml

<dependency>
<groupId>com.jcraft</groupId>
<artifactId>jsch</artifactId>
<version>0.1.54</version>
</dependency>
<dependency>
<groupId>com.jcraft</groupId>
<artifactId>jzlib</artifactId>
<version>1.1.3</version>
</dependency>

 Include the same 2 dependency in core pom.xml without version information:

<dependency>
<groupId>com.jcraft</groupId>
<artifactId>jsch</artifactId>
</dependency>
<dependency>
<groupId>com.jcraft</groupId>
<artifactId>jzlib</artifactId>
</dependency>

do an includeresource in core pom.xml for the above jars in bnd-maven-plugin as below:

-includeresource: jsch-[0-9.]*.jar;lib:=true,jzlib-[0-9.]*.jar;lib:=true

It will look something like below: (highlighted is the only change)

<plugin>
<groupId>biz.aQute.bnd</groupId>
<artifactId>bnd-maven-plugin</artifactId>
<executions>
<execution>
<id>bnd-process</id>
<goals>
<goal>bnd-process</goal>
</goals>
<configuration>
<bnd><![CDATA[
Import-Package: javax.annotation;version=0.0.0,*
-includeresource: jsch-[0-9.]*.jar;lib:=true,jzlib-[0-9.]*.jar;lib:=true
]]></bnd>
</configuration>
</execution>
</executions>
</plugin>

 Now embedd both the JAR on all.pom.xml (not same as main pom.xml) and deploy into the AEM along with all package. This is the same place where all the packages are embedded and getting deployed into AEM instance. This will be deployed to all AEM instance and does not require any manual deployment to each instance.

<embedded>
<groupId>com.jcraft</groupId>
<artifactId>jsch</artifactId>
<type>jar</type>
<target>/apps/sample-packages/application/install</target>
</embedded>
<embedded>
<groupId>com.jcraft</groupId>
<artifactId>jzlib</artifactId>
<type>jar</type>
<target>/apps/sample-packages/application/install</target>
</embedded>

 

This will resolve the maven issue and you should be able to proceed with the deployment.

 

Hope this helps!

Thanks 

1 reply

Asutosh_Jena_
Community Advisor
Asutosh_Jena_Community AdvisorAccepted solution
Community Advisor
April 17, 2021

Hi @prince_shivhare 

 

This issue is due to AEM not able to resolve the external dependency with com.jcraft.

You need to wrap the dependent JAR into an OSGi bundle and that needs to be deployed into AEM.

 

Please include the below 2 dependency with version number in main pom.xml

<dependency>
<groupId>com.jcraft</groupId>
<artifactId>jsch</artifactId>
<version>0.1.54</version>
</dependency>
<dependency>
<groupId>com.jcraft</groupId>
<artifactId>jzlib</artifactId>
<version>1.1.3</version>
</dependency>

 Include the same 2 dependency in core pom.xml without version information:

<dependency>
<groupId>com.jcraft</groupId>
<artifactId>jsch</artifactId>
</dependency>
<dependency>
<groupId>com.jcraft</groupId>
<artifactId>jzlib</artifactId>
</dependency>

do an includeresource in core pom.xml for the above jars in bnd-maven-plugin as below:

-includeresource: jsch-[0-9.]*.jar;lib:=true,jzlib-[0-9.]*.jar;lib:=true

It will look something like below: (highlighted is the only change)

<plugin>
<groupId>biz.aQute.bnd</groupId>
<artifactId>bnd-maven-plugin</artifactId>
<executions>
<execution>
<id>bnd-process</id>
<goals>
<goal>bnd-process</goal>
</goals>
<configuration>
<bnd><![CDATA[
Import-Package: javax.annotation;version=0.0.0,*
-includeresource: jsch-[0-9.]*.jar;lib:=true,jzlib-[0-9.]*.jar;lib:=true
]]></bnd>
</configuration>
</execution>
</executions>
</plugin>

 Now embedd both the JAR on all.pom.xml (not same as main pom.xml) and deploy into the AEM along with all package. This is the same place where all the packages are embedded and getting deployed into AEM instance. This will be deployed to all AEM instance and does not require any manual deployment to each instance.

<embedded>
<groupId>com.jcraft</groupId>
<artifactId>jsch</artifactId>
<type>jar</type>
<target>/apps/sample-packages/application/install</target>
</embedded>
<embedded>
<groupId>com.jcraft</groupId>
<artifactId>jzlib</artifactId>
<type>jar</type>
<target>/apps/sample-packages/application/install</target>
</embedded>

 

This will resolve the maven issue and you should be able to proceed with the deployment.

 

Hope this helps!

Thanks 

Prince_Shivhare
Community Advisor
Community Advisor
April 17, 2021

Now getting this error in analyse package --

 

Failed to execute goal com.adobe.aem:aemanalyser-maven-plugin:0.9.2:analyse (default-analyse) on project project.analyse: Exception during analysing feature com.project:project.analyse:slingosgifeature:aggregated-author.prod:1.0.0-SNAPSHOT : Unable to get bundle symbolic name from artifact com.jcraft:jzlib:1.1.3