Karaf IRC channel : Apache Karaf IRC
By default Jetty is configured to bind to any network device on port 8181. The configuration of the port must be done via the ConfigAdmin OSGi service. Just drop the configuration file org.ops4j.pax.web.cfg into the etc folder with the following content:
Any additional configuration can be done in the jetty.xml file.
To execute a script (file with Karaf shell commands) the command
shell:source has to be used.
Bundles can be installed via various methods.
deploy folder is one method. Bundles dropped in the
deploy folder are automatically installed and started.
Bundles can be installed from on OSGi Bundle Repository (OBR) (similar to a Maven repository, but not compatiblel with it). The commands in the schema
obr are used to manage and use OBRs.
install command can be used to install bundles from various sources, like local filesystem, HTTP server, local Maven repository.
The type of artifact can be passed in the last segment of the url and is optional. By default it will look out for an artifact of type
To list the installed bundles use the command
bundle:list. This will list the installed bundles from a given start level, default 100. To list all bundles starting from a specific level you have to add the level to the command.
bundle:list -t <level>
During development it is very inconvenient to manually reload the new bundle version to test the last change. Karaf supports to automatically reload watched bundles. There are some requirements for this to work. The bundles must be installed via the
install command with the version passed to the command.
To watch the bundle add it to the watch list either by specifying the group/artifact/version string or just by specifying the bundle id in the system.
The check interval can be specified with the
i option (in ms).
bundle:watch -i 500
Don't forget to start the watch by
To list all exported packages use the command
package:exports | grep servlet.
Commands can be grouped by a common name. All bundle related commands are available in the group
bundle. By default you can access a command by prefixing the group, f. e. bundle:list.
But you can also go into that group and have only the commands of this group available. That is called a
subshell. You have only a subset of the normal shell available.
To enter a subshell type the group name and press enter. To exit the subshell use the command
List deployed servlets:
To add a repository use the feature:repo-add command.