Expand my Community achievements bar.

Get ready! An upgraded Experience League Community experience is coming in January.

akamai edge auth dependency issue. Class Def Not Found Exception.AEM as cloud.

Avatar

Level 1

Hi Everyone,

 

We need to generate akamai token. For token generation we are using EdgeAuth and need to added the dependency mentioned below.

 

<!-- https://mvnrepository.com/artifact/com.akamai/edgeauth -->
<dependency>
<groupId>com.akamai</groupId>
<artifactId>edgeauth</artifactId>
<version>0.2.0</version>
</dependency>

 

Deployment is successful but bundles are in satisfied state.

 

I have also updated dependency in all/pom.xml and embedded in.

 

But getting compile time error.
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.

Topics

Topics help categorize Community content and increase your ability to discover relevant content.

3 Replies

Avatar

Level 5

Hi @deepikapatel ,

 

The edgeauth JAR you're trying to embed is not a valid OSGi bundle, as it lacks the `Bundle-SymbolicName` and other essential OSGi metadata, this is the reason you're encountering the error.

 

Update the core/pom.xml to wrap the JAR during the build:

 

<dependency>
<groupId>com.akamai</groupId>
<artifactId>edgeauth</artifactId>
<version>0.2.0</version>
</dependency>

 

<build>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<extensions>true</extensions>
<configuration>
<instructions>
<Bundle-SymbolicName>com.akamai.edgeauth</Bundle-SymbolicName>
<Export-Package>com.akamai.edgeauth.*</Export-Package>
<Private-Package>!*</Private-Package>
</instructions>
</configuration>
</plugin>
</plugins>
</build>

 

Try this and let me know if it works.

 

Avatar

Level 1

Hi @ShivamKumar , tried this still getting same error.

Avatar

Community Advisor

Hi @deepikapatel ,

To resolve the Akamai EdgeAuth "ClassDefNotFoundException" in AEM as a Cloud Service, you must ensure the edgeauth JAR is:

    - Properly OSGi-compliant
    - Included in your core bundle or deployed as a separate OSGi bundle
    - Built and deployed in a way that’s supported by AEM Cloud (which disallows non-OSGi JARs by default)

1. Add the EdgeAuth Dependency (core/pom.xml)

<dependency>
    <groupId>com.akamai</groupId>
    <artifactId>edgeauth</artifactId>
    <version>0.2.0</version>
</dependency>

 

2. Wrap EdgeAuth as an OSGi bundle

Since edgeauth is not an OSGi bundle, we need to wrap it. In core/pom.xml, use bnd-maven-plugin (instead of just relying on embedding):

core/pom.xml

Add this plugin:

<build>
  <plugins>
    <plugin>
      <groupId>org.apache.felix</groupId>
      <artifactId>maven-bundle-plugin</artifactId>
      <version>5.1.2</version>
      <extensions>true</extensions>
      <configuration>
        <instructions>
          <Bundle-SymbolicName>com.akamai.edgeauth</Bundle-SymbolicName>
          <Export-Package>com.akamai.edgeauth.*</Export-Package>
          <Import-Package>*</Import-Package>
          <Private-Package>!*</Private-Package>
        </instructions>
      </configuration>
    </plugin>
  </plugins>
</build>

3. Embed the JAR in your core bundle using maven-shade-plugin (if needed)

Only use this if you want to embed EdgeAuth inside your core bundle.

<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-shade-plugin</artifactId>
  <version>3.2.4</version>
  <executions>
    <execution>
      <phase>package</phase>
      <goals><goal>shade</goal></goals>
      <configuration>
        <createDependencyReducedPom>false</createDependencyReducedPom>
        <filters>
          <filter>
            <artifact>com.akamai:edgeauth</artifact>
            <includes>
              <include>com/akamai/edgeauth/**</include>
            </includes>
          </filter>
        </filters>
        <relocations>
          <relocation>
            <pattern>com.akamai.edgeauth</pattern>
            <shadedPattern>your.package.shadow.edgeauth</shadedPattern>
          </relocation>
        </relocations>
      </configuration>
    </execution>
  </executions>
</plugin>

Then import classes using:

import your.package.shadow.edgeauth.*;

Alternative: Deploy it as a separate OSGi bundle via a ui.apps sub-package.

 

4. Update all/pom.xml to Include Wrapped or Embedded JAR

Make sure it's embedded like this:

<embedded>
  <groupId>com.akamai</groupId>
  <artifactId>edgeauth</artifactId>
  <type>jar</type>
</embedded>

Or if shaded:

<embedded>
  <groupId>your.group</groupId>
  <artifactId>your-core-module</artifactId>
  <type>jar</type>
</embedded>

5. Deploy and Check OSGi Console

After deployment:

Visit /system/console/bundles

Confirm com.akamai.edgeauth is in Active state

No ClassNotFoundException should occur

Regards,
Amit