Problem to use class WCMUsePojo with uber-jar-6.3.1 on AEM6.3

Avatar

Avatar
Validate 1
Level 1
jessicag5141490
Level 1

Likes

0 likes

Total Posts

8 posts

Correct reply

0 solutions
Top badges earned
Validate 1
View profile

Avatar
Validate 1
Level 1
jessicag5141490
Level 1

Likes

0 likes

Total Posts

8 posts

Correct reply

0 solutions
Top badges earned
Validate 1
View profile
jessicag5141490
Level 1

21-02-2018

Hi,

I am trying to use the class WCMUsePojo to access a service, but I am getting the error: com.adobe.cq.sightly,version=[2.2,3) -- Cannot be resolved

I have searched all over the internet, and it seems that I just have to use uber-jar. The problem is that I am using uber-jar-6.3.1 and I keep having this same error.

if someone can give me a new approach to follow, I would be very happy, because I don't know what to do anymore. Below is dependencies of my core pom.xml

<dependencies>

        <!-- https://mvnrepository.com/artifact/javax.servlet.jsp/javax.servlet.jsp-api -->

<dependency>   

   <groupId>javax.servlet.jsp</groupId>

<artifactId>javax.servlet.jsp-api</artifactId>  

</dependency>

        <dependency>

            <groupId>org.osgi</groupId>

            <artifactId>osgi.cmpn</artifactId>

        </dependency>

        <dependency>

            <groupId>org.osgi</groupId>

            <artifactId>osgi.annotation</artifactId>

        </dependency>

        <!-- Other Dependencies -->

        <dependency>

            <groupId>org.slf4j</groupId>

            <artifactId>slf4j-api</artifactId>

        </dependency>

       <dependency>

    <groupId>javax.servlet</groupId>

    <artifactId>servlet-api</artifactId>

</dependency>

        <dependency>

            <groupId>javax.jcr</groupId>

            <artifactId>jcr</artifactId>

        </dependency>

        <dependency>

            <groupId>org.apache.sling</groupId>

            <artifactId>org.apache.sling.models.api</artifactId>

        </dependency>

        <dependency>

            <groupId>junit</groupId>

            <artifactId>junit</artifactId>

        </dependency>

        <dependency>

            <groupId>org.mockito</groupId>

            <artifactId>mockito-core</artifactId>

        </dependency>

        <dependency>

            <groupId>junit-addons</groupId>

            <artifactId>junit-addons</artifactId>

        </dependency>

        <!-- https://mvnrepository.com/artifact/org.apache.felix/org.apache.felix.scr.annotations -->

<dependency>

    <groupId>org.apache.felix</groupId>

    <artifactId>org.apache.felix.scr.annotations</artifactId>

</dependency>

<dependency>

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

    <artifactId>uber-jar</artifactId>

    <classifier>obfuscated-apis</classifier>

</dependency>

<dependency>

            <groupId>org.apache.geronimo.specs</groupId>

            <artifactId>geronimo-atinject_1.0_spec</artifactId>

        </dependency>        

    </dependencies>

Dependencies of my root pom.xml

<dependencyManagement>

        <dependencies>

            <dependency>

                <groupId>org.osgi</groupId>

                <artifactId>osgi.cmpn</artifactId>

                <version>6.0.0</version>

                <scope>provided</scope>

            </dependency>

            <dependency>

                <groupId>org.osgi</groupId>

                <artifactId>osgi.annotation</artifactId>

                <version>6.0.1</version>

                <scope>provided</scope>

            </dependency>

            <!-- Logging Dependencies -->

            <dependency>

                <groupId>org.slf4j</groupId>

                <artifactId>slf4j-api</artifactId>

                <version>1.5.11</version>

                <scope>provided</scope>

            </dependency>

           

<!-- https://mvnrepository.com/artifact/org.apache.sling/org.apache.sling.api -->

<dependency>

    <groupId>org.apache.sling</groupId>

    <artifactId>org.apache.sling.api</artifactId>

    <version>2.16.4</version>

    <scope>provided</scope>

</dependency>

            <dependency>

                <groupId>org.apache.sling</groupId>

                <artifactId>org.apache.sling.models.api</artifactId>

                <version>1.0.0</version> 

                <scope>provided</scope>

            </dependency>

            <!-- Servlet API -->

<dependency>

    <groupId>javax.servlet</groupId>

    <artifactId>servlet-api</artifactId>

    <version>3.0-alpha-1</version>

    <scope>provided</scope>

</dependency>

           

           <!-- https://mvnrepository.com/artifact/javax.servlet.jsp/javax.servlet.jsp-api -->

<dependency>

    <groupId>javax.servlet.jsp</groupId>

    <artifactId>javax.servlet.jsp-api</artifactId>

    <version>2.3.1</version>

    <scope>provided</scope>

