Apache Tomcat Cataline 文件更改未反映!

发布于 2024-10-20 09:30:44 字数 1639 浏览 4 评论 0原文

我在 windows xp prefossional SP3 上使用 apache-tomcat-6.0.18

我的要求是在 Tomcat Manager => 中显示附加信息(如组织名称)服务器状态=>在 JVMhttp- 标头之间。我已经修改了 catalina.jar 源中的文件 "org.apache.catalina.manager.StatusTransformer::writeConnectorState" 并向其中添加了简单文本。示例代码

 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

再次使用修改后的代码创建了catalina.jar。并替换为 catalina_home/bin 中的现有 jar。重新启动了tomcat,但没有任何结果。

即使我从 catalina_home/bin 中删除 catalina.jar 并启动 tomcat,它仍然可以工作!

我什至在重新启动系统后尝试过,但我的更改没有反映。

请帮我解决以下问题

  1. 我是否修改了错误的文件?
  2. 没有catalina.jar的情况下tomcat如何运行?
  3. 如何体现变化?即还有其他方式吗?

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 remove 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

  1. Am i modifying the wrong file?
  2. How tomcat is running without catalina.jar?
  3. How to reflect the changes? i.e. Any other way?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

你穿错了嫁妆 2024-10-27 09:30:44

对此不是 100% 确定,但我认为您应该将修改后的 catalina.jar 放在 catalina_home/lib 中,因为我相信这是 Web 应用程序加载其共享库的位置(Tomcat Manager 只是另一个应用程序)在 catalina_home/webapps/ 下)。

编辑:我检查了我们的一台服务器,catalina_home/bin 下没有 catalina.jar,只有 catalina_home/lib 下。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文