-
Book Overview & Buying
-
Table Of Contents
APACHE KARAF COOKBOOK
By :
By default, Apache Karaf can be administered via Java Management Extensions (JMX). However, systems builders often need to tweak the default configurations to get their deployment integrated into their network. In this recipe, we'll show you how to make these changes.
The ingredients of this recipe include the Apache Karaf distribution kit, access to JDK, and a source code editor. The sample configuration for this recipe is available at https://github.com/jgoodyear/ApacheKarafCookbook/tree/master/chapter1/chapter1-recipe5.
Administrators should take care when exposing JMX access to their Karaf instance. Enabling of SSL and use of strong passwords is recommended.
etc/org.apache.karaf.management.cfg file. Consider the following code:# # Port number for RMI registry connection # rmiRegistryPort = 11099 # # Port number for RMI server connection # rmiServerPort = 44445
The default ports, 1099 and 44444, are usually fine for general deployment. Change these ports only if you are experiencing port conflicts on your deployment. Now, consider the following snippet:
#
# Role name used for JMX access authorization
# If not set, this defaults to the ${karaf.admin.role} configured in etc/system.properties
#
jmxRole=adminTowards the bottom of the configuration file, there will be a commented-out entry for jmxRole; enable this by removing the hash character.
etc/users.properties file with the following code:karaf = karaf,_g_:admingroup _g_\:admingroup = group,admin,manager,viewer,jmxRole
The users.properties file is used to configure users, groups, and roles in Karaf. We append jmxRole to the admin group. The syntax for this file follows the Username = password, groups format.

After restarting Karaf, use a JMX-based admin tool of your choice (the previous screenshot shows JConsole) to connect to the container. Due to image size restrictions, the full URL couldn't be displayed. The full URL is service:jmx:rmi://127.0.0.1:44445/jndi/rmi://127.0.0.1:11099/karaf-root. The syntax of the URL is service:jmx:rmi://host:${rmiServerPort}/jndi/rmi://host:${rmiRegistryPort}/${karaf-instance-name}.
Change the font size
Change margin width
Change background colour