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!
Solved! Go to Solution.
Views
Replies
Total Likes
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!
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
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
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.
Use jjwt returns the same error:
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>
Thanks Suresh,
May I know if this should be added to root pom.xml or core/pom.xml?
in core/pom.xml
@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.
Views
Replies
Total Likes
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!
Views
Likes
Replies
Views
Likes
Replies
Views
Likes
Replies