Expand my Community achievements bar.

How to start AEM in debug mode? | AEM Community Blog Seeding

Avatar

Administrator

BlogImage.jpg

How to start AEM in debug mode? by Rashidjorvee

Abstract

There are multiple approaches to start or tune AEM instance in debug mode. we will cover few of them in this tutorial.


We coudl start AEM using the command pormt by using the below command line.
java -jar aem63-author-p4502.jar -debug <port#>
Another way to start tune AEM instance in debug mode is we could update the start.bat file and start AEM by clicking on the start.bat file in crx-quickstart folder. To do so we have to do the following.
First we need to update the start file; go to \crx-quickstart\bin\start.bat and append this command "-debug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=<port#>" with line 25, default JVM options.
Save the file
Now double click on the start.bat file to start your AEM instance.


@echo off
:: This script configures the start information for this server.
::
:: The following variables may be used to override the defaults.
:: For one-time overrides the variable can be set as part of the command-line; e.g.,
::
:: SET CQ_PORT=1234 & ./start.bat
::
setlocal

::* TCP port used for stop and status scripts
if not defined CQ_PORT set CQ_PORT=4502

::* hostname of the interface that this server should listen to
:: if not defined CQ_HOST set CQ_HOST=

::* runmode(s)
::* will not be used if repository is already present
if not defined CQ_RUNMODE set CQ_RUNMODE=author

::* name of the jarfile
:: if not defined CQ_JARFILE set CQ_JARFILE=

::* default JVM options
if not defined CQ_JVM_OPTS set CQ_JVM_OPTS=-Xmx2048m -XX:MaxPermSize=512M -Djava.awt.headless=true -debug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=30303

::* ------------------------------------------------------------------------------
::* authentication
::* ------------------------------------------------------------------------------
::* when using oak (crx3) authentication must be configured using the
::* Apache Felix JAAS Configuration Factory service via the Web Console
::* see http://jackrabbit.apache.org/oak/docs/security/authentication/externalloginmodule.html

::* use jaas.config (legacy: only used for crx2 persistence)
:: if not defined CQ_USE_JAAS set CQ_USE_JAAS=true

::* config for jaas (legacy: only used for crx2 persistence)
if not defined CQ_JAAS_CONFIG set CQ_JAAS_CONFIG=etc\jaas.config

::* ------------------------------------------------------------------------------
::* persistence mode
::* ------------------------------------------------------------------------------
::* the persistence mode can not be switched for an existing repository
set CQ_RUNMODE=%CQ_RUNMODE%,crx3,crx3tar
:: set CQ_RUNMODE=%CQ_RUNMODE%,crx3,crx3mongo

::* settings for mongo db
:: if not defined CQ_MONGO_HOST set CQ_MONGO_HOST=127.0.0.1
:: if not defined CQ_MONGO_PORT set CQ_MONGO_PORT=27017
:: if not defined CQ_MONGO_DB set CQ_MONGO_DB=aem6

::* ------------------------------------------------------------------------------
::* do not configure below this point
::* ------------------------------------------------------------------------------

chdir /D %~dp0
cd ..
if exist conf\controlport del conf\controlport
if not defined CQ_JARFILE for %%X in (app\*.jar) do set CQ_JARFILE=%%X
for %%* in (.) do set CurrDirName=%%~n*
cd ..

set START_OPTS=start -c %CurrDirName% -i launchpad
if defined CQ_PORT set START_OPTS=%START_OPTS% -p %CQ_PORT%
if defined CQ_RUNMODE set CQ_JVM_OPTS=%CQ_JVM_OPTS% -Dsling.run.modes=%CQ_RUNMODE%
if defined CQ_HOST set CQ_JVM_OPTS=%CQ_JVM_OPTS% -Dorg.apache.felix.http.host=%CQ_HOST%
if defined CQ_HOST set START_OPTS=%START_OPTS% -a %CQ_HOST%
if defined CQ_MONGO_HOST set START_OPTS=%START_OPTS% -Doak.mongo.host=%CQ_MONGO_HOST%
if defined CQ_MONGO_PORT set START_OPTS=%START_OPTS% -Doak.mongo.port=%CQ_MONGO_PORT%
if defined CQ_MONGO_DB set START_OPTS=%START_OPTS% -Doak.mongo.db=%CQ_MONGO_DB%
if defined CQ_USE_JAAS set CQ_JVM_OPTS=%CQ_JVM_OPTS% -Djava.security.auth.login.config=%CQ_JAAS_CONFIG%
set START_OPTS=%START_OPTS% -Dsling.properties=conf/sling.properties

if exist newTaskList.txt del newTaskList.txt
if exist oldTaskList.txt del oldTaskList.txt
tasklist /FI "IMAGENAME eq java.exe" /NH > oldTaskList.txt
start "CQ" cmd.exe /C java %CQ_JVM_OPTS% -jar %CurrDirName%\%CQ_JARFILE% %START_OPTS%

:: removing the delay until CQ-4202186 is solved
:: timeout /T 1 /NOBREAK >nul

tasklist /FI "IMAGENAME eq java.exe" /NH > newTaskList.txt
java -cp %~dp0 GetProcessID oldTaskList.txt newTaskList.txt java.exe > %CurrDirName%\conf\cq.pid
if exist newTaskList.txt del newTaskList.txt
if exist oldTaskList.txt del oldTaskList.txt

Read Full Blog

How to start AEM in debug mode?

Q&A

Please use this thread to ask the related questions.



Kautuk Sahni
0 Replies