Expand my Community achievements bar.

Enhance your AEM Assets & Boost Your Development: [AEM Gems | June 19, 2024] Improving the Developer Experience with New APIs and Events
SOLVED

Fail to restart AEM local server via "java -jar aem-author-p4502.jar"

Avatar

Level 2

Steps to reproduce my issue:

***I have all the setup/environment working fine.***

STEP 1

 and I can start AEM local server via run "java -jar aem-author-p4502.jar".  the server runs and I can develop on the aem local server with no problem.

STEP 2

I try to stop the AEM local server via execute "ctrl + z" (my system is macos), it works fine as well, the local server is down.

STEP 3

when I try to start the AEM local server again via the same command line "java -jar aem-author-p4502.jar", it give me the error below:

Loading quickstart properties: default
Loading quickstart properties: instance
Low-memory action set to fork
Using 64bit VM settings, min.heap=1024MB, min permgen=256MB, default fork arguments=[-Xmx1024m, -XX:MaxPermSize=256m]
The JVM reports a heap size of 4096 MB, meets our expectation of 1024 MB +/- 20
Setting properties from filename '/Users/james/htdocs/aem-sdk/author/aem-author-p4502.jar'
Option '-quickstart.server.port' set to '4502' from filename aem-author-p4502.jar
Verbose option not active, closing stdin and redirecting stdout and stderr
Redirecting stdout to /Users/james/htdocs/aem-sdk/author/crx-quickstart/logs/stdout.log
Redirecting stderr to /Users/james/htdocs/aem-sdk/author/crx-quickstart/logs/stderr.log

STEP 4

I restart my laptop and try again, the command works again, so what's the root cause to this issue?

Do I have to restart my laptop every time to resolve this problem?

 
 

 

 

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hello @James_shan  - 

 

  1. Check Log Files: Examine the log files located at /Users/james/htdocs/aem-sdk/author/crx-quickstart/logs/stdout.log and /Users/james/htdocs/aem-sdk/author/crx-quickstart/logs/stderr.log. Look for any error messages or exceptions that may indicate the cause of the startup failure.

  2. Verify Port Availability: Ensure that the port specified in the log message, which is 4502 based on "Option '-quickstart.server.port' set to '4502' from filename aem-author-p4502.jar", is not already in use by another application. If the port is occupied, you may need to choose a different port number for the AEM server.

 

And additionally you can try doing following in a CMD terminal : 

1. lsof -i :4502

2. kill -9 <PID>

3. To confirm that the AEM instance has been successfully terminated, you can re-run the lsof command (mentioned in step 1)

 

 

View solution in original post

6 Replies

Avatar

Community Advisor

Hi @James_shan ,

 

Seems the port is already in used. You can try this command to kill the port

lsof -t -i tcp:4502 | xargs kill -9 

 

Avatar

Level 2

thanks @MayurSatav this command works for me that can kill the port, but this command bring me another problem, my firefox browser will be forced out when I execute this command.

Avatar

Correct answer by
Community Advisor

Hello @James_shan  - 

 

  1. Check Log Files: Examine the log files located at /Users/james/htdocs/aem-sdk/author/crx-quickstart/logs/stdout.log and /Users/james/htdocs/aem-sdk/author/crx-quickstart/logs/stderr.log. Look for any error messages or exceptions that may indicate the cause of the startup failure.

  2. Verify Port Availability: Ensure that the port specified in the log message, which is 4502 based on "Option '-quickstart.server.port' set to '4502' from filename aem-author-p4502.jar", is not already in use by another application. If the port is occupied, you may need to choose a different port number for the AEM server.

 

And additionally you can try doing following in a CMD terminal : 

1. lsof -i :4502

2. kill -9 <PID>

3. To confirm that the AEM instance has been successfully terminated, you can re-run the lsof command (mentioned in step 1)

 

 

Avatar

Community Advisor

@James_shan 

All the logs added above are normal.

1. Please check the error.log. If system is a little slow, AEM might take long to start. Do the logs continue to tail like "Bundle started" or "Package Installed"? that means server is still starting. Wait for logs to stabilize

2. Check Bundle status via http://localhost:4502/system/console/bundles. They might still be in the process of getting Active

3. Check stderr.log for any errors


Aanchal Sikka

Avatar

Level 4

Hi James,

 

What is the response when you load http://localhost:4502/aem/start.html

Also try with the ip 127.0.0.1:4502 if the above doesn't work.

 

Thanks,

Sweta

 

Avatar

Community Advisor

Hi @James_shan ,

Can you try to run your aem jar with below command and check if its running fine

For ex: java -jar cq-author-4502.jar -Xmx1024m -XX:MaxPermSize=256m