这是 manager 里边的 reload 源码,您慢慢看吧,我看不懂。    /**
     * Reload the web application at the specified context path.
     *
     * @param writer Writer to render to
     * @param path Context path of the application to be restarted
     */
    protected void reload(PrintWriter writer, String path) {        if (debug >= 1)
            log("restart: Reloading web application at '" + path + "'");        if ((path == null) || (!path.startsWith("/") && path.equals(""))) {
            writer.println(sm.getString("managerServlet.invalidPath",
                                        RequestUtil.filter(path)));
            return;
        }
        String displayPath = path;
        if( path.equals("/") )
            path = "";        try {
            Context context = (Context) host.findChild(path);
            if (context == null) {
                writer.println(sm.getString
                               ("managerServlet.noContext",
                                   RequestUtil.filter(displayPath)));
                return;
            }
            // It isn't possible for the manager to reload itself
            if (context.getPath().equals(this.context.getPath())) {
                writer.println(sm.getString("managerServlet.noSelf"));
                return;
            }
            context.reload();
            writer.println
                (sm.getString("managerServlet.reloaded", displayPath));
        } catch (Throwable t) {
            log("ManagerServlet.reload[" + displayPath + "]", t);
            writer.println(sm.getString("managerServlet.exception",
                                        t.toString()));
        }    }

解决方案 »

  1.   

    org.apache.catalina.core.StandardContext 类有 reload();
    reload
    public void reload()Reload this web application, if reloading is supported. 
    IMPLEMENTATION NOTE: This method is designed to deal with reloads required by changes to classes in the underlying repositories of our class loader. It does not handle changes to the web application deployment descriptor. If that has occurred, you should stop this Context and create (and start) a new Context instance instead. 
    Specified by:
    reload in interface Context
    Throws: 
    java.lang.IllegalStateException - if the reloadable property is set to false.