Ask Me ?

Hi Readers,

Here you may comment all the questions/ doubts which you encountered during your journey for AEM. I will try my best to help you out and might connect with you to solve them too.

Also you may post interesting questions which you went through during your respective interviews , and I will try to answer them and thereby increase the Question Bank for masses.

So go ahead and post the questions !!

Thanks a lot .



703 thoughts on “Ask Me ?

    • Hi Karan,

      As far as Spring Annotations are concerned, it is specified in Spring Documentation very clearly that: Spring 2.5 introduces further stereotype annotations: @Component, @Service, and @Controller. @Component is a generic stereotype for any Spring-managed component. @Repository, @Service, and @Controller are specializations of @Component for more specific use cases, for example, in the persistence, service, and presentation layers, respectively.

      Therefore, you can annotate your component classes with @Component, but by annotating them with @Repository, @Service, or @Controller instead, your classes are more properly suited for processing by tools or associating with aspects. For example, these stereotype annotations make ideal targets for pointcuts.

      Thus, if you are choosing between using @Component or @Service for your service layer, @Service is clearly the better choice. Similarly, as stated above, @Repository is already supported as a marker for automatic exception translation in your persistence layer.

      In terms of Aspect Oriented Programming:
      @Component – Indicates a auto scan component.
      @Repository – Indicates DAO component in the persistence layer.
      @Service – Indicates a Service component in the business layer.
      @Controller – Indicates a controller component in the presentation layer.

      Now the question comes what will happen if I write my Business logic , just using @Component. It will work definitely , but not a good practice and would lead to bad code . Moreover it will behave the same , but one aspect is that they wont be able to catch some specific exception related to DAO instead of Repository if we use @component or @ service.

      Moreover you might not be able to inject your Class component if @Service is not present as an annotation. (Note- Dependency Injection- usage of @Reference could be done only in classes defined as @Component and not simply Classes. )

      So its always advisable to respect the convention and use them in line with layers.

      I hope that answers the question.


    • Hi Karansheel,
      Thanks for your questions.
      1. Why questions is existing: In practical we need to identify them when design and implement.
      2. Answer:
      – All objects managed by OSGi container are components. You qualify components as services. This means that all services are components but not vice-versa.
      – Components can refer/call (using container injection – @Reference) other services but not components.
      – In other words, a component cannot be injected into another component / service. Only services can be injected into another component. Remember that a component can refer other services.

      Hung Vu

      Liked by 1 person

    • Hi Aman,

      I would suggest you to go the blog entry and give a read of ALL the questions that I had posted. This would give you an idea of the type of questions which could be asked. And if you would closely notice, while stating the answers , I have posted links for the topics been discussed there. You MUST be reading those topics thoroughly , because that is the target area where your exam will be concentrated.

      Moreover, after your are done with CQ-6.0 question bank, make sure you practice CQ5.6 question bank too, as there will be a lot of questions which would be similar.

      If you are well equipped with the questions and related topics I have mentioned in my blog. You will be definitely through the exam.

      All the best.

      Liked by 1 person

        • Hi Aman,

          Yes Aman, you are right, but if you will closely look on the options you will not find the correct ones present there. Nosamplecontent would be the case when you will install your publish environment on an actual CQ project, where you might not need any of the Geometrixx pages. I would suggest to be clear with the concept and just verify the options once before making a choice. The options might somewhat differ.


          Liked by 1 person

          • hi Hashim,

            Working on Reading RSS Feed Xml with a Schedular and displaying it on a Tab Panel periodically.

            Can you please let me know the design approach for this.
            Will this Schedular be a part of my OSGI bundle or it wil be a Stand alone jar.


            • Hi Aman,

              As far as I understood from the description of your problem, you have to consume an RSS feed XML data and read/store that data in nodes in JCR, so that you may use it for displaying in Tab Panel. I assume the RSS feed changes in some defined period only (if its dynamic and changes frequently dont choose schedular. )

              So the first step would be to pick an appropriate XML parser ( Use this link : ) and create node structures in your JCR (or fill the properties of your component ). So everytime that specific node should have data. There should not be a lag in that. Then use that node properties to read and display as per need.

              One important thing to note is that once you are updating the nodes via schedular, none of the property should be blank. So to overcome this use something like–

              Before schedular : node1 (this node has updated RSS feed data).
              Schedular is ON : node1 ; tempnode1 (tempnode should be used to update RSS feed data)
              Schedular completed : delete node1 and rename tempnode1 to node1.

              Follow this approach to minimize the effect of updating RSS feed data dynamically.

              You may use it in your OSGi bundle itself, no need for a standalone jar.

              I hope this answer the question.


              Liked by 1 person

  1. Hi Hashim,

    How will search for a configuration in repository?
    a. PID
    d. none

    The answer to this question according to me should be PID as it is the unique Id.
    Can you please confirm what would be the right answer and why.



    • Yes thats correct way to do so. eg.
      select * from nt:base where jcr:path like ‘/apps/%’ and contains(*, ‘org.apache.felix.webconsole.internal.servlet.OsgiManager’) .
      Here PID is org.apache.felix.webconsole.internal.servlet.OsgiManager .



  2. Hi Hashim,

    I have some questions as below: (CQ6 exam)

    1/Choose 3 jar files which install publish instance successfully

    a- cq5-publish-p4502.jar
    b- cq5-publish-4502.jar
    c- crxquickstart-publish-4502.jar
    d- another one

    2/What is valid mode out-of-box used in CQ?

    + production
    + activate
    + nosamplecontent
    + other option

    What is your answer for these questions?


    • Hi,

      1. There are a few rules which define naming convention for a jar. You may refer

      +When you rename the file, it must start with cq; as in cq5-publish-p4503.jar.

      +It is recommended that you always prefix the port number with -p; as in cq5-publish-p4503.jar or cq5-author-p6754.jar.

      +the port number must be 4 or 5 digits

      +these digits must come after a dash

      +if there are any other digits in the filename, then the port number must be prefixed with -p
      the “cq5” prefix at the beginning of the filename is ignored

      So according to them only option a is correct.

      2. Answer is nosamplecontent.



    • Hi Hashim,

      I installed publish instance using “cq5‑publish‑4502.jar” file name and it started properly as publish instance. I guess even “b” option is correct for 1st question. Can you please check once and confirm? Also, can you please share your personal email id?

      Thanks and Regards


      • Hi Mohan,
        Actually these naming conventions were strictly followed with versions (less than) <6.0 . They have changed them recently and hence the confusion.
        You may test the priority and answer accordingly.


  3. Hi Hashim,

    Could you please take a look on my answer for question below?

    4. In junit dependency xyz I want to use version greater than or equal to 3.8 –
    a. (3.8)
    b. (3.8]
    c. [3.8]
    d. [3.8,)</version

    My Answer id: d


  4. Hi Hashim,

    5. What is vault merge/resolve command will do? –
    a. Will resolve conflict semantically
    b. Will remove resolve conflict
    c. Will keep resolve conflict
    d. Will resolve conflict related artifact files

    I have concerned about these options a and d. Could you please tell me what is the final answer?


  5. Hi Hashim,

    Could you please review my answer for question below?

    12. Felix config is modified at three locations, which one is applied at runtime
    a. Apps
    b. Libs
    c. Felix
    d. None

    My Answer: a


    • Hi,
      The answer for this is (c)Felix. They were asking about the precedence order for changing the configurations at runtime. Please read the Link thoroughly .

      Going forward please read the links I have mentioned along with each and every question . This would help you to clarify the answers yourself and would prepare you for the situation when a twisted question is asked .



  6. Hi Hashim,

    Could you please confirm my answer for question below?

    13. After making changes in OGSi config how to make changes effective
    a. Restart the server
    b. Restart the bundle
    c. Nothing is required
    d. Start stop the bundle

    My Answer : C



  7. Hi Hashim,

    37. How do you specify the osgi config of a java class in Publish runmode?
    a. (Node Location) /apps/system/config/org.apache.felix.webconsole.internal.servlet.OsgiManager jcr:primary type= sling:osgiConfig
    b. /apps/system/config/org.apache.felix.webconsole.internal.servlet.OsgiManager.config
    jcr:primary type= sling:osgiConfig
    jcr:primary type= nt:file
    jcr:primary type= nt:file
    –> The answer is C.

    Could you please review my answer for question below?



  8. HI thao , The answer has to be between A and B , because the question mentions that it is a OSGI config . OSGI config can have as their jcr:primarytype ONLY sling:OsgiConfig . That effectively rules out C and D. Not really sure in A and B. Please remember these questions are not exact and are memory based. So , they can have some ambiguities.

    Liked by 1 person

  9. Hi
    according to the question 72 of the cq5.6 exams

    Which statement about the docroot paramter in the cache section of the CQ Dispatcher configuration file is true?

    A. It should be the same path where the CQ server is installed.
    B. It is required to be the same as the document root of the Web server.
    C. It can be any path inside the filesystem that can be modified by the Web server.
    D. It should be the same as the one configured in the repository as docroot property.

    you wrote that the right answer is C

    The question is that on the Adobe documentation is written that
    “The value must be the exact same path as the document root of the web server so that Dispatcher and the web server handle the same files.”

    What do you think?



  10. Hi Hashim,

    Please help me review the answer of the below question.

    6. When installing dispatcher on IIS server Which Application D Feature is required to configure AEM dispatcher? –
    a. ISAPI Filter
    b. ISAPI Extension
    c. CGI
    –> The answer is A

    Thao Nguyen


  11. Hi Hashim,

    I saw that in the question lists with question 17, you provide the answer is A. You can explain more details for me. Because I think that with this question, A and D are correct.

    17. Which log contains startup related info? –
    a. Stdout
    b. Error
    c. Audit log
    d. Stderr log
    Answer- a

    Thao Nguyen


  12. Hi Hashim,

    44.) How will you apply the new configuration while creating it from crxde ?
    a. Restart CQ instance
    b. Do nothing, changes applied automatically.
    c. Restart the service once.
    d. Save ALL and changes will apply.
    –> The answer is D
    After I read the link: a New Configuration to the Repository. I think D is correct answer. Could you please confirm and give me your feedback?

    Thao Nguyen


  13. Hey Hashim, did you take down the page for the adobe 6.0 sample question set. Could you please let me know how can I prepare for the exams alternatively. Thanks for the help.


  14. Hi Hashim,

    Could you please add question 28, 29, and 38 into the question list? I saw that they are missing in the question list.

    Please help me on the below question:

    41. If we want to revert the default parsys functionality, i.e., order in which components are displayed.(choose 2 options)
    a)write from scratch
    b)create parsys component, give sling:resourceType as /libs/foundation/… and make changes in jsp
    c) copy required jsps from foundation into /apps/myproject and make changes
    d) copy entire parsys related code and make change to applicable jsps

    Could you please explain more details?

    Thao Nguyen


    • Hi,
      To override the default functionality of parsys component, you may proceed as follows:
      1.Create a new parsys component under /apps//components/content/parsys and apply sling:resourceType=foundation/components/parsys, modify the JSP as applicable.

      2.Copy the parsys component and all its contents from /libs/foudation/components/parsys to /apps/foundation/components/parsys and modifty the applicable jsps

      The options might be having different language , but the crux solution is above.


  15. Hi Hashim,

    40/ If we start AEM server in debugger mode what will happen?

    a. It will fork a child process for sure.
    b. It will not fork any child process.

    My Answer: A

    2/ in the file run mode is set to publish whereas in the command line run mode is given as below Java -r author. Which run mode will apply author or publish?

    a. publish
    b. author
    c. None
    d. both

    My Answer: A

    Could you please review these questions?


    Huy Do


  16. Hi Hashim,

    35. IIS dispatcher is installed in C:/inetpub. Site root is /content/www/mysite. A page/content/www/mysite/mypage and the dispatcher flush agent is not configured? What should be done to get the latest my page?

    a. Go and delete the physical path of cache
    b. Do nothing

    My Answer is : A

    Could you please review my answer?


    Huy Do


  17. Hi Hashim,

    About question 35:
    IIS dispatcher is installed in c:/inetpub. Site root is /content/www/mysite. A page /content/www/mysite/mypage and the dispatcher flush agent is not configured? What should be done to get the latest mypage?

    a.Go and delete the physical path of cache.
    b. Do nothing

    –> I think that we will delete /content/www/mysite/mypage . Could you please give me your feedback?

    Thao Nguyen

    Liked by 1 person

    • Hi Thao ,
      Since dispatcher agent is NOT configured , therefore cache will not automatically get updated and therefore you will HAVE to delete the relevant cached page at the location in which it is cached. . 3 of the 4 options were suggesting to delete the cached files at a particular location . So , the right answer will be the ,
      “C:\inetpub\wwwroot. ” OR the DOCUMENTROOT mentioned , and then the path of the relevant page .
      The Dispatcher places the cached documents in the document root of the web server.

      “C:\inetpub\wwwroot.” – this path is typically used as the path where cache is saved . So be careful while selecting the options .
      P.S- Here your answer is right .


  18. Hi Hashim,

    I want to create a listener which could hide and show a multifield on clicking a checkbox.
    I have got till getting the value of checkbox but not able to hide the multifield.
    Can you help on that?


    • Hi Sanjana , Please elaborate more on this query . As, to what is the error ?
      The ideal way to write a dialog listener is
      1 : First identify the event , in which you want your listener to be called .
      In this case , I believe you would want one on ‘selectionchanged ‘ since your use case suggests that on the change of this value(checked/not checked) , you want multifield to
      be shown/hidden

      2 : Now , since you have identified your event , you can go ahead and write the simplest code possible , just to check if its working fine or not .

      Here is the code that will work for you :

      function(comp, val, isChecked) {
      alert("hi world");
      var panel = comp.findParentByType("panel"); //find the parent panel container
      var multifield= panel.getComponent("multifield"); //find the component with itemId rdg

      /*hide or show component based on checked value */
      isChecked ? multifield.hide() :;

      Liked by 1 person

  19. hi Hasim,
    when i deploy the bundle i am getting these errors 1. org.apache.http Cannot be resolved 2. org.apache.http.client.methods Cannot be resolved 3. org.apache.http.impl.client Cannot be resolved how to resolve this error can please suggest how to fix this.
    Manually i deployed the bundle in felix console. i hv also added httpclient-4.0.2 & httpcore-4.3.2 to the buildpath but still its not working


    • Hi Dillip ,

      I am assuming that you uploaded a bundle in CQ and when you opened it in (http://localhost:4502/system/console/bundles) , in the ‘import packages ‘
      you could see this error .
      This error normally occurs when you don’t have a specific dependency added in your pom.xml which will download the respective JAR.
      Most probably you will have to add the dependancy in your pom.xml
      ( in the folder in which these are being used ) .
      This is done so that the related jars can be downloaded by maven .

      In this case as we have 3 unresolved packages
      1 : org.apache.http
      2 : org.apache.http.client.methods
      3 : org.apache.http.impl.client

      Now , The dependancy that corresponds to them is


      Please add this in your pom.xml of the module where you are getting an error

      But even after adding them , and including these package definitions in our ‘Import package’ , (when I tried on my local system) , I could still see the error

      Error : org.apache.http – not resolved .

      But , I could see the downloaded JARs in my repository ( c:> users > m2 > repository ) !

      So , what we need to change is the ‘import package ‘ definition . Since these 3 imports have one thing in common ‘org.apache.http’
      we can directly include all three with one statement ‘org.apache.http.*’
      and VOLA ! It should work then.(it worked on my local machine )

      This is my import package statement .


      Also , I referred to this link , which says that ‘org.apache.http.client.methods’ is a part of a particular jar file which we downloaded through the dependancy.

      Liked by 1 person

  20. Hi Hashim,

    Suppose there are multiple pages[in millions] and each one of them have four custom properties[repeating] in it.

    The values present in those properties have to be replaced with corresponding new values.

    Can you please let us know, if this can be done via Groovy script.

    Your thoughts/inputs will be very much helpful.


    • Hi ,
      I tried replicating your problem statement , in my local machine . Turns out , you can modify the value of any number of pages that you want . Properties can be iterated as well . Hashim has also addressed , sort of this situation in his Groovy Script Blog page . Please go through it also .

      My content hierarchy is as follows


      Each of the pages (groovypag1 and groovypage2 have two properties based on which , they have to be searched.The two properties are ‘property1’ and ‘property2 ‘ . All , the pages , who have both these properties will be displayed.

      Step 1 : Run a query for retrieving the results that you want

      query > select * from nt:base where property1 IS NOT null AND property2 IS NOT NULL

      # you can of course modify the query as you want , I am just giving you a prototype.

      Step 2 : you will get the results in the form of query results ( as we get , when we write the same code in java ) , So extract the results in NODES form . You have to extract in node form , so that it is easier for you to set a property in it using JCR API

      Step 3 : Set the desired property . (Since, my query said that the page should have both ‘property1’ and ‘property2 ‘ as their properties , therefore I am not including a
      JCR check of ‘hasproperty’

      Step 4 : Save the session ! This is highly important , because you may bedoing everything right , but if you dont save your session , you will never see the results.

      Done !

      This is the sample code that I used in my machine to set the properties to something else. Here property is set to TEST and property2 is set to GROOVY .

      Check the results on your page ‘/content/groovy/rahipagetest/grrovypage1/jcr:content’ .
      import javax.jcr.query.*
      import javax.jcr.*
      /** Define the content hierarchy*/
      final def page = getPage(‘/content/groovy’)
      //Step 1
      /*This method is used to Query the JCR and find results as per the Query.*/
      def buildQuery() {
      def queryManager = session.workspace.queryManager;
      def statement = ‘select * from nt:base where property1 IS NOT null AND property2 IS NOT NULL’;
      queryManager.createQuery(statement, ‘sql’);

      //Step 2
      /* Property which is searched in the content hierarchy */
      final def query = buildQuery();
      final def result = query.execute()

      /* Get the rows in the form of nodes*/
      def rows = result.nodes

      rows.each { row ->
      println row.path
      row.set(‘property1′,’TEST’); //setting the property
      row.set(‘property2′,’GROOVY’); //setting the property
      /**just tocheck in your local instance if it is set or not**/
      println row.get(‘property1’);
      println row.get(‘property2’); //Step 4



  21. Hi,

    It seems to be working absolutely fine. Thanks a lot.

    I had mentioned the below in my earlier post :

    “Each one of them have four custom properties[repeating] in it.

    The values present in those properties have to be replaced with corresponding new values”

    Sorry for not being very clear.

    Explaining the situation in detail as below :

    – Multiple pages are present with four custom properties[(custom1,custom2,custom3,custom4) single valued or repeating].

    – We have a well defined mapping[old values to be replaced with new values] mentioned as below. For example :

    Oldpropertyvalue Newpropertyvalue
    oldvalue1 newvalue1
    oldvalue2 newvalue2
    oldvalue3 newvalue3
    oldvalue4 newvalue4
    oldvalue5 newvalue5
    oldvalue6 newvalue6
    and so on……

    – The “Oldpropertyvalue” values may or may not be present in all the four custom property in the pages.Probably they might appear in one or two or three or all the four.

    – Where ever it is present, it has to be replaced with the new values.

    I am not getting as to how is this to be done. Your inputs/code snippet would be very much required.


    • Hi ,
      I gave you a prototype of the code. Now , you can improvise it as per your will .
      1 : If my understanding is correct , you are referring to the jcr properties of the page ie . which are displayed in the console when we click on the jcr:content node of the page . If this is the case , then in the same page , properties can not be repeated. They are unique .

      If it is the JCR properties , then the code that I have provided will work fine , as I have listed for two properties , you can do the same for four and improvise as per you requirement .


      • Hi,

        Thanks a lot for your reply. Sorry, the length of the post got bit big[tried to minimize it as much as possible]

        – Yes, I am referring to jcr properties of the page i.e, if I go to the page in crx explorer and then click on jcr:content of the page I see those custom properties[custom1,custom2,custom3,custom4].

        – The custom properties are of type String[].

        – These custom properties[may be all or some of them] have some values assigned to them, may be something like

        There is a corresponding mapping[for values to be replaced] as below :

        oldvalues newvalues

        oldvalue1 newvalue1
        oldvalue2 newvalue2
        oldvalue3 newvalue3
        oldvalue4 newvalue4
        and so on….

        The OUTPUT should be something like

        From what I understand is

        – When you mentioned “then in the same page , properties can not be repeated”, it means oldvalue1 can appear only in custom1 and not in custom1 & custom2 & custom3 & custom4, correct?
        – Also, based on the basic code you have provided I should be able to make necessary changes and the code should be able to achieve this objective,correct?
        – Will definitely try my best possible and post back my results.


        • Oh , you meant multi-valued properties. Again , for that its a simple code, I have modified the existing code to set the multivalued properties. Please be carefull and improvise it as per your business requirement.
          Now , I added an extra property3 which is of type String Array and enetered some test values in it (1,2,3). . So to set it in groovy with your new properties , I first included the new values in arrStr (like an object) and then , these new values were set into property3.

          Hope this helps :)

          I took help from this document .

          import javax.jcr.query.*
          import javax.jcr.*
          /** Define the content hierarchy*/
          final def page = getPage(‘/content/groovy’)
          //Step 1
          /*This method is used to Query the JCR and find results as per the Query.*/
          def buildQuery() {
          def queryManager = session.workspace.queryManager;
          def statement = ‘select * from nt:base where test IS NOT null AND groovy IS NOT NULL’;
          queryManager.createQuery(statement, ‘sql’);

          //Step 2
          /* Property which is searched in the content hierarchy */
          final def query = buildQuery();
          final def result = query.execute()

          /* Get the rows in the form of nodes*/
          def rows = result.nodes
          Object[] arrStr = [‘Ananas’, ‘Banana’, ‘Kiwi’] //new array for property 3
          rows.each { row ->
          row.set(‘property3’,arrStr); //setting a multivalued property
          row.set(‘property2′,’GROOVY’); //setting the property
          /**just tocheck in your local instance if it is set or not**/
          println row.get(‘property1’);
          println row.get(‘property2’);

 //Step 4


  22. Hi Hasim: On the following question:
    1. I have created two nodes nt:unstructured inside the root folder and nt:folder inside the apps.Which node type would you be able to save ?
    a. Exception is thrown and nothing is saved
    b. Both
    c. None
    d. One, nt:folder
    Answer- a

    The doc says “a”, but actually both work fine when I test.

    If I create a node nt:unstructured inside the root folder and also create a nt:folder inside the apps, then try to save, it works just fine.

    There are cases where I understand an exception would be thrown but not in these two. Could you please let me know what am I seeing wrong?



    • Hi ,
      The question , really at the most basic level , tests your knowledge about the different node types that are allowed within a specific node type . The point to remember is that
      1- A nt:unstructured node CANNOT be created under the type ‘nt:folder’.Go ahead , try it, it’s not gonna happen ! But it can be created under folder .

      2- If something cannot be saved , then any subsequent node created willalso not be saved , irrespective of the fact , that it’s allowed or not allowed.

      Actually , this question was seen in other forms also , and in this form .
      For e.g. – > A node was created of the type ‘nt:unstructured’ inside the ‘apps’ folder . Another folder was created , under apps folder. After saving what will happen ?

      So here , nothing will be saved and exception will be thrown. So remember that question can change its form . You have to grasp the knowledge hidden behind it .

      Here , of course you are right . It will be saved , without any problems .


  23. Hi Hashim,

    I have an issue with uploading images in CQ5.6. After I upload an image in damadmin, the status shows it triggered the workflow “DAM update asset” and stuck at step “continue updating?”. The image is finally available after a couple of hours… which is not ideal.

    When I opened the workflow console, I could see quite a lot STALE instances (all related to DAM update asset) and a few RUNNING instances.

    I wonder how I could improve this workflow process. Thanks in advance for any assistance you can provide.




    • Hi Gary,

      There is a workflow which gets triggered as soon as you upload an asset in AEM DAM. If you don’t want that workflow to be triggered automatically you can visit the workflow launcher console and disable the launcher for sometime. Then upload the images in DAM and trigger workflow manually for renditions when the server load is less.

      Alternatively you can explore Webdav to upload your images into the CRX. You may follow this if the number of images is too huge.

      Another approach could be to explore Workflow Purge, which will purge your instances after an interval of time periodically and would decrease the load on your server.

      I hope these would help you sort of this problem. You may choose any of the approach as per your business need.

      Kind Regards


    • Hi Salamao ,
      This question has multiple answers associated with it .
      The key to answering this question is that
      1 – For publish mode we can specify config.publish ( to make sure that this runs ONLY in publish
      So , the option would contain config.publish in it’s path

      2- The configuration should have a primary type of sling:OsgiConfig .

      This question has two right answers . It has already been answered in this page . Foor further clarity please refer to the above questions .


  24. Hi Hassim:
    I have written a groovy script similar to yours; I got 4 pages and iterated down their trees looking for specific properties. I chose to recurse vs. iterate query result sets as the result sets were too large for memory. I am running this script OUTSIDE of the groovyconsole and it works but it is slow. Will there be a significant difference running from within the groovyconsole? I dont know why it is slow. Here is the process… I get 4 root nodes, loop down their trees and if the nodepath matches a regexp, I get modify a property in that node, modify it, then save in a batch based on batchcount…

    def rootMap = [:]
    rootMap.put(“SWATCHES”, getRootNode(queryManager, ‘swatches’).execute().nodes.nextNode())
    rootMap.put(“SHOP”, getRootNode(queryManager, ‘shop’).execute().nodes.nextNode())
    rootMap.put(“GROUPS”, getRootNode(queryManager, ‘groups’).execute().nodes.nextNode())
    rootMap.put(“SKUS”, getRootNode(queryManager, ‘skus’).execute().nodes.nextNode())

    //recursively process the root nodes, relinking images as you go
    def results = []
    rootMap.each{k, rootNode->

    relinkImages(rootNode, file, session, saveCount, k)


    Closure relinkImages
    relinkImages = { node, file, session, saveCount, mode->

    def nodePath = node.path
    if (nodePath =~ /.*image.*/)
    if (node.hasProperty(‘fileReference’))
    node.setProperty(‘fileReference’, “${IMGREPLACEMENT}”)
    //recurse through the children of the current node
    node.nodes.each {childnode->
    relinkImages(childnode, file, session, saveCount, mode)

    Any ideas how to speed this up?


    • Hi Shelli,

      I dont think there will be much difference within the groovy console too. The query seems quite heavy as it has 4 Queries along with recursive execution of each rootnode . If you may use direct queries for searching the imageNodes within the rootNodes instead of a recursive operation, it might reduce the time.

      Moreover there should be a possibility to reduce the complete operation into a single Query Search instead of a 2 step operation. Let me know the actual business requirement , I would try it here myself.



  25. Hi Hashim,

    Thanks for such a nice website on AEM. I like your blog structure and content.

    I have one question on workflow.

    1. I want to capture input(“Reason for request”) in textbox from the initiator when he starts the workflow. How can I do that?
    2. I will be using that input in the later stage where I will send email to Approver along with “Reason for request”.

    I am clear with 2(how to send email). can you please help with 1(User input capturing)


    • Hi,
      There can be a few ways to implement the use case you are stating.

      1. You may add an extra workflow step (first step on the workflow) , which might go directly to initiator. Use Dialog participant Step in this step and seek all the input you need from initiator. Further you may add the input in metadata and use them in subsequent steps.

      2. In the Page itself, take the inputs from the initiator and add the data into the page jcr node. You can pick that data in any of the steps from the payload node. You may also give a button to the Initiator on the page and then on the click of a button, initiate the workflow via JAVA code.

      3. You can ask initiators to add the input data directly into the arguments/comments of the workflow too. That can be retrieved in the further steps.



  26. Hi Hashim,

    Can you please confirm the answer of below question

    You want to prompt a workflow user for information during the processing of a workflow step. Where is the content that the workflow user entered stored?

    A. As part of the page.
    B. As part of the workflow model.
    C. As part of the workflow instance.
    D. As part of the design.


  27. Hi Hashim,

    Can you please let me know the correct answer for the below question.

    You have changed the CRX admin password. Which console or tool do you also need to update? A. CRXDE Lite B. CQSE Admin Console C. Apache Felix Web Console D. CQ User Administration Console


  28. Hi,

    Can you please let me know the answer for the below.

    Which property is deprecated while resolving a template (T) that can be used for page (P)
    1] cq:allowedTemplates property of jcr:content subnode of P or an ancestor of P
    2] allowedPaths property of T
    3] allowedParents property of T
    4] allowedChildren property of template of P


  29. Hi,

    Can you please let me know the answer for the below :

    When installing IIS, which application development feature needs to be enabled to work with AEM dispatcher?
    – ISAPI filters
    – ISAPI extensions
    – Server side includes
    – CGI


  30. Hi,

    Can you please let me know the answer for the below :

    You want to restrict the size of a custom log file and enable log file rotation. Which Apache sling configuration has to be changed in AEM web console?
    – Apache sling composite health check
    – Apache sling Job manager
    – Apache sling logging logger configuration
    – Apache sling logging writer configuration


  31. Hi,

    Can you please let me know the answer for the below :

    You are creating a new OSGI configuration in the repository. When are the configuration changes applied
    – Changes are applied as soon as the node is updated by restarting the service.
    – Immediately
    – After restarting CQ instance
    – By stopping and starting the bundle that refer the service.


  32. Hi there,

    I would like to request help with AEM and chef automation, I am new to this chef automation. Any insights with respect to chef automation and AEM will be greatly appreciated.

    And AEM deployment on EC2 if possible will be absolutely great.

    Thanks in advance.


  33. Hi Hashim,

    True amoung client library?
    1.Client library has primarytype value nt:folder
    2.Client library should be defined under /etc/clientlibs/projectname incude css use
    4.Day CQ HTML library manager service in felix is used to minify the generated css for better performance.

    is it option 4?

    Will system throws null poiner exception when using page.getTemplate.getPath() in publish mode?
    which command is recommended to get template path in author and publish mode
    1. page.getTemplate.getPath()
    2. property.get(“cq:template”,””)



    • Yes, the 4th is correct answer.

      2nd option will give you the template.

      These are basic questions, which you should be knowing if you are working on the tool. I dont find any use of memorizing the answers if you are not sure of the basics.

      Please read the basics thoroughly before taking the test .



  34. Hi i have a problem can you tell me how fix it?

    The pages are not getting open because org.apache.commons.lang3.StringUtils is not getting initialized. When i click on link it says server not found.
    See the below logs for this. We are not importing this class also.

    Caused by: javax.servlet.ServletException: java.lang.NoClassDefFoundError: Could not initialize class org.apache.commons.lang3.StringUtils


    • Hi,
      Its actually difficult to debug your problem without seeing a proper project structure. You should check whether this particular class has been included in your maven pom.xml . Also verify if there are specific dependencies regarding to this class.
      You can also check whether the specific jar is getting downloaded in your .m2 folder.

      This can be your starting points to debug it further.



  35. In staging publish when i click on a page it throws Server not found. when i check logs Caused by: javax.servlet.ServletException: java.lang.NoClassDefFoundError: Could not initialize class org.apache.commons.lang3.StringUtils is showing. how to resolve it ..


  36. Hi Hashim,

    I have written an EventListener to listen the events raised upon any property change for a DAM asset. The Listener is working fine but only the first time. When again event is raised, EventListener is not listening it. I need to restart the bundle everytime for it to work for me.

    Can you suggest what am I missing here?


    • Hi ,
      This shouldn’t be the case , if the code is correctly implemented. I cant comment exactly what is the issue here without seeing the code snippet. You can try to implement an existing Event Listener (from google) and then customize it according to your use case. Or else try to add Loggers in each of your methods and then debug the issue.



  37. Hi Hashim,

    I am developing an aem 6.1 based application. I have an requirement for url map like currently my url for all the pages are like, instead of such a big url i would like to trim this as .

    Means i want to replace /content/project/en_US/ with / which is common across all the pages, is there a way to achieve this.

    Thanks for help in advance.


Leave a Reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s