connection reset by peer
Hello, I'm using tomcat5.5.23 on a Fedora 5 kernel: 2.6.20-1.2320.fc5. I redirect port 80 to 8080 by running by root: iptables -t nat -A OUTPUT -d localhost -p tcp --dport 80 -j REDIRECT --to-ports 8080 iptables -t nat -A PREROUTING -p tcp --dport 80 -i eth0 -j REDIRECT --to-port 8080 Sometimes (quite often) I get connection reset by peer, in the middle of page loading. It looks like that when running wget (although it happens also using firefox and ie): Connecting to ard.huji.ac.il|132.64.50.50|:80... connected. HTTP request sent, awaiting response... 200 OK Length: unspecified [text/html] 0% [ ] 2,555 --.--K/s 23:43:29 (169.02 KB/s) - Read error at byte 271959 (Connection reset by peer).Retrying. it happens each time in a different stage of the page download. It happens mainly (or only) on large pages (~45 bytes). the server is inside inside a firewall, the error occurs when trying to access it from outside the firewall, I couldn't reproduce the error from inside the firewall. Can someone help with that ? Yair. - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How do I get the response status code?
Well, it does, partially. I sometimes get a non zero status code, but it's not zero only when there is an error (status code s: 404, 304). Yair. Brantley Hobbs wrote: Ahh.please ignore my last. I see that you're doing the same thing I mentioned (setting a private variable and returning that as the status). Is this not working for you? Brantley Yair Zohar wrote: Hi Brantley, Thanks for replying. I've tried to pass a wrapper to the filter's chain, here is the wrapper's code: import java.io.IOException; import javax.servlet.http.*; public class TestResponse extends HttpServletResponseWrapper { private int statusCode; public TestResponse(HttpServletResponse response) { super(response); } public int getStatus() { return statusCode; } public void sendError(int errorCode) throws IOException { this.statusCode = errorCode; super.sendError(errorCode); } public void sendError(int errorCode, String errorMessage) throws IOException { this.statusCode = errorCode; super.sendError(errorCode, errorMessage); } public void setStatus(int statusCode) { this.statusCode = statusCode; super.setStatus(statusCode); } } I hopped tomcat will use the wrapper's setStatus() method and then I will be able to get the status code. What actually happened is that sometimes the status code returned was 0 and sometimes 404 or 304. It seems tomcat used the wrapper's setStatus() method only in part of the cases (maybe only when there was a problem getting the page). How does the byte count gives information on the status code ? How do you get the byte count from the output stream ? Yair. Brantley Hobbs wrote: Yair, I too would be interested in this. I wrote a logging filter that does what you describe, but the best that I could come up with was a response wrapper that was passed along the filter chain. In the wrapper, I could set a status, thus guaranteeing that I would end up with a status at the end. The wrapper extends HttpServletResponseWrapper. You may also find a wrapper useful because response sizes are not always set either, at least in my experience. With the wrapper, you can monitor the output stream to get a byte count. B. Yair Zohar wrote: Hello, I'm trying to create a filter that will do the access logging for my web application (I would like to write the information directly to the database not to a file). I have a problem to get the status code of the response. The filter receives a ServletResponse object that do not have a getStatus() method. Any idea ? Yair Zohar. - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How do I get the response status code?
Hi Brantley, Thanks for replying. I've tried to pass a wrapper to the filter's chain, here is the wrapper's code: import java.io.IOException; import javax.servlet.http.*; public class TestResponse extends HttpServletResponseWrapper { private int statusCode; public TestResponse(HttpServletResponse response) { super(response); } public int getStatus() { return statusCode; } public void sendError(int errorCode) throws IOException { this.statusCode = errorCode; super.sendError(errorCode); } public void sendError(int errorCode, String errorMessage) throws IOException { this.statusCode = errorCode; super.sendError(errorCode, errorMessage); } public void setStatus(int statusCode) { this.statusCode = statusCode; super.setStatus(statusCode); } } I hopped tomcat will use the wrapper's setStatus() method and then I will be able to get the status code. What actually happened is that sometimes the status code returned was 0 and sometimes 404 or 304. It seems tomcat used the wrapper's setStatus() method only in part of the cases (maybe only when there was a problem getting the page). How does the byte count gives information on the status code ? How do you get the byte count from the output stream ? Yair. Brantley Hobbs wrote: Yair, I too would be interested in this. I wrote a logging filter that does what you describe, but the best that I could come up with was a response wrapper that was passed along the filter chain. In the wrapper, I could set a status, thus guaranteeing that I would end up with a status at the end. The wrapper extends HttpServletResponseWrapper. You may also find a wrapper useful because response sizes are not always set either, at least in my experience. With the wrapper, you can monitor the output stream to get a byte count. B. Yair Zohar wrote: Hello, I'm trying to create a filter that will do the access logging for my web application (I would like to write the information directly to the database not to a file). I have a problem to get the status code of the response. The filter receives a ServletResponse object that do not have a getStatus() method. Any idea ? Yair Zohar. - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
How do I get the response status code?
Hello, I'm trying to create a filter that will do the access logging for my web application (I would like to write the information directly to the database not to a file). I have a problem to get the status code of the response. The filter receives a ServletResponse object that do not have a getStatus() method. Any idea ? Yair Zohar. - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Reloading shared classes
You are right, I've just wanted to avoid multiple copies of the same classes. They are not really shared. If the classes are shared, all the web applications should be restarted, because the change affect all of them. Yair. Peter Crowther wrote: From: Yair Zohar [mailto:[EMAIL PROTECTED] My web applications are using some shared class. I put them under $CATALINA_HOME/shared/classes. The problem: When I make changes in the shared classes, restarting a web application by tomcat's manager is not enough for the changes to be reloaded. Only the tomcat server shutdown + start cause the changes to be reloaded. How do I configure the web application or tomcat to reload the shared classes when restarting the web application? You can't. To reload those classes, you'd have to reload the contents of the shared classloader - which you can't do without restarting all the other webapps. Any other approach removes the need for the *shared* classes. Do the classes genuinely need to be shared between the webapps, or are you doing this to save space? - Peter - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Reloading shared classes
Hello, I'm using tomcat 5.0.28 on a Linux machine. My web applications are using some shared class. I put them under $CATALINA_HOME/shared/classes. The problem: When I make changes in the shared classes, restarting a web application by tomcat's manager is not enough for the changes to be reloaded. Only the tomcat server shutdown + start cause the changes to be reloaded. How do I configure the web application or tomcat to reload the shared classes when restarting the web application? Thanks ahead, Yair. - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]