Tomcat JMX Resources
JMXAdaptorLifecycleListener
like this:
<Server ...>
...
<Listener className="org.apache.catalina.mbeans.JMXAdaptorLifecycleListener"
namingPort="8083" port="8084" host="myhost" />
...
</Server>
See this page for details:
http://tomcat.apache.org/tomcat-5.5-doc/monitoring.html
Here is how to build it from the Tomcat 5.5 source tree:
First, set CATALINA_HOME to the root of your unpacked binary distribution of
Tomcat 5.5.x.
Next build the JMXAdaptorLifecycleListener like this:
$ javac -classpath $CATALINA_HOME/server/lib/catalina.jar:$CATALINA_HOME/bin/commons-logging-api-1.1.1.jar container/catalina/src/share/org/apache/catalina/mbeans/JMXAdaptorLifecycleListener.java
Then copy the resulting class file into place like this:
mkdir -p $CATALINA_HOME/server/lib/org/apache/catalina/mbeans
cp container/catalina/src/share/org/apache/catalina/mbeans/JMXAdaptorLifecycleListener.class $CATALINA_HOME/server/lib/org/apache/catalina/mbeans
JSP to test JMX
JMX testing..
<br><br>
<%
ArrayList list = MBeanServerFactory.findMBeanServer(null);
MBeanServer mbeanServer = (MBeanServer) list.get(0);
out.print("MBeanServer: " + mbeanServer + "<br>");
String domain = mbeanServer.getDefaultDomain();
out.print("Default domain: " + domain + "<br>");
Set namesSet = mbeanServer.queryNames(null, null);
Object[] objectNames = namesSet.toArray();
out.print("mbean object names: <br>");
for (int x = 0; x < objectNames.length; x++)
{
out.print(objectNames[x] + "<br>");
}
%>
Example of using the JMXProxy
called i/need. It can be queried via the JMPXproxy in the manager
app. Here's the ouput example:
Name:
Catalina:type=Environment,resourcetype=Context,path=/myapp,host=localhost,name=i/need
modelerType: org.apache.catalina.mbeans.ContextEnvironmentMBean
className: org.apache.catalina.deploy.ContextEnvironment
name: i/need
override: false
type: java.lang.String
value: less cowbell
So your search URL would be (unescaped for readability ...)
http://localhost/manager/jmxproxy?qry=Catalina:type=Environment,resource...
And can be set via
http://localhost/manager/jmxproxy?set=Catalina:type=Environment,resource...
More information:
http://jakarta.apache.org/tomcat/tomcat-5.0-doc/manager-howto.html#What%...
Enabling the JMX Remote Server
Tomcat Running PHP via CGIServlet
---------------------------------
The CGIServlet needs to be patched.
(patch submitted by William Osmond)
--- CGIServlet.java 2005-03-26 11:24:01.000000000 -0800
+++ CGIServlet_fixed.java 2005-09-13 23:36:57.095167624 -0700
-1093,6 +1093,8 @@
envp.put("SCRIPT_NAME", nullsToBlanks(sCGIScriptName));
+ envp.put("SCRIPT_FILENAME", nullsToBlanks(sCGIScriptName));
+
envp.put("QUERY_STRING", nullsToBlanks(req.getQueryString()));
envp.put("REMOTE_HOST", nullsToBlanks(req.getRemoteHost()));
-1139,6 +1141,7 @@
command = fCGIFullPath.getCanonicalPath();
envp.put("X_TOMCAT_SCRIPT_PATH", command); //for kicks
+ envp.put("SCRIPT_FILENAME", command);
this.env = envp;
Also PHP_SELF becomes "/test5.php/test5.php", when it should be "/test5.php".
With this setup you cannot change the open_basedir then and you cannot use
suexec to switch php users. PHP may only open files that are within
directories listed in open_basedir.



