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

svn co sling

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

git clone


# Building

Sling is a Maven project so, just build it.

cd sling
mvn clean install

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

java -jar launchpad/builder/target/

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


java -Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,address=9001,server=y,suspend=n -jar launchpad/builder/target/

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  🙂


Allan de Queiroz

Allan de Queiroz
London based software engineer

XServer forward from Linux text mode for Headless purposes.

Hello, this post is about XServer forward from Linux text mode, **not ssh forward, anything related to VNC** or things like that.Recently...… Continue reading