Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.
SOLVED

java.lang.NoClassDefFoundError: com/day/cq/personalization/UserPropertiesUtil in AEM 6.3

Avatar

Level 4

Hi All,

We are using latest version of cq-personalization jar available in repository (http://repo.adobe.com/nexus/content/groups/public​) in our custom bundle which is working fine till AEM 6.1. Now we are migrating to AEM 6.3, and there we are getting error as "java.lang.NoClassDefFoundError: com/day/cq/personalization/UserPropertiesUtil". In AEM 6.3 web-console, the version of cq-personalization jar used by default is 5.10.60, which is not available to download from maven repo. Did anyone faced similar issue. Please advice.

cq-personalization-aem6.3.JPG

Thanks in advance.

Anusha

1 Accepted Solution

Avatar

Correct answer by
Level 4

Issue has been resolved by removing the explicit maven dependency included for “cq-personalization” jar from pom.xml.

View solution in original post

5 Replies

Avatar

Level 10

This should be part of the AEM Uber JAR - when using the Uber JAR - you only put the UBER dependency.

<dependency>

               <groupId>com.adobe.aem</groupId>

               <artifactId>uber-jar</artifactId>

               <version>6.3.0</version>

                <classifier>obfuscated-apis</classifier>

               <scope>provided</scope>

           </dependency>

Avatar

Level 10

I tested and this works and does not throw an error:

SSa.png

Follow this article to learn how to work with AEM 6.3 UBER

Creating an Adobe Experience Manager 6.3 Project using Adobe Maven Archetype 11

Then in the Sling Model class - you can test this class with this code:

import javax.annotation.PostConstruct;

import com.day.cq.personalization.UserPropertiesUtil;

import javax.inject.Inject;

import javax.inject.Named;

import org.apache.sling.api.resource.Resource;

import org.apache.sling.models.annotations.Default;

import org.apache.sling.models.annotations.Model;

import org.apache.sling.settings.SlingSettingsService;

@Model(adaptables=Resource.class)

public class HelloWorldModel {

    @Inject

    private SlingSettingsService settings;

    @Inject @Named("sling:resourceType") @Default(values="No resourceType")

    protected String resourceType;

    private String message;

    @PostConstruct

    protected void init() {

  

  

    UserPropertiesUtil pi = new UserPropertiesUtil();

        message = "\tHello World!\n";

        message += "\tThis is instance: " + settings.getSlingId() + "\n";

        message += "\tClass is " + pi.getClass() + "\n";

   

   

   

          

    }

    public String getMessage() {

        return message;

    }

}

Avatar

Level 4

Hi Scott,

Thanks for the reply. I have added the dependency as given, but I am not able to build my bundle with "uber-jar-6.3.0-obfuscated-apis.jar". Getting below exception. I am using JDK version 1.8

Caused by: org.apache.maven.plugin.PluginContainerException: An API incompatibility was encountered while executing org.apache.felix:maven-scr-plugin:1.7.4:scr: java.lang.VerifyError: Constructor must call super() or this() before return

Exception Details:

  Location:

    com/adobe/cq/sightly/WCMUsePojo.<init>()V @1: return

  Reason:

    Error exists in the bytecode

  Bytecode:

    0x0000000: 2ab1         

Earlier I was using below given maven dependency,

<dependency>

               <groupId>com.adobe.aem</groupId>

               <artifactId>uber-jar</artifactId>

               <version>6.3.0</version>

                <classifier>apis</classifier>

               <scope>provided</scope>

           </dependency>

and I was able to build the bundle, but getting "java.lang.NoClassDefFoundError:com/day/cq/personalization/UserPropertiesUtil"

Avatar

Correct answer by
Level 4

Issue has been resolved by removing the explicit maven dependency included for “cq-personalization” jar from pom.xml.