java.lang.NoClassDefFoundError: com/day/cq/personalization/UserPropertiesUtil in AEM 6.3 | Community
Skip to main content
Level 3
Jan 8, 2018 6:47 AM UTC
Solved

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

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.

Thanks in advance.

Anusha

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
anushap40132887Accepted solution
Level 3
Jan 16, 2018 6:52 AM UTC

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

5 replies

anushap40132887AuthorAccepted solution
Level 3
Jan 16, 2018 6:52 AM UTC

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

Translate
Level 3
Jan 9, 2018 8:37 AM UTC

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"

Translate
smacdonald2008
Level 10
Jan 8, 2018 4:22 PM UTC

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

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;

    }

}

Translate
smacdonald2008
Level 10
Jan 8, 2018 2:16 PM UTC

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>

Translate
smacdonald2008
Level 10
Jan 8, 2018 2:10 PM UTC