Building, running and debugging Apache Sling

Recently I felt like playing a little bit with OSGI using Apache Felix, after some reading and coding, I found Apache Sling a REST based web framework that integrates Felix and JCR so, this post intends to save my notes about building, running and debugging Apache Sling for future needs  😉


# Checking out source files

If you are familiar with SVN (I was, but not any more) you can checkout sources there

Or if you don’t, clone it from GitHub (recommended)


# Building

Sling is a Maven project so, just build it.

And more than one hour later, it’s done.

Sling build


# Executing

Now just take a look inside of launchpad/builder/target/ you’ll see two files, one .jar and another .war, you can use anyone, is up to you, but I’ll use .jar that comes with an embedded application server, all you have to do is execute it

If not wrong happend, you can see the main page at http://localhost:8080/index.html

To Sling, everything is content and you can check it out at the explore page http://localhost:8080/.explorer.html

And the console, where you can see and manage OSGI bundles and anything else http://localhost:8080/system/console/bundles. Login and password are both admin


# Debugging 

Now, stop the previous execution “java -jar” and make it simple, create a new file and paste the following content there

Execute it


# Attaching your IDE

I don’t know what IDE you use but the concept is the same, you’ll debug remotely, for example, if you use IntelliJ, in the Servers view, add a new “remote” Tomcat server and point it to the same port used in the above script “address=9001

Run it. Now you can debug not “just” all Sling, but your future packages too  🙂


Leave a Reply