Some days ago I had to restart the AEM Jetty web server to reset some service caches. Usually it would be much better to restart AEM and keep life simple, but I hadn’t ssh access to that remote machine. Nevertheless and independently how you may come across to this situation, this post will help you if your AEM web server doesn’t start.

What happens if you stop the Jetty bundle?

Lets say you go the bundles view of the Apache Felix OSGi web admin console and you stop the Jetty bundle. Great, you have to know that if you stop the web server:

  1. There is NO web admin console! It may sound obvious, but if the web server is stopped, no one is going to serve you any web administration console or web interface.
  2. It doesn’t matter if you restart now the AEM server, save your time. If you stop a bundle, when you restart AEM / OSGi, it will remaining resolved. This may not be so problematic with other bundles, but with the web server you could think… And now how can I fix this?

Apache Felix + Gogo to the rescue

OK, we don’t have access to the web administration console, but Apache Felix OSGi is still working, the only issue, is that the Jetty bundle doesn’t start. At this point I remembered, that one day reading the Felix documentation, I found about Apache Gogo.

Apache Gogo is shell for OSGi based environments. It will allow us to access and control Apache Felix on the command line.

Strategy

Our strategy will consist on installing Apache Gogo, accessing OSGi with the command line and restarting the resolved HTTP bundle.

Apache Gogo installation

To install Apache Gogo we will do the following:

  1. Download Gogo bundles:
    1. Command: implements the basic commands.
    2. Runtime: implements the command processing functionality.
    3. Shell: provides an interface to interact with the command line.
  2. Copy these bundles into the crx-quickstart/install folder in order to install them automatically.
  3. Download the Remote Shell bundle and copy it into the crx-quickstart/install folder.

Apache Gogo – OSGi admin in your shell

Once we have installed Gogo we will restart the Jetty bundle with the command line.

  1. Open a shell or terminal and introduce telnet localhost 6666. Gogo will be listening at the port 6666 by default. The result will be something similar to what you can see in the following snippet. You should be able to see Gogo’s shell symbol g! to start introducing commands.
  2. Introduce the command lb http or lb jetty to list all http related bundles
  3. Here we can see that the Apache Felix Http Jetty bundle is resolved. We also see that its bundle number is 28, so we will execute the following command to restart it:
  4. To check if Jetty is back to life, we will execute again lb http.

    ¡Perfect! It is active again, try to open the web interface and check that everything is neat and pretty.
  5. Introduce Ctrl + D to exit telnet and Gogo.
  6. Uninstall the last bundle we installed, Apache Felix Remote Shell (org.apache.felix.shell.remote). This is important to avoid possible attacks at this port in the future.

I hope this has been useful for you and that you found this week’s post interesting. I invite you share it with your friends and to subscribe to my newsletter to stay tuned for new interesting content!

AEM web server doesn’t start? How to restart it with Apache Gogo
Tagged on:             

2 thoughts on “AEM web server doesn’t start? How to restart it with Apache Gogo

  • May 25, 2016 at 11:04 am
    Permalink

    something very different but much insight full.

    Really good post – keep sharing such Gems.

    Good Luck

Comments are closed.