Yes, we love building modular web applications, if they just were easier to deploy on a server! Wrapping OSGi applications in WAR files, apparently still the most popular deployment option for RAP, results in a complicated setup: a web app containing an OSGi runtime together with all bundles, configuration, and a bridge servlet that delegates requests to the embedded OSGi – that’s hard to build, hard to change, and hard to debug. Why can’t we just throw our application bundles into a webserver and simply turn it on?
Actually, we already have this technology in Eclipse, we just need to make it easier to use. To do so, the Eclipse RAP project and the Virgo project recently worked together to create a lightweight server for RAP applications that supports those out-of-the-box deployments. This package, we call it the “Virgo RAP Server”, is an OSGi container based on Equinox, running the Jetty web server, and it’s pre-equipped with all bundles required to run a RAP application – with one exception: workbench applications are not (yet) supported.
Running your application on this server requires only these three steps:
1. Extract the zip file to a folder of your choice
$ unzip virgo-nano-rap-3.7.0.CI-2014-02-21_02-04-03.zip $ cd virgo-nano-rap-3.7.0.CI-2014-02-21_02-04-03
2. Copy your application bundles into the
$ cp ~/org.example.rap-1.0.0.jar pickup/
3. Start the server using the startup script in
That’s it! Now you can access your application at http://localhost:8080/example (replace “/example” with the servlet path of your entrypoint).
The Virgo RAP server comes with a nice admin console that can also display package and service wirings between bundles. You can access it at http://localhost:8080/admin. The default credentials are admin:admin.
If you want to get rid of the console for production, simply remove the bundle org.eclipse.virgo.management.console from the
Here’s are short list of things you may like to configure:
Change HTTP port
Per default the embedded Jetty is running on port 8080. The port can be configured in
Enable Equinox OSGi console
The OSGi console is deactivated by default. It can be enabled for access via SSH and/or telnet in
telnet.enabled=true telnet.port=2401 telnet.host=localhost ssh.enabled=true ssh.port=2402 ssh.host=localhost
The log files can be found in
serviceability/logs. Logging is configured in
configuration/serviceability.xml, for a description of the syntax and facilities provided by this file, please consult the LOGBack Manual.
To enable remote debugging, start the server in debug mode by adding the parameter
-debug to the startup script. Optionally you can also add the
-suspend flag to suspend the VM on startup until your IDE connects. For example, you can use this method to observe the startup of your already deployed bundles.
If there’s interest in this deployment option, we plan to provide a stable version of the Virgo RAP server together with this year’s Eclipse release “Luna”, in June 2014.
Let us know what you think! Could this be an interesting option for your project?