WCMUsePojo in AEM6.3 not working | Community
Skip to main content
Level 2
Oct 8, 2018 3:51 AM UTC
Solved

WCMUsePojo in AEM6.3 not working

Hi All,

I have created a class which extends WCMUsePojo. But it's not working, it is giving following error.

com.adobe.cq.sightly.WCMUsePojo Failed to activate Use class

java.lang.NullPointerException: null

This is the code:

import com.adobe.cq.sightly.WCMUsePojo;

public class TestUse extends WCMUsePojo {

     String text;

   

    @Override

    public void activate() throws Exception {

    text = get("text", String.class);

        log.debug("Text: {}", text);

        log.info("--- Started : : Activate");       

    }

    public String getText (){

        return this.text;

    }   

}

I have also included uber.jar in the pom.and the bundle is in the active state.

Please help me to resolve this issue.

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
prashanth55Accepted solution
Level 2
Oct 9, 2018 6:30 AM UTC

Thanks All, the issue is solved. The acs-commons bundle is causing the issue because of twitter dependency. It is working fine after adding twitter bundle and restarting the core bundle.

9 replies

Feike_Visser1
Employee
Oct 9, 2018 6:32 AM UTC

Good to hear, although I can't see how this bundle can affect this.

Translate
prashanth55AuthorAccepted solution
Level 2
Oct 9, 2018 6:30 AM UTC

Thanks All, the issue is solved. The acs-commons bundle is causing the issue because of twitter dependency. It is working fine after adding twitter bundle and restarting the core bundle.

Translate
Feike_Visser1
Employee
Oct 9, 2018 6:26 AM UTC

Can you share the full stacktrace? And also the code seems not to be complete.

Translate
Ratna_Kumar
Level 10
Oct 8, 2018 9:20 AM UTC

Hi Prashanth,

Have you checked this article which tells how to use WCMUsePojo class

Adobe Experience Manager Help | Creating an Adobe Experience Manager HTML Template Language component that uses the WCMU…

Thanks,

Ratna Kumar.

Translate
raj_mandalapu
Level 7
Oct 8, 2018 5:27 AM UTC

How are you deploying bundle ? are you deploying through Felix console ? or did use CRXDE to create a class? please post entire code?

Try below code : to read value from dialog we should use below code

getProperties().get("text", String.class);

I think get is used when you pass a parameter from sightly. this caused null pointer exception

get("text", String.class);

Translate
arunpatidar
New Participant
Oct 8, 2018 5:20 AM UTC
edubey
Level 10
Oct 8, 2018 5:09 AM UTC

You should be seeing line no where NPE is occuring, can you check?

Also is that the complete code?

Make sure you bundle is resolved in felix

Translate
edubey
Level 10
Oct 8, 2018 5:08 AM UTC

code will not compile if that's the case

Translate
raj_mandalapu
Level 7
Oct 8, 2018 5:05 AM UTC

I think it is because of log.debug. I don't see creating an instance for the Logger class in your code.

Translate