</dependency>

            <!-- JCR -->

            <dependency>

                <groupId>javax.jcr</groupId>

                <artifactId>jcr</artifactId>

                <version>2.0</version>

                <scope>provided</scope>

            </dependency>

            <!-- Taglibs -->

           

            <!-- Testing -->

            <dependency>

                <groupId>junit</groupId>

                <artifactId>junit</artifactId>

                <version>4.12</version>

                <scope>test</scope>

            </dependency>

            <dependency>

                <groupId>org.slf4j</groupId>

                <artifactId>slf4j-simple</artifactId>

                <version>1.7.25</version>

                <scope>test</scope>

            </dependency>

            <!-- https://mvnrepository.com/artifact/org.mockito/mockito-all -->

<dependency>

                <groupId>org.mockito</groupId>

                <artifactId>mockito-core</artifactId>

                <version>2.7.22</version>

                <scope>test</scope>

            </dependency>

            <dependency>

                <groupId>junit-addons</groupId>

                <artifactId>junit-addons</artifactId>

                <version>1.4</version>

                <scope>test</scope>

            </dependency>

            <!-- https://mvnrepository.com/artifact/org.apache.felix/org.apache.felix.scr.annotations -->

<dependency>

    <groupId>org.apache.felix</groupId>

    <artifactId>org.apache.felix.scr.annotations</artifactId>

    <version>1.9.8</version>

</dependency>

<!-- https://mvnrepository.com/artifact/com.googlecode.json-simple/json-simple -->

<dependency>

    <groupId>com.googlecode.json-simple</groupId>

    <artifactId>json-simple</artifactId>

    <version>1.1</version>

</dependency>

<dependency>

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

      <artifactId>uber-jar</artifactId>

      <version>6.3.1</version>

      <classifier>obfuscated-apis</classifier>

      <scope>provided</scope>

</dependency>

           <dependency> 

               <groupId>org.apache.geronimo.specs</groupId>

               <artifactId>geronimo-atinject_1.0_spec</artifactId>

               <version>1.0</version>

               <scope>provided</scope>

           </dependency>            

        </dependencies>

      

    </dependencyManagement>

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Validate 25
Level 10
smacdonald2008
Level 10

Likes

1,410 likes

Total Posts

12,671 posts

Correct reply

2,278 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Give back 900
Give back 600
View profile

Avatar
Validate 25
Level 10
smacdonald2008
Level 10

Likes

1,410 likes

Total Posts

12,671 posts

Correct reply

2,278 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Give back 900
Give back 600
View profile
smacdonald2008
Level 10

22-02-2018

I See your problem - you are not referencing the correct version in the parent POM. As specified in the article - you need to follow this:

Add the following POM dependency to the POM file located at C:\AdobeCQ\wsHTL63. See reference to the version below.

<dependency>

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

               <artifactId>uber-jar</artifactId>

               <version>6.3.0</version>

               <!-- for AEM6.1 use this version     : <version>6.1.0</version> -->

               <!-- for AEM6.1 SP1 use this version : <version>6.1.0-SP1-B0001</version> -->

               <!-- for AEM6.1 SP2 use this version : <version>6.1.0-SP2</version> -->

               <!-- for AEM6.2 use this version     : <version>6.2.0</version> -->

               <classifier>obfuscated-apis</classifier>

               <scope>provided</scope>

           </dependency>

             

           <dependency>

               <groupId>org.apache.geronimo.specs</groupId>

               <artifactId>geronimo-atinject_1.0_spec</artifactId>

               <version>1.0</version>

               <scope>provided</scope>

           </dependency>

Make sure you follow all of the POM dependencies in the article. Once you do - you will see your bundle go into ACTIVE state:

OSGi.png

Answers (6)

Answers (6)

Avatar

Avatar
Validate 1
Level 3
manish_anand
Level 3

Likes

19 likes

Total Posts

56 posts

Correct reply

3 solutions
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 10
Boost 1
View profile

Avatar
Validate 1
Level 3
manish_anand
Level 3

Likes

19 likes

Total Posts

56 posts

Correct reply

3 solutions
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 10
Boost 1
View profile
manish_anand
Level 3

25-10-2018

Hi,

Can you also tell me right version of aem-uber for aem version 6.3.2.2?

Also i read somewhere that there is some known issue and this dependency needs to be specified in Core pom also. Is it true?

when i add <classifier>Obfuscated-api</clasifier>, it works fine. But without this it says missing artifact aem-uber-6.3.2.2.  What is it’s (classifier ) Use?

Avatar

Avatar
Validate 25
Level 10
smacdonald2008
Level 10

Likes

1,410 likes

Total Posts

12,671 posts

Correct reply

2,278 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Give back 900
Give back 600
View profile

Avatar
Validate 25
Level 10
smacdonald2008
Level 10

Likes

1,410 likes

Total Posts

12,671 posts

Correct reply

2,278 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Give back 900
Give back 600
View profile
smacdonald2008
Level 10

