Deploying projects to Apache Felix, Tomcat, and Karaf in VS Code
We’re expanding tooling support for containers and servers in different development environments. Our existing VS Code extension, Red Hat Server Connector, only provides functionality for Red Hat servers and runtimes like WildFly, Minishift, Red Hat JBoss Enterprise Application Platform (JBoss EAP), and Red Hat Container Development Kit. In this article, we introduce Red Hat Community Server Connector, the newest addition to our Visual Studio Code (VS Code) extensions.
Community Server Connector makes it easier than ever to deploy, run, debug, and test Open Service Gateway initiative (OSGi), Java EE and Jakarta EE, and other projects targeting diverse servers and runtimes. This new VS Code extension allows you to control Apache Felix, Apache Karaf, and Apache Tomcat with the same user interface (UI) and flexibility that you have in Server Connector. And don’t worry, we’ll continue to enhance Red Hat Server Connector as well.
This article offers a general introduction to Red Hat Server Connector. For a more detailed introduction, see my video demonstration, which includes use cases for Apache Felix, Apache Karaf, and Apache Tomcat.
Server Connector and Community Server Connector share a common UI, which is provided by the Remote Server Protocol (RSP) UI extension. Installing either server connector automatically pulls in this dependency. The server connector extensions can start and stop an RSP server. Much like a Language Server Protocol (LSP) instance, RSPs let you perform everyday tasks when working with servers or runtimes.
The Remote Server Protocol provides support for the following main tasks:
- Locate a server runtime on disk and configure it for use.
- Download a server runtime to disk and configure it for use.
- Start a server in normal or debug mode. (Only servers written in Java can be debugged at this time.)
- Stop a server.
- Add a deployment to a server, deploy it, un-deploy it, and so on.
- Run arbitrary actions exposed by the server type.
Everything you need to grow your career.
With your free Red Hat Developer program membership, unlock our library of cheat sheets and ebooks on next-generation application development.SIGN UP
Support for Apache runtimes
Next, we’ll look at Red Hat Community Server Connector’s support for three Apache runtimes: Apache Felix, Apache Karaf, and Apache Tomcat.
Community Server Connector supports Apache Felix versions 3.2, 4.6, 5.6, and 6.0. Apache Felix isn’t as full-featured as some other containers or web servers, so our tooling is necessarily limited. When Apache Felix starts via the command line, it typically dumps you right into a shell. Unfortunately, our extension does not launch the start command for the server; an
rsp-server in the background executes the start and forwards output to our VS Code extension. As a result, there’s no good way to allow users to interact with the OSGi shell.
We still allow you to publish deployments to the OSGi
bundle/ folder via the UI, but the container won’t reload the changes until you restart. To make up for this, the Apache Felix server adapters contain an action to stop the server, wipe the
felix-cache folder, and start the container again. See the Red Hat Community Server Connector video demo for more about this functionality.
Red Hat Community Server Connector supports Apache Karaf version 4.8. When started, Apache Karaf (like Apache Felix) automatically launches you into a shell. In this shell, you can install features, control OSGi bundles, and more. As with Apache Felix, we cannot provide user interaction within the shell upon startup. Apache Karaf is significantly more full-featured than Apache Felix, however. Once startup is complete, a user action connects to Apache Karaf’s shell via SSH in the terminal inside VS Code, which gives you more flexibility for adding or removing features, controlling deployments, and modifying configurations.
The video demo shows a pair of interesting use cases for Apache Karaf. The first involves deploying and controlling a simple OSGi bundle. The second shows you how to configure the tooling required to implement routes in Apache Camel.
The final supported runtime is Apache Tomcat, with support for Tomcat versions 5.5, 6.0, 7.0, 8.0, and 8.5. The functionality here is fairly typical. You can start and stop the server in run or debug mode, and you also have options for exploded deployments and making incremental changes to static files like HTML or JavaServer Pages (JSP). The video demo shows both packaged (WAR) and exploded deployments for Apache Tomcat.
If you are using Apache servers and runtimes on a daily basis, you might find Red Hat Community Server Connector a useful extension to have in your VS Code environment. Watch the video demonstration for a complete introduction to our new VS Code extension and then go see what you can do with it.