14 Sep AEM web server doesn’t start? How to restart it with Apache Gogo
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:
- 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.
- 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.
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:
- Download Gogo bundles:
- Copy these bundles into the crx-quickstart/install folder in order to install them automatically.
- 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.
- 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.
Shell123456789$ telnet localhost 6666Trying ::1...telnet: connect to address ::1: Connection refusedTrying 127.0.0.1...Connected to localhost.Escape character is '^]'.____________________________Welcome to Apache Felix Gogog!
- Introduce the command
lb jettyto list all http related bundles
Shell12345678910111213g! lb httpSTART LEVEL 30ID|State |Level|Name27|Active | 5|Apache Felix Http Api (2.3.0.R1570612)28|Resolved | 5|Apache Felix Http Jetty (2.3.0.R1579739)29|Active | 5|Apache Felix Servlet API (0.0.1.R1570612)30|Active | 5|Apache Felix Http Whiteboard (2.2.1.R1239578)52|Active | 9|Apache Felix Http SSL Filter (0.0.1.R1394715)137|Active | 20|Adobe Granite HTTP Cache - Core Bundle (1.0.0)166|Active | 20|Day Commons Library - HTTP Client 3.1 Bundling (3.1.0.018)396|Active | 20|Apache Felix Http SSL Filter (0.1.0)
- 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:
Shell1g! start 28
- To check if Jetty is back to life, we will execute again
Shell123456789101112g! lb httpSTART LEVEL 30ID|State |Level|Name27|Active | 5|Apache Felix Http Api (2.3.0.R1570612)28|Active | 5|Apache Felix Http Jetty (2.3.0.R1579739)29|Active | 5|Apache Felix Servlet API (0.0.1.R1570612)30|Active | 5|Apache Felix Http Whiteboard (2.2.1.R1239578)52|Active | 9|Apache Felix Http SSL Filter (0.0.1.R1394715)137|Active | 20|Adobe Granite HTTP Cache - Core Bundle (1.0.0)166|Active | 20|Day Commons Library - HTTP Client 3.1 Bundling (3.1.0.018)396|Active | 20|Apache Felix Http SSL Filter (0.1.0)
¡Perfect! It is active again, try to open the web interface and check that everything is neat and pretty.
Ctrl + Dto exit telnet and Gogo.
- 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!