Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn more

View all

Sign in to view all badges

SOLVED

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

Prince_Shivhare
Community Advisor
Community Advisor

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)]

 

Prince_Shivhare_0-1618660847178.png

 

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?

 

 

1 Accepted Solution
asutosh_jena
Correct answer by
Community Advisor
Community Advisor

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 

View solution in original post

3 Replies
asutosh_jena
Correct answer by
Community Advisor
Community Advisor

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 

View solution in original post

Prince_Shivhare
Community Advisor
Community Advisor

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

asutosh_jena
Community Advisor
Community Advisor

Hi @Prince_Shivhare 

 

This error is due to the missing bundle symbolic name in the jars.

 

To fix the above issue we have the following options:

  1. We need to add a manifest.text file to the non OSGi jar and after bundle is created you can put them in /apps/<your app>/install folder, So that they can be picked by Felix. Once in Install Folder you will see them in felix console.
  2. Using sling boot delegation: https://helpx.adobe.com/in/experience-manager/kb/SlingBootdelegation.html
  3. Using maven-bundle-plugin

Please refer the link below:

http://www.wemblog.com/2012/04/how-to-integrate-3rd-party-jar-file-in.html

 

Thanks!