Blueprint Developer Manual / Version 2110
Table Of ContentsThis component provides a common JMX infrastructure with the following features:
All beans which are added to the map
mbeans
will be exported as MBeans to an MBean serverAn MBean remote connector server (and a RMIRegistry if necessary) is started if a JMX service URL is specified
MBeans are exported automatically using a completed object name
The component is preconfigured in CoreMedia Blueprint but does not use the own remote connector server. Instead, the container's remote connector server is used which is the recommended way for CoreMedia Content Cloud.
Adding the JMX Component
If you want to add the JMX component to your own web application project, proceed as follows:
Adding JMX
Add the following dependency to your web application project:
<dependency> <groupId>com.coremedia.cms</groupId> <artifactId>management-component</artifactId> <scope>runtime</scope> </dependency>
Example 4.33. Dependency for JMX
Add a property
management.server.remote.url
to/WEB-INF/application.properties
to your application. The value of the property is the URL of the component's server. For example:service:jmx:rmi://localhost/jndi/rmi://localhost:1098/myapplication
This will start the adequate remote connector server so that the application's MBeans are available under the specified URL. If you want to use Tomcat's server, read the paragraph "Using Tomcat's remote connector server".
Every component has to register its MBeans by itself in order to make its MBeans available to the management component. Therefore, add a configuration like the following to the components descriptor in
/META-INF/coremedia/component-<component-name>.xml
.<import resource="classpath:/com/coremedia/jmx/mbean-services.xml"/> <bean id="myComponentMbeanRegistrator" class="com.coremedia.jmx.MBeanRegistrator"> <property name="registry" ref="mbeanRegistry"/> <property name="mbeans"> <map> <entry key="type=MyService" value-ref="myBean"/> </map> </property> </bean>
Example 4.34. Register the MBeans
The MBean's object name will be automatically completed, a configured name "type=MyService" will, for instance, be automatically transformed to
com.coremedia:type=MyService,application=<applicationname>
Using Tomcat's remote connector server
Instead of starting a custom remote connector server you might also use Tomcat's remote
connector server infrastructure. In this case, leave the property
management.server.remote.url
empty and pass the following properties to
Tomcat's catalina.bat/catalina.sh
file:
-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=8008 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false
Example 4.35. Use Tomcat remote connector server
If you require authentication add and change the properties as follows and provide the appropriate access and password file:
-Dcom.sun.management.jmxremote.authenticate=true -Dcom.sun.management.jmxremote.password.file= \ ../conf/jmxremote.password -Dcom.sun.management.jmxremote.access.file= \ ../conf/jmxremote.access
Example 4.36. Use Tomcat remote connector server with authentication
See also Enabling_JMX_Remote in Tomcat documentation and JmxRemoteLifecycleListener in Tomcat documentation for how to enable JMX for Tomcat.
Now, you can reach Tomcat's remote connector via
service:jmx:rmi:///jndi/rmi://localhost:8008/jmxrmi