如何强制 tomcat 重新加载最近编译的类/war 文件 [英] How to force tomcat to reload recently compiled class/war files

查看:50
本文介绍了如何强制 tomcat 重新加载最近编译的类/war 文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有一组在 tomcat 引擎上运行的 servlet.当我们编译一个 java 文件并构建 war 时,tomcat 需要不确定的时间来重新加载它.有时 3 秒,有时 30 秒,等等.当前的解决方法是停止 tomcat 并使用 shell 脚本重新启动它.我们将 autodeploy 和 reloadable 标志设置为 true,但它不能可靠地工作.知道如何做到这一点吗?指针也很感激.这是关于 ubuntu 上的 tomcat v6.0.20.

We have a set of running servlets on a tomcat engine. When we compile a java file and build the war, tomcat takes an indeterminate amount of time to reload it. Sometimes 3 seconds, sometimes 30, etc. Current workaround is to stop tomcat and restart it using a shell script. We set up the autodeploy and reloadable flag to true but it is not working reliably. Any idea how to make this happen? Pointers appreciated, too. This is about tomcat v6.0.20 on ubuntu.

这是我们的 conf/server.xml 文件的摘录:

Here is an extract of our conf/server.xml file:

<Engine name="Catalina" defaultHost="localhost">

  <Realm className="org.apache.catalina.realm.UserDatabaseRealm"
         resourceName="UserDatabase"/>

  <Host name="localhost"  appBase="webapps"
        unpackWARs="true" autoDeploy="true"
        xmlValidation="false" xmlNamespaceAware="false">

    <DefaultContext reloadable="true">
    </DefaultContext>

    <!-- SingleSignOn valve, share authentication between web applications
         Documentation at: /docs/config/valve.html -->
    <!--
    <Valve className="org.apache.catalina.authenticator.SingleSignOn" />
    -->

  </Host>
</Engine>

推荐答案

一种可能性是向 Tomcat 管理器应用程序;例如像这样:

One possibility is to send an appropriate request to the Tomcat Manager App; e.g. something like this:

http://localhost:8080/manager/text/reload?path=/examples

这篇关于如何强制 tomcat 重新加载最近编译的类/war 文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