Apr 04
Configuring JRun and ColdFusion with JMX
Posted by James Netherton | Wednesday 04 April 2007 9:52 PM | In ColdFusion
ColdFusion is layered on top of the JRun Java EE servlet container. JRun, like many other Java EE servers makes use of JMX technology. JMX allows for real time monitoring and configuration of an application within the servlet container. I won't go into the specifics of JMX but you can read more at these links:
Application management with JMX
I should state at this point that I'm no Java or JMX expert. I just happened to stumble upon this a while back and thought it might be useful for people who will probably be more capable than me to get their heads around it.
Anyway, here's an excerpt for my jrun.xml file. My home PC runs the standalone version of ColdFusion. You may need to uncomment the section below, I can't remember if I did or not. Remember to back up jrun.xml before making any changes!
<!-- This service is the RI's HTML Adaptor for the JMX agent. It can be used -->
<!-- to browse JMX from your browser -->
<!-- ======================================================================== -->
<!-- -->
<service class="jrunx.kernel.agents.HtmlAgentService" name="HtmlAgentService">
<attribute name="MaxActiveClients">10</attribute>
<attribute name="Port">8082</attribute>
<attribute name="adminUsers">admin:admin,tester:tester</attribute>
</service>
As you can see the JMX HtmlAgentService is configured to listen on port 8082. There are two default admin users defined. User "admin" with a password of "admin" and user "tester" with a password of "tester".
With ColdFusion started, browse to:
http://yourservername:8082
You'll be presented with a login dialog where you should use the credentials in one of the examples above. Once logged in, you should have a long list of "MBeans". MBeans represent all of the resources that JMX can manage within JRun.
Let's do some on-the-fly tinkering with JRun and ColdFusion. Obviously don't do this in a production environment!
Under the default domain heading, click the link titled "service=JRunServer". At the top of the page are all of the configurable properties of theMBean. Those that are editable are marked as RW within the 'Access' table column, those that aren't are marked RO.
Further down the page is a list of MBean operations which can be invoked. Notice near the end of the list there is a restartServer operation. Click the 'restartServer' button and the JRun server will restart! All without the need to open the Windows Services panel or use the command line.
Now select the "service=LoggerService" MBean. Scroll down the page and find the logDebug operation.

Enter a value within the text field and click the logDebug button. Now check the coldfusion-err.log file (located in server root/runtime/logs on ColdFusion standalone edition) and you should see the logging message you just submitted.
Hardly exciting stuff, but there are plenty of other options to play with. If only I knew what I was doing with half of them....

0 Comments
[Post comment]