Issue working with acscommons.io.jsonwebtoken - acscommons.io.jsonwebtoken in start level 20 but no bundle is exporting these for that start level. | Community
Skip to main content
New Participant
March 4, 2024
Solved

Issue working with acscommons.io.jsonwebtoken - acscommons.io.jsonwebtoken in start level 20 but no bundle is exporting these for that start level.

  • March 4, 2024
  • 2 replies
  • 4055 views

Hey guys,

I am working on AEMaaCS, trying to use acscommons.io.jsonwebtoken in a util located in core project.

In my uitl, I:

import acscommons.io.jsonwebtoken.Jwts;
import acscommons.io.jsonwebtoken.SignatureAlgorithm;

I am following the guide:

https://adobe-consulting-services.github.io/acs-aem-commons/pages/maven.html

In "all" project added:

<dependency>
<groupId>com.adobe.acs</groupId>
<artifactId>acs-aem-commons-content</artifactId>
<version>5.0.6</version>
<classifier>min</classifier>
<type>zip</type>
</dependency>

And

<embedded>
<groupId>com.adobe.acs</groupId>
<artifactId>acs-aem-commons-ui.apps</artifactId>
<type>zip</type>
<target>/apps/app-vendor-packages/application/install</target>
</embedded>
<embedded>
<groupId>com.adobe.acs</groupId>
<artifactId>acs-aem-commons-ui.content</artifactId>
<type>zip</type>
<target>/apps/app-vendor-packages/content/install</target>
</embedded>
<embedded>
<groupId>com.adobe.acs</groupId>
<artifactId>acs-aem-commons-all</artifactId>
<type>zip</type>
<target>/apps/app-vendor-packages/container/install</target>
<filter>true</filter>
<isAllVersionsFilter>true</isAllVersionsFilter>
</embedded>

In "core" project added:

<dependency>
<groupId>com.adobe.acs</groupId>
<artifactId>acs-aem-commons-bundle</artifactId>
<version>5.0.6</version>
<scope>provided</scope>
</dependency>

The project can be built locally, however, once deployed through the pipeline, it failed in Build Images phase, the log shows:

[api-regions-exportsimports] com.xxx:app-project.core:2024.304.1172654.0003818307: Bundle app-project.core:2024.304.1172654.0003818307 is importing package(s) acscommons.io.jsonwebtoken in start level 20 but no bundle is exporting these for that start level. (com.xxx:app-project.all:2024.304.1172654.0003818307)
[api-regions-exportsimports] com.xxx:app-project.core:2024.304.1172654.0003818307: Bundle app-project.core:2024.304.1172654.0003818307 is importing package(s) acscommons.io.jsonwebtoken in start level 20 but no bundle is exporting these for that start level. (com.xxx:app-project.all:2024.304.1172654.0003818307)
[api-regions-exportsimports] com.xxx:app-project.core:2024.304.1172654.0003818307: Bundle app-project.core:2024.304.1172654.0003818307 is importing package(s) acscommons.io.jsonwebtoken in start level 20 but no bundle is exporting these for that start level. (com.xxx:app-project.all:2024.304.1172654.0003818307)

 Am I missing something?

Thanks!

Best answer by HenryLiang

Found the solution for my project:

Add the following to all/pom.xml

<dependency>
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt-api</artifactId>
<version>0.11.2</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt-impl</artifactId>
<version>0.11.2</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt-jackson</artifactId>
<version>0.11.2</version>
<scope>provided</scope>
</dependency>

And also:

<embedded>
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt-api</artifactId>
<type>jar</type>
<target>/apps/xxx-vendor-packages/application/install</target>
</embedded>
<embedded>
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt-impl</artifactId>
<type>jar</type>
<target>/apps/xxx-vendor-packages/application/install</target>
</embedded>
<embedded>
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt-jackson</artifactId>
<type>jar</type>
<target>/apps/xxx-vendor-packages/application/install</target>
</embedded>

In core/pom.xml:

<dependency>
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt-api</artifactId>
<version>0.11.2</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt-impl</artifactId>
<version>0.11.2</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt-jackson</artifactId>
<version>0.11.2</version>
<scope>runtime</scope>
</dependency>

After all these, it built and worked well.

Thanks guys!

2 replies

kautuk_sahni
Employee
March 7, 2024

@henryliang Did you find the suggestion helpful? Please let us know if more information is required. Otherwise, please mark the answer as correct for posterity. If you have found out solution yourself, please share it with the community.

Kautuk Sahni
HenryLiangAuthorAccepted solution
New Participant
March 7, 2024

Found the solution for my project:

Add the following to all/pom.xml

<dependency>
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt-api</artifactId>
<version>0.11.2</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt-impl</artifactId>
<version>0.11.2</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt-jackson</artifactId>
<version>0.11.2</version>
<scope>provided</scope>
</dependency>

And also:

<embedded>
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt-api</artifactId>
<type>jar</type>
<target>/apps/xxx-vendor-packages/application/install</target>
</embedded>
<embedded>
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt-impl</artifactId>
<type>jar</type>
<target>/apps/xxx-vendor-packages/application/install</target>
</embedded>
<embedded>
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt-jackson</artifactId>
<type>jar</type>
<target>/apps/xxx-vendor-packages/application/install</target>
</embedded>

In core/pom.xml:

<dependency>
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt-api</artifactId>
<version>0.11.2</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt-impl</artifactId>
<version>0.11.2</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt-jackson</artifactId>
<version>0.11.2</version>
<scope>runtime</scope>
</dependency>

After all these, it built and worked well.

Thanks guys!

SureshDhulipudi
New Participant
March 4, 2024

The ACS AEM Commons library doesn't provide a acscommons.io.jsonwebtoken.SignatureAlgorithm class or package. If you're trying to work with JSON Web Tokens (JWTs) in AEM, you might want to use the Java JWT (JSON Web Token) library, also known as JJWT.

 

I don't see it here ; https://javadoc.io/doc/com.adobe.acs/acs-aem-commons-bundle/5.7.0/index.html

 

why don't you use

 

import io.jsonwebtoken.Jwts;
import io.jsonwebtoken.SignatureAlgorithm;
 
<dependency>
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt</artifactId>
<version>0.9.1</version>
</dependency>
New Participant
March 5, 2024

Hi I've tried this but jjwt seems to conflict with some libs and will lead to a server-side exception.

Is it possible to reuse:

acscommons.io.jsonwebtoken

 

 

SureshDhulipudi
New Participant
March 5, 2024

acs-aem-commons also using io.jsonwebtoken.Jwts

if you are getting conflicts - it is better to resolve those and use io.jsonwebtoken.Jwts instead of acscommons.io.jsonwebtoken.

I observed acscommons.io.jsonwebtoken has the interface - does not have the implementation

please check it once.

 

https://github.com/Adobe-Consulting-Services/acs-aem-commons/blob/master/bundle/src/main/java/com/adobe/acs/commons/adobeio/service/impl/IntegrationServiceImpl.java