4里面一个Servlet在Tomcat

4里面一个Servlet在Tomcat

本文介绍了重新启动Apache2.4里面一个Servlet在Tomcat 6的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到错误403时重定向到一个Java的web应用程序的代理。

该应用程序会检查用户的凭据:如果用户被授权,客户端IP地址添加到授权的IP地址的列表,并列入Apache2.4的httpd.conf

因此​​,代理是通过重新启动:

\r
\r

同步(调用Runtime.getRuntime()){\r
    调用Runtime.getRuntime()EXEC(... apachectl中-k重启)WAITFOR()。\r
}

\r

\r
\r

这与Windows下的代理本地测试,它的工作就好了;但是当我开始在Linux(Ubuntu的14)的工作,行为像连接被重置或没有收到任何数据错误(火狐,Chrome,分别)改变了。

有没有代理服务器(Apache的2.4)和Web服务器(Tomcat)的?

进程之间的关系
解决方案

原来,在重新启动将使代理再现完全相同的待定重新启动操作后立即请求。

要采取考虑在httpd.conf中的新价值,都是我所要做的就是更换重新启动指令是 曼妙

\r
\r

同步(调用Runtime.getRuntime()){\r
    调用Runtime.getRuntime()EXEC(... apachectl中-k优美)WAITFOR()。\r
}

\r

\r
\r

这样,该进程将无法重新启动,但在httpd.conf中更改生效,从而对整个机制不会受到影响。

I have a proxy that redirects to an Java Web-App when error 403 is encountered.

This application checks the user's credentials: if the user is authorized, the client IP address is added to a list of authorized IP addresses, and included in Apache2.4's httpd.conf.

Therefore, The Proxy is to be restarted using:

synchronized (Runtime.getRuntime()) {
    Runtime.getRuntime().exec("...apachectl -k restart").waitFor();
}

This was tested locally with the proxy under Windows, it worked just fine; but when I started working on Linux (Ubuntu 14), the behavior changed with errors like "The connection was reset" or "No data received" (Firefox, Chrome, respectively).

Is there a relationship between processes of the Proxy (Apache 2.4) and the Web Server (Tomcat)?

解决方案

It turned out the restart would make the proxy reproduce the exact same "pending" request right after the restart operation.

To take in consideration the new values in httpd.conf, all I had to do was to replace the restart directive with graceful.

synchronized (Runtime.getRuntime()) {
    Runtime.getRuntime().exec("...apachectl -k graceful").waitFor();
}

This way, the process won't restart but changes within httpd.conf will take effect, and thus the whole mechanism won't be impacted.

这篇关于重新启动Apache2.4里面一个Servlet在Tomcat 6的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-02 04:08