Apache Tomcat Cataline file changes not reflecting!
I am using apache-tomcat-6.0.18 on windows xp prefossional SP3.
My requirement is to show additional information ( like Organization Name) in the Tomcat Manager => Server Status => in between the JVM and http- Header. I have modified the file "org.apache.catalina.manager.StatusTransformer::writeConnectorState<method name>"
from catalina.jar source and added simple text to it. Sample code is
public static void writeConnectorState(PrintWriter writer, ObjectName tpName, String name, MBeanServer mBeanServer, Vector globalRequestProcessors, Vector requestProcessors, int mode)throws Exception{
if (mode == 0) {
// START - Added New Code to display org name
writer.print("<h1>");
writer.print("XYZ Organization.");
writer.print("</h1>");
// END - Added New Code to display org name
writer.print("<h1>");
writer.print(name);
writer.print("</h1>");
writer.print("<p>");
writer.print(" Max threads: ");
writer.print(mBeanServer.getAttribute(tpName, "maxThreads"));
writer.print(" Current thread count: ");
writer.print(mBeanServer.getAttribute(tpName, "currentThreadCount"));
writer.print(" Current thread busy: ");
writer.print(mBeanServer.getAttribute(tpName, "currentThreadsBusy"));
...........
...........
}else{
.........
}// end if-else }// method end
Again created catalina.jar with modified code. and replaced with the existing jar from catalina_home/bin
. Restarted the tomcat but nothing coming out of it.
Even if i r开发者_运维问答emove catalina.jar from catalina_home/bin
and starts the tomcat, its working!!!!
I tried even after restarting the system but my changes are not reflecting.
Please help me out for the following queries
- Am i modifying the wrong file?
- How tomcat is running without catalina.jar?
- How to reflect the changes? i.e. Any other way?
Not 100% sure on this, but I think you should place the modified catalina.jar in catalina_home/lib
, as I believe that's where the web-applications load their shared libraries (Tomcat Manager is just another app under catalina_home/webapps/
).
Edit: I checked one of our servers, there's no catalina.jar
under catalina_home/bin
, only under catalina_home/lib
.
精彩评论