Loading the OSGi Web Console into Glassfish

For a while now Glassfish has been built on OSGi, which is a fantastic win for a lot of developers working with enterprise java. Want to include modular OSGi software in your stack without having to install new servers and runtimes? No problem to those of you running Glassfish!

Here ill go through the process of starting the OSGi web console (which is like the normal admin screens, but for OSGi). Soon ill be posting a few guides on setting up a stats reporting system which will allow you to easily log events from within your code into a Graphite server.

Setup

Are your running version 3 of glassfish? Then your all done!

Unfortunately those of you on older versions of Glassfish are out of luck, this is V3 only.

Deploying

You can deploy bundles into Glassfish in 4 ways, these are via asadmin commands, osgi remote shell commands, auto deploy file locations and the web console.

Ideally we want to only use the web console to make life easy, but to set that up we need to deploy the web console itself. I would note that for more involved work, CI servers, scripted deployment, etc that command line and auto deploy do come into their own, but for our simple needs right now the web console is a great start.

Glassfish will automatically deploy any bundles it can find in the location:

<install path>/glassfish/domains/<your domain>/autodeploy/bundles/

All you need to do is drop your bundles in there and Glassfish will deploy them, if you remove them they get undeployed and you can even do this with the server running if you want. Therefore to setup the web console you just need to get the latest full web console jar from the Felix downloads page and drop it in here.

Thats it, if you check the logs you should see it installed and was started!

Console

Finally all thats left to do is log into the Glassfish web console, go to your server at the following address:

http://<hostname>:8080/osgi/system/console

You will need to login, the default user and pass is admin/admin and you should end up at the following screen.

The OSGi Web Console

Next up, will be creating some OSGi bundles that will allow you to extend Glassfish…

 

Leave a Reply