Note: when running Kodo in WebLogic Server 10.3 or higher, Kodo-related
MBeans are automatically registered into the WebLogic Server MBean tree
by the container, and the kodo.JMX
setting is
effectively ignored.
The management and monitoring capability uses the Java Management Extensions (JMX) standard to allow for both local and remote management of key:
Attributes
Operations
Notifications / Performance Statistics
The unit of management in JMX is the Managed Bean (MBean). Kodo provides a number of MBeans that allow management of key components. For example, the connection pool MBean provides statistics on the numbers of active and idle connections, and allows modification of the attributes controlling the maximum number of active connections.
The default JMX implementation used by Kodo is MX4J version 1.1.1 (see
mx4j.sourceforge.net).
The MX4J jar, mx4j-jmx.jar
, is included in the Kodo
distribution, and is covered under the MX4J license, which can be found
in the lib
directory. To use a different implementation,
simply remove the mx4j-jmx.jar
file from your
CLASSPATH
and insert the appropriate jars for your
JMX implementation.
Note that the resource archive kodo.rar
provided with
Kodo does not include MX4J. This is because most application servers
provide their own JMX implementation. However, a small subset of the MX4J
implementation is included.
The management and monitoring capability can be run both locally and
remotely. An example of its use can be found in the management
sample described in
Section 1.2.2, “JMX Management”.
The Management capability is configured via the standard Kodo
configuration system using the
kodo.JMX
property.
This property is a plugin string (see
Section 2.4, “Plugin Configuration”), so you can also set it
to the full class name of a custom
ManagementConfiguration
. Pre-defined
values are:
none
: No management turned on.
This is the default.
mgmt
: Enable local management.
Suitable for use in JBoss and other environments
where all MBeans should be
registered with a JMX MBeanServer for either management via a
user defined mechanism, or via a mechanism defined by the
MBeanServer.
Supports optional parameters in the Management
Group
(see
Section 12.1.1, “Optional Parameters in Management Group”).
mx4j1
: Enable remote management
via MX4J v.1.x implementations (supporting versions of the JMX
specification prior to 1.2).
Supports optional parameters in the Management
Group
(see
Section 12.1.1, “Optional Parameters in Management Group”)
and the Remote Group
(see
Section 12.1.2, “Optional Parameters in Remote Group”).
jmx2
: Enable remote management
via JMX v.1.2 implementations (supporting JSR 160 for remote
management).
Supports optional parameters in the Management
Group
(see
Section 12.1.1, “Optional Parameters in Management Group”)
and the JSR 160 Group
(see
Section 12.1.3, “Optional Parameters in JSR 160 Group”).
gui
: Enable management, bringing up
the JMX management console in the local JVM.
Supports optional parameters in the Management
Group
(see
Section 12.1.1, “Optional Parameters in Management Group”).
wl81
: Enable WebLogic 8.1 management.
Supports optional parameters in the Management
Group
(see
Section 12.1.1, “Optional Parameters in Management Group”)
and the WebLogic 8.1 Group
(see
Section 12.1.4, “Optional Parameters in WebLogic 8.1 Group”).
Those kodo.JMX
plugins that
provide JMX based management have three optional parameters,
described in this section.
If JMX based management is desired, Kodo needs to either find an
existing MBeanServer
or create a new one.
Appropriate plugins for the configuration property
kodo.JMX
have an optional
parameter MBeanServerStrategy
that allows for
configuration of this process. The following options are available:
any-create
: Attempt to find an existing
MBeanServer
. If multiple are found, use
the first one. If none are found, create a new server.
This is the default.
create
: Do not attempt to find an
existing MBeanServer
. Always create a
new server.
agentId:<agent id>
: Attempt to
find an existing MBeanServer
with the
given agent id. If such a server is not found, create a
new server.
For example, in order to force creation of a new
MBeanServer
when doing remote management, include
the following line in your configuration:
JPA XML format:
<property name="kodo.JMX" value="remote(MBeanServerStrategy=create)"/>
JDO properties format:
kodo.JMX: remote(MBeanServerStrategy=create)
The other optional parameters are: EnableLogMBean
and EnableRuntimeMBean
.
EnableLogMBean
: When set to true,
indicates that the LogMBean
should be
registered.
EnableRuntimeMBean
: When set to true,
indicates that the RuntimeMBean
should
be registered.
For example, to register both the RuntimeMBean
and the LogMBean
, set
kood.JMX
to:
local(EnableLogMBean=true,EnableRuntimeMBean=true)
In order to do remote management, you need to start a remote JMX
adaptor. Once the adaptor has started, you need to start the GUI.
See Section 12.2, “Kodo Management Console” for more
information. The Remote Group
enables
configuration of the remote management adaptor. For adaptors other
than the mx4j-jrmp
adaptor, a custom
ManagementConfiguration
must be
defined. By default, the mx4j-jrmp
adaptor sets
up an RMI registry naming service on
rmi://localhost:1099
and registers an MX4J JRMP
JMX adaptor under the JNDI name jrmp
. To change
the host, port and JNDI name used, the following optional parameters
are available on those
kodo.JMX
plugins that support
the Remote Group
.
JNDIName
: The JNDI name under which to
register the remote JMX adaptor. Defaults to
jrmp
.
Host
: The hostname on which the RMI
registry naming service will listen. Defaults to
localhost
.
Port
: The port on which the RMI
registry naming service will listen. Defaults to
1099
.
For example, to listen on port 2345, set
kodo.JMX
to:
remote(Port=2345)
In order to do remote management using the JSR 160 standard
(supported by JMX implementations supporting JMX 1.2 and higher),
you need to start a remote JMX adaptor. Once the adaptor has
started, you need to start the GUI.
See Section 12.2, “Kodo Management Console” for more
information. The JSR 160 Group
enables
configuration of the remote management adaptor.
For convenience, the JSR 160 adaptor sets up an RMI registry
naming service on rmi://localhost:1099
and
registers the JMX Connector Server with it, by default. To change
the host, port and service URL used, the following optional
parameters are available on those
kodo.JMX
plugins that support
the JSR 160 Group
.
ServiceURL
: The JMX service URL name
under which to register the JMX Connector Server.
Defaults to
service:jmx:rmi://localhost/jndi/jmxservice
,
indicating that the RMI connector will be used and
registered under the JNDI name jmxsevice
.
NamingImpl
: The classname of the naming
service implementation to start in order to register the
RMI connector with a JNDI name. Defaults to
mx4j.tools.naming.NamingService
, which
is appropriate for MX4J v. 2.x. If set to the empty string,
no naming service will be started. This is appropriate
if a naming service is already running, or if a non-RMI
connector is used.
Host
: The hostname on which the RMI
registry naming service will listen. Defaults to
localhost
. This parameter is ignored
for connectors that do not register with a naming service.
Port
: The port on which the RMI
registry naming service will listen. Defaults to
1099
. This parameter is ignored
for connectors that do not register with a naming service.
For example, to have the RMI registry naming service listen on
port 2345, set kodo.JMX
to:
jmx2(Port=2345)
The following parameters must be set on those
kodo.JMX
plugins that support
the WebLogic 8.1 Group
.
Once WebLogic has started, the GUI needs to be started.
See Section 12.2, “Kodo Management Console” for more
information.
For additional requirements in order to do remote management, please
see Section 12.2.1.1, “Connecting to Kodo under WebLogic 8.1”.
UserName
: The username that Kodo should
use to access the WebLogic MBeanServer. This must be set.
Password
: The password that Kodo should
use to access the WebLogic MBeanServer. This must be set.
ServerName
: The server name of the
server whose MBeanServer to which Kodo should connect.
This must be set.
URL
: The URL to which Kodo should
connect to access the WebLogic MBeanServer. Defaults to
t3://localhost:7001
.
For example, set kodo.JMX
to:
wl81(UserName=admin,Password=admin,ServerName=myserver,URL="t3://localhost:7001")
You can configure the execution context name provider using the
kodo.ExecutionContextNameProvider
property.
Pre-defined values are:
stack (style: line, partial, full)
: Provider examines the current thread's
stack and builds an execution context name from that information.
When set to line
, the name will be the first non-Kodo stack line,
including class name, method name, and line number, if available.
When set to partial
, the full stack trace minus the Kodo lines will be used. When set to full
,
the entire stack trace will be used.
user-object
: Provider returns the user object specified in the current
EntityManager/PersistenceManager whose key is com.solarmetric.profile.ExecutionContextNameProvider
.
User objects can be set using the OpenJPAEntityManager.putUserObject(Object,Object)
or
PersistenceManager.putUserObject(Object,Object)
.
weblogic
: Provider returns the current transaction's name,
as defined by WebLogic transaction naming semantics.