Expand my Community achievements bar.

Learn about Edge Delivery Services in upcoming GEM session
SOLVED

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

Avatar

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

Avatar

Correct answer by
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

8 Replies

Avatar

Correct answer by
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 

Avatar

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

Avatar

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!

Avatar

Level 2

Hi, 
I'm getting the following content package converter issue after resolving this one "Bundle myproject.core:1.0.0-SNAPSHOT is importing package(s) org.apache.commons.validator in start level 20 but no bundle is exporting these for that start level." 
Content Package Converter Exception Content Package Converter Exception Jar file can not be defined as a valid OSGi bundle without specifying a valid 'Bundle-SymbolicName' property.

Is this also require manifest.txt file that you explained above? 
If yes, Please guide me in understanding it. I actually did not understand where to create this manifest.txt file when we already have manifest.mf file in core -> target -> classes

Avatar

Level 1
Level 1

is this issue resolved? I am getting same error: 

 

[ERROR] Failed to execute goal com.adobe.aem:aemanalyser-maven-plugin:1.4.20:project-analyse (aem-analyser) on project mysite.all: A fatal error occurred while analysing the features, see error cause:: Unable to get bundle symbolic name from artifact net.bramp.ffmpeg:ffmpeg:0.7.0 -> [Help 1]

Avatar

Level 1

Is this resolved ? I am getting the similar error
"A fatal error occurred while analysing the features, see error cause:: Unable to get bundle symbolic name from artifact com.itextpdf:io:7.2.5"

Avatar

Community Advisor

Hi,

Yes, the error was resolved.
you'll need to make sure to include it in BND.

Thanks

Avatar

Employee

Hello @Prince_Shivhare can you explain how did you resolve it? The whole process? I'm having the same error "Unable to get bundle symbolic name from artifact com.jcraft:jsch:0.1.54"