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

Avatar

Avatar
Springboard
Level 7
Prince_Shivhare
Level 7

Likes

123 likes

Total Posts

407 posts

Correct reply

65 solutions
Top badges earned
Springboard
Establish
Give Back 100
Boost 100
Validate 1
View profile

Avatar
Springboard
Level 7
Prince_Shivhare
Level 7

Likes

123 likes

Total Posts

407 posts

Correct reply

65 solutions
Top badges earned
Springboard
Establish
Give Back 100
Boost 100
Validate 1
View profile
Prince_Shivhare
Level 7

17-04-2021

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?

 

 

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Applaud 25
Level 10
asutosh_jena
Level 10

Likes

593 likes

Total Posts

705 posts

Correct reply

207 solutions
Top badges earned
Applaud 25
Give Back 100
Boost 500
Affirm 100
Ignite 1
View profile

Avatar
Applaud 25
Level 10
asutosh_jena
Level 10

Likes

593 likes

Total Posts

705 posts

Correct reply

207 solutions
Top badges earned
Applaud 25
Give Back 100
Boost 500
Affirm 100
Ignite 1
View profile
asutosh_jena
Level 10

17-04-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 

Answers (0)