Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

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

Avatar

Level 2

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!

1 Accepted Solution

Avatar

Correct answer by
Level 2

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!

View solution in original post

9 Replies

Avatar

Community Advisor

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>

Avatar

Level 2

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

 

HenryLiang_0-1709666718440.png

 

Avatar

Community Advisor

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/ad...

Avatar

Level 2

Use jjwt returns the same error:

xxx is importing package(s) io.jsonwebtoken in start level 20 but no bundle is exporting these for that start level.
 
Any suggestions?

Avatar

Community Advisor

can you try explicit Export JAR statement in pom.xml

 

<executions>
<execution>
<id>bnd-process</id>
<goals>
<goal>bnd-process</goal>
</goals>
<configuration>
<bnd>
<![CDATA[
Import-Package: xxx
Export-Package :io.jsonwebtoken.*;target/dependency/jjwt-api-0.11.2.jar,target/dependency/jjwt-gson-0.11.2.jar,target/dependency/jjwt-impl-0.11.2.jar
]]>
</bnd>
</configuration>

</execution>
</executions>

Avatar

Level 2

Thanks Suresh,

May I know if this should be added to root pom.xml or core/pom.xml?

Avatar

Administrator

@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

Avatar

Correct answer by
Level 2

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!