dinsdag 25 december 2012

Running the Apache Felix Webconsole from Eclipse

I have been told about the Apache Felix Web Console a couple of times. During all of these occasions the guy telling me this had this peculiar look in his eyes. The look that makes you think: "Okay dude, I can see that you are serious. I have to check this out." 



The first time I went down there I tried to follow the described steps. The page talks about an "all-in-one" install but it was nowhere to be found. Then I tried to install the individual components from the Felix download site but for some reason I went from one un-resolved dependency to another. So, at that point, they lost me.

Documentation... Once you are the expert you don't see where the newcomer gets lost. I am all to familiar with this. I believed we had created the easiest installation webpage for the Nebula community until I witnessed people trying to install.  

A few days ago I tried again, and basically with the same luck, so I started whining and left it again. However, it kept bugging me and I decided to finally research it until I was finished. And, you guessed it, it turned out the be quite easy.

Installing Apache Felix Webconsole into an Eclipse Installation

I am running a fresh copy of the Eclipse Classic installation. The first thing I did was to install the Felix webconsole. I downloaded the Web Console jar file from the Felix download site and dropped it into my Eclipse dropins directory.



Next I installed the three dependencies that are mentioned on the webconsole homepage:
  • Apache Commons IO
  • Apache Commons FileUpload
  • JSON
All of the above dependencies can be found in the Eclipse orbit repository. So I visited the Eclipse Orbit site and clicked on the download link to the right of the page. I always choose one of the latest stable builds and this is the link. That page contains the link to the P2 repository. 

Inside Eclipse, I fired up the "install new software" dialog and installed the three plugins. Please take care of the following:

Web Console needs an older version of commons io, version 1.4.0.  

Un-tick the "show only the latest.." checkbox in the dialog as indicated in the picture and select the three features from the list.



This should result in the following confirmation window:



Press Finish and restart.

Starting the Apache Felix Webconsole


The Web Console needs a web server to serve its pages. Fortunately, Eclipse Classic comes with a build-in web server called jetty.

After Eclipse has restarted, open the console view. From the console view, select to open the host OSGi console:


On the console prompt type "ss jetty"


I have number 93 so I type "start 93"


As you can see from the error, there is a socket error. Permission Denied. This is probably because jetty wants to start on a low port. And this is not allowed if you are not root. So, we need to tell jetty that it has to start on a high port.  Fortunately, this is documented on the webconsole homepage. Cool. It instructs you to pass the java system property:

-Dorg.osgi.service.http.port=8888

We can do this by adding this property to the eclipse.ini file and restarting.


Back in the Eclipse console we start jetty again and this time it is successful.  So, let's visit the webconsole and do a little dance:


Aiiii. It is not working! Why? We also need to start the webconsole bundle. 

"ss webconsole"



And now it works. Pretty cool!

Best Regards,

Wim


[1] http://felix.apache.org/site/apache-felix-web-console.html