Showing posts with label aem. Show all posts
Showing posts with label aem. Show all posts

Tuesday, August 3, 2021

AEM local Set up

 

Setting up a local development environment is the very first step when establishing an Adobe Experience Manager or AEM. Below is the prerequisite list to setup AEM on local.


Prerequisites:

Following softwares are required for installation on one’s local environment:

AEM jar file- connect with Adobe to get jar file and license properties. You can get temporary license. If you working in an organization then you can coordinate with organization teams to get jar files.

Java( 8+) for AEM-6.5

java-11 for AEM sdk

Maven- 3.5+


 Java Setup

Ø      Download jdk-11 from official site. You can set up via zip extraction or directly with exe file.




For Java JDK 11- Path variables that need to be set:

  • Create the system or user variables for the following:
  • Open Advance system settings
  • Click Environment Variables

 

Click New in System Variable and add JAVA_HOME to set jdk. Click Ok.



 

Ø      Maven setup

o   Download maven from official site.

o   Extract and set up on your machine. Please follow link to set up on windows:

o   Setting up maven in system variable. Refer above’s screenshot.

Same environment steps for maven.

 Now click path in system variables.

Add below entries for java and maven:

Click New and add below bin path for “Java”

 %JAVA_HOME%\bin

 Click New and add below bin path for “Maven”

 %MAVEN_HOME%\bin

 Click ok and close environment variables.







Ø         AEM Setup

 

o   Copy aem jar file in any folder.

o   Extract the file in a folder.

o   Rename the aem-sdk jar file inside to cq-author-p-4502

    Paste license.properties files in his folder for aem 6.5 or below versions.







o   There is one more dispatcher zip if you are installing aem-sdk. Please ignore at this moment. It would be used for dispatcher setup.




o   Open command prompt here

o   Run below command to create author instance on local machine:

 

 java -jar cq-author-p4502.jar in command prompt.

 

when prompted to enter a password use “admin” as password.



o   Server will be up in 4-5 minutes and the AEM console will open on port 4502.

o   It means author instance is running on 4502 port.

o   Following screen comes up when the server is up:


o   You need to login with the userId/password as admin/admin

and following screen opens and you are good to go! 😊

 


Similarly, setup publish environment by renaming jar file to “cq-publish-p-4503”. It means your publish instance will run on 4503 port.


To start server manually- use below command:


Go to crx-quickstart /bin folder


double click start.bat file for windows

or

run ./start in terminal for mac/linux






Sunday, June 14, 2020

Debugging in AEM and IDE

In this tutorial, we will first start AEM in debug mode and add remote debug connection in IDE(IntelliJ).

What is Debugging?

It is a systematic process of spotting and fixing the number of bugs, or defects, in a piece of software so that the software is behaving as expected. 

Debugging refers to identifying, analyzing, and removing errors. It is considered to be an extremely complex and tedious task because errors need to be resolved at all stages of debugging. 

When we work in IDE then we need to debug code to find or check what data is capturing.

We normally work on IntelliJ or Eclipse in the AEM project.

There are multiple ways to start AEM in debug mode.

    Step 1: Add the Remote Debugging JVM Parameter

    Start AEM with this JVM parameter

    -agentlib:jdwp=transport=dt_socket,address=8000,server=y,suspend=n
    

    Another way to launch AEM instance in debug mode: 
    Include it as a parameter when starting AEM with java -jar directly.

    •  java -Xmx512m -agentlib:jdwp=transport=dt_socket,address=30303,server=y,suspend=n -jar cq-author-4502.jar

    Another way to start AEM in debug mode, do changes in start.bat file for windows

    For Windows Users

    • Go to <AEM-Install>\crx-quickstart\bin
    • Open start.bat file
    • Go to line #25

    You can see line content is:

    if not defined CQ_JVM_OPTS set CQ_JVM_OPTS=-Xmx1024m -XX:MaxPermSize=256M -Djava.awt.headless=true
    

    Append below content to end of this line #25

    You can see line content is:

    if not defined CQ_JVM_OPTS set CQ_JVM_OPTS=-Xmx1024m -XX:MaxPermSize=256M -Djava.awt.headless=true
    

    Append below content to end of this line #25

    -debug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=<port>

    You can use the below line directly. I am using address 30303. You can map to any available port.

    if not defined CQ_JVM_OPTS set CQ_JVM_OPTS=-Xmx1024m -XX:MaxPermSize=256M -Djava.awt.headless=true -debug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=30303
    • Save start.bat file.
    • Start AEM now. Double click to start.bat to run your AEM instance.
    For Mac users:

    You can use the below line in start.sh directly in Mac OS. -z means zero length. for example, if [ -z "$CQ_JVM_OPTS" ]; then means if $CQ_JVM_OPTS is empty. 

      if [ -z "$CQ_JVM_OPTS" ]; then
      	CQ_JVM_OPTS='-server -Xmx2048m -XX:MaxPermSize=256M -Djava.awt.headless=true -agentlib:jdwp=transport=dt_socket,address=30303,server=y,suspend=n'
      	...
      fi
    • Start AEM instance using start.sh on Mac OS.
    The server is now running in debug mode.

    Step 2: Debugging in IDE- IntelliJ

    Open Project in IntelliJ Go to 

    Run > Debug

    IntelliJ debug

    After that below pop-up will appear

    IntelliJ debug Edit Config

    Click Edit Configurations.

    The below screen will appear on clicking "Edit configurations".

    add new configuration

    Click "+" to add a new configuration. Select "Remote"

    Remote config to add debug in intelliJ

    The below screen will appear on selecting Remote.

    Enter below configurations:

    debug configurations

    Name: You can add any name. I want to debug on my local AEM author instance so I used localhost-author.

    Host: IP address on which AEM instance is running. If it is running on the local machine then use "localhost".

    Port: Enter port number on which you have configured debug address. In my case it is "
    30303". You can refer #1 to check your debug port. I used below command to set up debug address:

    if not defined CQ_JVM_OPTS set CQ_JVM_OPTS=-Xmx1024m -XX:MaxPermSize=256M -Djava.awt.headless=true -debug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=30303

    Note: Command-line arguments automatically changed.


    Module: Select module to debug. You can select any module for debugging or directly your project name. I have selected "Core" as my java classes are in the core module.

    Click Apply and Debug.

    debug integrated


    Testing:

    Select the java file which you want to debug.
    Add a breakpoint to line
    from UI, Hit the respective URL.

    Remote Debug In IntelliJ

    You can see, your file is in debug mode.


    Congratulations!!! Your AEM instance is running in debug mode and can debug in IDE.


    ElasticSearch vs Apache SolrCloud

      Elasticsearch and Apache SolrCloud are both powerful, distributed search engines built on top of Apache Lucene. Both Elasticsearch and S...