22-02-2018

As Ratna points out - follow that article - it works and been tested!

Avatar

Avatar
Validate 1
Level 1
jessicag5141490
Level 1

Likes

0 likes

Total Posts

8 posts

Correct reply

0 solutions
Top badges earned
Validate 1
View profile

Avatar
Validate 1
Level 1
jessicag5141490
Level 1

Likes

0 likes

Total Posts

8 posts

Correct reply

0 solutions
Top badges earned
Validate 1
View profile
jessicag5141490
Level 1

22-02-2018

Hi Hemant,

this dependency is not currently available on repo public anymore.

Hi Kumar, I have been following a lot of articles for all week and I always end up on the same, I am using the uber-jar, that has WCMUsePojo class on it, I don't know why it not using the class on uber-jar.

com.adobe.cq.sightly,version=[2.2,3) -- Cannot be resolved

Avatar

Avatar
Validate 25
MVP
Ratna_Kumar
MVP

Likes

159 likes

Total Posts

755 posts

Correct reply

134 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Give Back 50
Give Back 5
View profile

Avatar
Validate 25
MVP
Ratna_Kumar
MVP

Likes

159 likes

Total Posts

755 posts

Correct reply

134 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Give Back 50
Give Back 5
View profile
Ratna_Kumar
MVP

21-02-2018

Hi,

Please have a look at this HELPX community article which uses WCMUsePOJO with Uber Jar in AEM 6.3

Creating an Adobe Experience Manager 6.3 HTL component that uses the WCMUsePojo API

Thanks,

Ratna Kumar.

Avatar

Avatar
Validate 1
Level 7
Hemant_arora
Level 7

Likes

92 likes

Total Posts

290 posts

Correct reply

54 solutions
Top badges earned
Validate 1
Ignite 5
Ignite 3
Ignite 1
Give Back 50
View profile

Avatar
Validate 1
Level 7
Hemant_arora
Level 7

Likes

92 likes

Total Posts

290 posts

Correct reply

54 solutions
Top badges earned
Validate 1
Ignite 5
Ignite 3
Ignite 1
Give Back 50
View profile
Hemant_arora
Level 7

21-02-2018

You can always use dependency finder in AEM to check for the exact dependency

http://localhost:4502/system/console/depfinder

Did you try adding this:

<dependency>

<groupId>com.adobe.cq.sightly</groupId>

<artifactId>cq-wcm-sightly-extension</artifactId>

<version>1.3.8</version>

<scope>provided</scope>

</dependency>

Avatar

Avatar
Validate 1
Level 1
jessicag5141490
Level 1

Likes

0 likes

Total Posts

8 posts

Correct reply

0 solutions
Top badges earned
Validate 1
View profile

Avatar
Validate 1
Level 1
jessicag5141490
Level 1

Likes

0 likes

Total Posts

8 posts

Correct reply

0 solutions
Top badges earned
Validate 1
View profile
jessicag5141490
Level 1

21-02-2018

Hi,

I had some progress here.

I notice that if I comment some dependencies from com.adobe.acs I don't have the sightly dependency error anymore. Dependencies commented:

<!-- <dependency>

                            <groupId>com.adobe.acs</groupId>

                            <artifactId>checkstyle-osgi-checks</artifactId>

                            <version>0.0.3</version>

                        </dependency>

                        <dependency>

                            <groupId>com.adobe.acs</groupId>

                            <artifactId>coding-standards</artifactId>

                            <version>0.0.1</version>

                        </dependency> -->

But this service that uses WCMUsePojo does not appear on my bundles, neihter in console/components. It is not being created. What can I do on this case?

My class:

public class ContingencyAccess extends WCMUsePojo {

@Reference

ResourceResolverFactory resourceResolverFactory;

@Override

public void activate() throws Exception {

   

    final String ERRORMESSAGE = "Error: ";

    final String PATH = "Error: ";

   

    Session session;

   

    //public static final Logger LOGGER = LoggerFactory.getLogger(ContingencyAccessImpl.class);

   

    Map<String, Object> param = new HashMap<String, Object>();

        param.put(ResourceResolverFactory.SUBSERVICE, "contService");

        ResourceResolver resourceResolver = null;

  

    try {

    if(resourceResolverFactory != null){

        resourceResolver = resourceResolverFactory.getServiceResourceResolver(param);

        session = resourceResolver.adaptTo(Session.class);

      

        Page page = resourceResolver.resolve("/").adaptTo(Page.class);

      

        Iterator<Page> contingencyIterator = page.listChildren();

      

        while (contingencyIterator.hasNext() ){

        Page contingencyPage = contingencyIterator.next().adaptTo(Page.class);

        contingencyPage.getTitle().toString();

        System.out.println(contingencyPage.getTitle().toString());

        }

    }

    }catch(Exception e) {

    System.out.println(e.getMessage());

    }

  

    }

}