java.net.SocketException: Connection reset by peer in setSocketOptions()

2013-08-03 Thread Kees Jan Koster
Dear All,

I have an exception that is littering my catalina.out. I see about 7000 of 
these on a normal day (server handles about 25 requests per second). It is this 
precise stack trace always. I have some other exceptions, but this one is the 
main headache I have today.

Tomcat 7.0.30
openjdk version 1.7.0_25
FreeBSD 9.1-STABLE

My questions:
1) What might be causing this?
2) What other information do you need to help shed some light on this problem?
3) How can I found out if this is happening from specific IP addresses maybe?
4) Any queues that might be overflowing? I have acceptCount 1024 and 
kern.ipc.somaxconn 1024, which should be plenty, right?
5) Any other steps I can take to dive deeper?

Aug 03, 2013 8:50:45 PM org.apache.tomcat.util.net.NioEndpoint setSocketOptions
SEVERE: 
java.net.SocketException: Connection reset by peer
at sun.nio.ch.Net.setIntOption0(Native Method)
at sun.nio.ch.Net.setSocketOption(Net.java:373)
at sun.nio.ch.SocketChannelImpl.setOption(SocketChannelImpl.java:189)
at sun.nio.ch.SocketAdaptor.setBooleanOption(SocketAdaptor.java:290)
at sun.nio.ch.SocketAdaptor.setTcpNoDelay(SocketAdaptor.java:325)
at 
org.apache.tomcat.util.net.SocketProperties.setProperties(SocketProperties.java:199)
at 
org.apache.tomcat.util.net.NioEndpoint.setSocketOptions(NioEndpoint.java:649)
at 
org.apache.tomcat.util.net.NioEndpoint$Acceptor.run(NioEndpoint.java:802)
at java.lang.Thread.run(Thread.java:724)

--
Kees Jan

http://java-monitor.com/
kjkos...@kjkoster.org
+31651838192

Repairing cannot be completed, you can only stop doing it.
-- Belarusian proverb

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Connection reset by peer in org.apache.tomcat.util.net.NioEndpoint setSocketOptions

2012-06-10 Thread Kees Jan Koster
Dear All,

I get these errors in the logs quite frequently. About 1500 times every day. 
The application works nicely, strangely enough.

What is happening here? How can I resolve these error messages?

Should I worry?

Jun 10, 2012 4:43:17 PM org.apache.tomcat.util.net.NioEndpoint setSocketOptions
SEVERE: 
java.net.SocketException: Connection reset by peer
at sun.nio.ch.Net.setIntOption0(Native Method)
at sun.nio.ch.Net.setIntOption(Net.java:154)
at sun.nio.ch.SocketChannelImpl$1.setInt(SocketChannelImpl.java:406)
at sun.nio.ch.SocketOptsImpl.setBoolean(SocketOptsImpl.java:38)
at sun.nio.ch.SocketOptsImpl$IP$TCP.noDelay(SocketOptsImpl.java:284)
at sun.nio.ch.OptionAdaptor.setTcpNoDelay(OptionAdaptor.java:48)
at sun.nio.ch.SocketAdaptor.setTcpNoDelay(SocketAdaptor.java:268)
at 
org.apache.tomcat.util.net.SocketProperties.setProperties(SocketProperties.java:183)
at 
org.apache.tomcat.util.net.NioEndpoint.setSocketOptions(NioEndpoint.java:1090)
at 
org.apache.tomcat.util.net.NioEndpoint$Acceptor.run(NioEndpoint.java:1317)
at java.lang.Thread.run(Thread.java:619)

Tomcat 6.0.26 on FreeBSD 9.0-STABLE.
# /usr/local/jdk1.6.0/bin/java -version
java version 1.6.0_03-p4
Java(TM) SE Runtime Environment (build 
1.6.0_03-p4-kjkoster_30_nov_2011_10_57-b00)
Java HotSpot(TM) 64-Bit Server VM (build 
1.6.0_03-p4-kjkoster_30_nov_2011_10_57-b00, mixed mode)
# _
--
Kees Jan

http://java-monitor.com/
kjkos...@kjkoster.org
+31651838192

Human beings make life so interesting. Do you know that in a universe so full 
of wonders,
they have managed to invent boredom. Quite astonishing... -- Terry Pratchett


-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



[solved] Re: connection reset errors

2012-06-10 Thread Kees Jan Koster
Dear All,

Well, I managed to track this down. As it turned out, the problem was that I 
had a rather short TCP listen queue on the Tomcat connector port (100 elements) 
and that queue was overflowing.

The solution was to 1) set acceptCount to a higher value in Tomcat and 2) to 
configure my OS to allow applications to specify longer accept queues. That 
last step was the one missing. I had changed acceptCount before, but since the 
OS was limiting the accept queue length I did not see any improvement.

More details can be found here:

http://java-monitor.com/forum/showthread.php?t=2492

A big thank you for all that contributed to this thread and helped me 
understand the problem.

Kees Jan


On 22 May 2012, at 14:45, André Warnier wrote:

 Kees Jan Koster wrote:
 Dear André,
 Assuming that your client is really connecting to that HTTP connector on 
 port 8080 mentioned above..
 Yes, it has a forwarded port 80 (using FreeBSD ipfw) that also points to 
 8080, and there is an Apache with mod_proxy_http that hooks into 8081. My 
 tests are on the vanilla port, though.
 
 Can you be a bit clearer on this part ?  Do you see the problem happening for 
 1 in 10 posts, when your client connects directly to Tomcat's HTTP port 8080 ?
 Or is it only when the client connects to Tomcat via either one of these 
 intermediate pieces of machinery ?
 
 1) You are getting a
 java.net.SocketException: Connection reset
 at java.net.SocketInputStream.read(SocketInputStream.java:168)
 
 so this appears to happen when/while your java client is reading the 
 response from the server, and it appears to be that the client is expecting 
 to be able to read more data, but finds itself unable to, because the 
 socket has been closed under his nose.
 The reading is one area I need to look into: did the client get all data, 
 partial data or none at all. I need to experiment with that.
 You say that it happens frequently, so it's not always.
 Indeed, not always. About 1 in 10 posts die like this on bad days. Sometimes 
 hours with no issues. No pattern I can discern.
 2) the server itself seems unaware that there is a problem.  So it has 
 already written the whole response back to the client, decided it was done 
 with this request, and gone happily to handle other things.
 Precisely.
 That can happen, even if the client has not yet received all data, because 
 between the server and the client there is a lot of piping, and the data 
 may buffered at various levels or still in transit.
 
 thus..
 
 - either the client is misinterpreting the amount of data that it should be 
 reading from the server's response (trying to read more than there actually 
 is)
 (on the other hand, I think that the kind of exception you would get in 
 that case would be different, more like trying to read beyond EOF or so).
 - or something in-between the server and the client closes the connection 
 before all data has been returned to the client (and/or is loosing data).
 
 It would be helpful to know if this happens when the response is 
 particularly large, or small, or if it is unrelated to the response size.
 The response is a few bytes. I think it is about 10-20 bytes. Less than a 
 packet, I expect. :)
 
 That is quite strange, I think.
 See below.
 
 
 If the server is configured with an AccessLogValve, you should be able to 
 see how big the response was, in bytes.  If you have control over the 
 client code, you should be able to add something that logs how many bytes 
 it has read before the exception occurs.
 What makes the request size interesting? What previous experience are you 
 basing this question on?
 
 Just that intuitively, if a problem happens while reading the response, one 
 would expect that the larger the response is, the more likely that some 
 network issue would show up in the middle.
 
 But now that I say this, going back to your initial message and the 
 stacktrace in it, I see
 ..
 at sun.net.www.http.HttpClient.parseHTTPHeader
 ...
 so the problem seems to show up right away, while the response's HTTP 
 *headers* are being read.  So it looks like when the problem happens, the 
 client is not able to read anything at all, not even the headers..
 
 Do all problems show up the same stacktrace, all with a problem while 
 reading/parsing the response headers ?
 
 
 Dumping the response HTTP headers to the client logfile would also help 
 finding out what happens. (If the client is an applet running inside of a 
 browser, then a browser add-on would show this easily (like Live HTTP 
 Headers for Firefox, or Fiddler2 for IE)).
 I can check that I see the same problems from a browser using firebug, that 
 is a good idea. Thanks.
 Doing a traceroute from the client to the server,  may also give an idea 
 of what there is actually between the server and the client.
 mtr reports no packet loss between the two machines I used for testing.
 
 Actually, I was more thinking about some intermediate problematic proxy or 
 something

Re: connection reset errors

2012-05-26 Thread Kees Jan Koster
Dear André,

Took me a while to answer, because I wanted to get more precise readings.

 Assuming that your client is really connecting to that HTTP connector on 
 port 8080 mentioned above..
 Yes, it has a forwarded port 80 (using FreeBSD ipfw) that also points to 
 8080, and there is an Apache with mod_proxy_http that hooks into 8081. My 
 tests are on the vanilla port, though.
 
 Can you be a bit clearer on this part ?  Do you see the problem happening for 
 1 in 10 posts, when your client connects directly to Tomcat's HTTP port 8080 ?
 Or is it only when the client connects to Tomcat via either one of these 
 intermediate pieces of machinery ?

I re-ran my tests, making sure that I was positive about the path the packets 
travel. Here is what I fished out of the log of a client app running on the 
same machine as the server:

java.net.SocketException: Connection reset by peer
at java.net.PlainSocketImpl.socketSetOption(Native Method)
at 
java.net.AbstractPlainSocketImpl.setOption(AbstractPlainSocketImpl.java:267)
at java.net.Socket.setTcpNoDelay(Socket.java:940)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:400)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:483)
at sun.net.www.http.HttpClient.init(HttpClient.java:213)
at sun.net.www.http.HttpClient.New(HttpClient.java:300)
at sun.net.www.http.HttpClient.New(HttpClient.java:316)
at 
sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:992)
at 
sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:971)
at 
sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:846)
at 
sun.net.www.protocol.http.HttpURLConnection.getOutputStream(HttpURLConnection.java:1087)


This particular client connects on the same machine as the Tomcat server, using 
port 8080 (the configured HTTP connector for this Tomcat server). The URL used 
is http://localhost:8080/webapp.

So whatever is happening, it is not happening on the network or in the ISP's 
hardware. It seems to be local to my machine and with this I feel that Tomcat 
is a suspect again. This goes against some of the things I said earlier. I was 
wrong, sorry.

Is there any way to overwhelm a Tomcat connector without it serving 503 
responses? This particular connector is maxed out at 256 connections, with 
about 5% actually busy at any given time (as reported by JMX), with spikes of 
up to 50% busy every hour or so.

 Another thing : your client is effectively requesting non-keepalive 
 connections, so Tomcat will close the connection after sending the response 
 to each request.  And your clients have to rebuild a new connection for each 
 request.
 If the same client(s) make lots of small requests one after another, this may 
 be counter-productive, because each connection build-up requires several 
 packets going back and forth. Also, on the server side, when a connection is 
 being closed, it will nevertheless linger for a while in CLOSE_WAIT state, 
 waiting for the client's TCP stack to acknowledge the CLOSE.  I have seen 
 cases where a large number of such connections being in CLOSE_WAIT triggered 
 bizarre issues, such as a server becoming unable to accept new TCP 
 connections for a while.

I know this, but since I know the traffic pattern (connections are used once 
per minute) I opted to make the connections non-keep-alive from the client 
side. That way, the connections that come from browsers can make use of 
keep-alive for performance.

I guess I should have gone for a model where I have a non-keel-alive HTTP 
connector on Tomcat for the clients and another keep-alive-enabled connector 
for the browser traffic. Hmmm. It may not be too late for that, but first I'd 
like some proof this is an issue. :)

 It may be worth checking how many of such CLOSE_WAIT connections you have 
 over time, and if this relates to when the problems happen.
 netstat -pan | grep CLOSE_WAIT
 would show this. If more than a couple of hundreds show up, I'd become 
 suspicious of something like that.

I now graph these in Munin and I see spikes of up to 100 sockets in that state. 
You say hundreds are a problem, what about one hundred?
--
Kees Jan

http://java-monitor.com/
kjkos...@kjkoster.org
+31651838192

Repairing cannot be completed, you can only stop doing it.
 -- Belarusian proverb


-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



connection reset errors

2012-05-22 Thread Kees Jan Koster
Dear Tomcat community,

I am trying to resolve the problem where some client code in Java frequently 
gets the following error in the logs:

java.net.SocketException: Connection reset
at java.net.SocketInputStream.read(SocketInputStream.java:168)
at java.io.BufferedInputStream.fill(BufferedInputStream.java:218)
at java.io.BufferedInputStream.read1(BufferedInputStream.java:258)
at java.io.BufferedInputStream.read(BufferedInputStream.java:317)
at sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:687)
at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:632)
at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:652)
at 
sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1000)
...

The client code performs a simple HTTP POST request to a Tomcat server (FreeBSD 
9.0-STABLE, Java 1.6.0_03, Tomcat 6.0.26). Below is the HTTP connector from 
server.xml:

Connector port=8080 protocol=HTTP/1.1 
   connectionTimeout=1 enableLookups=false compression=on
   maxThreads=256 bufferSize=9000 /

Tracing the servlet in Tomcat shows that the servlet's doPost() method returns 
normally and does not show any exceptions (I catch and log Throwable and 
nothing related is logged). Tracing on an application level shows the posted 
data to be in the database, as would be for a normal POST. The data is correct.

Of note is that the response time of the post is the same as for a successful 
post. Under normal circumstances Tomcat processes a post in about 25ms, 
measured in the client. When I get this exception, the response time is also 
about that time. I think therefore that I am not timing out anywhere (or the 
response time would be a lot longer).

First question: It says Connection reset and not Connection reset by peer. 
What is the difference between the two? I am told that one means a local reset 
and the other means a remote reset. Where can I find more about this difference?

Second question: how do I analyze such resets? How do I find out who reset the 
connection and why? How can I replay this in such a way that I can see that?
--
Kees Jan

http://java-monitor.com/
kjkos...@kjkoster.org
+31651838192

Change is good. Granted, it is good in retrospect, but change is good.


-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: connection reset errors

2012-05-22 Thread Kees Jan Koster
Dear Jose,

 2012/5/22 Kees Jan Koster kjkos...@gmail.com:
 Dear Tomcat community,
 
 I am trying to resolve the problem where some client code in Java frequently 
 gets the following error in the logs:
 
 java.net.SocketException: Connection reset
at java.net.SocketInputStream.read(SocketInputStream.java:168)
at java.io.BufferedInputStream.fill(BufferedInputStream.java:218)
at java.io.BufferedInputStream.read1(BufferedInputStream.java:258)
at java.io.BufferedInputStream.read(BufferedInputStream.java:317)
at sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:687)
at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:632)
at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:652)
at 
 sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1000)
...
 
 
 Are you calling to disconnect() method ?


Yes I am. In finally{} block. Here is the client code:

private Properties push(final Properties request) throws IOException {
HttpURLConnection connection = null;
PrintStream out = null;
InputStream in = null;
try {
connection = (HttpURLConnection) pushUrl.openConnection(proxy);
connection.setRequestMethod(POST);
connection.setDoOutput(true);
connection.setConnectTimeout(TWO_MINUTES);
connection.setReadTimeout(TWO_MINUTES);
connection.setRequestProperty(Connection, close);

out = new PrintStream(connection.getOutputStream());
request.storeToXML(out, null);
out.flush();

in = connection.getInputStream();
final Properties response = new Properties();
response.loadFromXML(in);

return response;
} finally {
if (in != null) {
try {
in.close();
} catch (Exception e) {
// ignore...
}
}
if (out != null) {
try {
out.close();
} catch (Exception e) {
// ignore...
}
}

if (connection != null) {
try {
connection.disconnect();
} catch (Exception e) {
// ignore...
}
}
}
}
}

--
Kees Jan

http://java-monitor.com/
kjkos...@kjkoster.org
+31651838192

Human beings make life so interesting. Do you know that in a universe so full 
of wonders,
they have managed to invent boredom. Quite astonishing... -- Terry Pratchett


-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: connection reset errors

2012-05-22 Thread Kees Jan Koster
Dear Jose,

 Yes I am. In finally{} block. Here is the client code:
 
 Calling the disconnect() method of HttpURLConnection may close the
 underlying socket
 if a persistent connection is otherwise idle at that time
 Try don't call it,  test it and tell us :-)
 
 http://docs.oracle.com/javase/1.5.0/docs/guide/net/http-keepalive.html

Ugh. I never realized the socket API was this messy.

At any rate, I call connection.setRequestProperty(Connection, close); to 
indicate that I do not want to make use of persistent connections. You can see 
that in my client code.

If the underlying socket were closed I would also occasionally see other 
methods than 'read' get an error. The stack trace I posted is the only one I 
get, though.
--
Kees Jan

http://java-monitor.com/
kjkos...@kjkoster.org
+31651838192

Change is good. Granted, it is good in retrospect, but change is good.


-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: connection reset errors

2012-05-22 Thread Kees Jan Koster
Dear André,

 Assuming that your client is really connecting to that HTTP connector on port 
 8080 mentioned above..

Yes, it has a forwarded port 80 (using FreeBSD ipfw) that also points to 8080, 
and there is an Apache with mod_proxy_http that hooks into 8081. My tests are 
on the vanilla port, though.

 1) You are getting a
 java.net.SocketException: Connection reset
   at java.net.SocketInputStream.read(SocketInputStream.java:168)
 
 so this appears to happen when/while your java client is reading the response 
 from the server, and it appears to be that the client is expecting to be able 
 to read more data, but finds itself unable to, because the socket has been 
 closed under his nose.

The reading is one area I need to look into: did the client get all data, 
partial data or none at all. I need to experiment with that.

 You say that it happens frequently, so it's not always.

Indeed, not always. About 1 in 10 posts die like this on bad days. Sometimes 
hours with no issues. No pattern I can discern.

 2) the server itself seems unaware that there is a problem.  So it has 
 already written the whole response back to the client, decided it was done 
 with this request, and gone happily to handle other things.

Precisely.

 That can happen, even if the client has not yet received all data, because 
 between the server and the client there is a lot of piping, and the data may 
 buffered at various levels or still in transit.
 
 thus..
 
 - either the client is misinterpreting the amount of data that it should be 
 reading from the server's response (trying to read more than there actually 
 is)
 (on the other hand, I think that the kind of exception you would get in that 
 case would be different, more like trying to read beyond EOF or so).
 - or something in-between the server and the client closes the connection 
 before all data has been returned to the client (and/or is loosing data).
 
 It would be helpful to know if this happens when the response is particularly 
 large, or small, or if it is unrelated to the response size.

The response is a few bytes. I think it is about 10-20 bytes. Less than a 
packet, I expect. :)

 If the server is configured with an AccessLogValve, you should be able to see 
 how big the response was, in bytes.  If you have control over the client 
 code, you should be able to add something that logs how many bytes it has 
 read before the exception occurs.

What makes the request size interesting? What previous experience are you 
basing this question on?

 Dumping the response HTTP headers to the client logfile would also help 
 finding out what happens. (If the client is an applet running inside of a 
 browser, then a browser add-on would show this easily (like Live HTTP 
 Headers for Firefox, or Fiddler2 for IE)).

I can check that I see the same problems from a browser using firebug, that is 
a good idea. Thanks.

 Doing a traceroute from the client to the server,  may also give an idea of 
 what there is actually between the server and the client.

mtr reports no packet loss between the two machines I used for testing.

 And if this all still does not provide any clues, then you're down to a 
 network packet trace, using Wireshark or similar.


Packet traces I was hoping to avoid. :(
--
Kees Jan

http://java-monitor.com/
kjkos...@kjkoster.org
+31651838192

The secret of success lies in the stability of the goal. -- Benjamin Disraeli


-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: [OT] Inspecting JMX

2012-01-26 Thread Kees Jan Koster
Dear Chris,

 Should I just give up and use JmxRemoteLifecycleListener?
 
 Yes.  You really aren't get to get anywhere on EC2 without it.
 
 I figured since I was using localhost everything would stay there
 anyway. I'll give JmxRemoteLifecycleListener a chance.


Or you could write a small piece of code that lives inside your app and writes 
the monitoring data into the Nagios queue directly. It is a simple text-based 
protocol.
--
Kees Jan

http://java-monitor.com/
kjkos...@kjkoster.org
+31651838192

Human beings make life so interesting. Do you know that in a universe so full 
of wonders,
they have managed to invent boredom. Quite astonishing... -- Terry Pratchett


-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: TC7 + AntCompiler problems with whitespace in pathname

2012-01-17 Thread Kees Jan Koster
Dear all,

 Now about whether this is a bug in Tomcat or its documentation : I am fairly 
 sure that not long ago, I saw a strong warning somewhere in the on-line 
 Tomcat documentation, about not using spaces in pathnames somewhere, as it 
 was not supported by some component.

Perhaps the Tomcat start script can issue a warning in case spaces are found in 
the path?

Kees Jan
-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: [OT] TC7 + AntCompiler problems with whitespace in pathname

2012-01-17 Thread Kees Jan Koster
On 17 jan. 2012, at 11:11, André Warnier a...@ice-sa.com wrote:

 Kees Jan Koster wrote:
 Dear all,
 Now about whether this is a bug in Tomcat or its documentation : I am 
 fairly sure that not long ago, I saw a strong warning somewhere in the 
 on-line Tomcat documentation, about not using spaces in pathnames 
 somewhere, as it was not supported by some component.
 Perhaps the Tomcat start script can issue a warning in case spaces are found 
 in the path?
 You know, I think that this is a lost battle.  The habit is by now so 
 entrenched that there is probably nothing anyone can do by now to extirpate 
 this, other than designing a new OS where this is forbidden.  And you'd still 
 have to deal with funny imported foreign file names and paths.
 But I keep on reacting to issues to do with withespace in pathnames, just 
 because I believe that there is not one programmer alive in the whole world, 
 who has not had some problem with this at some point.
 So if you can save yourself the trouble, by installing Tomcat in some 
 pathname which makes sense and is not a pain to type and forget to quote 
 somewhere, you'll always do yourself a favor in the end.
 
 P.S. In our current globalised world, similar issues exist with filenames 
 containing characters that can perhaps be displayed everywhere, but not 
 /typed/ on 
 

Agreed on the lost battle part. My suggestion is merely to help people who 
never experienced path issues like this before. It gives them a place to start 
looking when tomcat does not work for them.

That is why I suggest to issue a warning and not rewrite the OS.

Kees Jan
-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Tomcat HTTPS Connector Stops working after an hour

2011-12-27 Thread Kees Jan Koster

On 27 dec. 2011, at 06:25, Saravanan L saravan...@te-soft.com wrote:

 Please find the server.xml attached. 
 
 The real problem is I dont know where to look at. 
 -There are no error in logs or the linux sys logs. 
 - I cannot diagnose as the connector(443) does not even connect. 
 

I saw the same with the HTTP BIO connector on Tomcat 7.0.22. It would start 
responding intermittently and then stop responding completely. This particular 
Tomcat has a second HTTP connector pool for an Apache httpd using 
mod_proxy_http. That pool kept working beautifully.

I went back to 6.0.x and now it all works beautifully, as I am used from Tomcat.

I tried reproducing it on a load test machine, but it never showed there.

I am at a loss where to start looking for this. 

Kees Jan

 On 12/24/2011 3:31 PM, Pid wrote:
 
 On 23/12/2011 14:47, Christopher Schultz wrote:
 Saravanan,
 
 On 12/23/11 7:03 AM, Saravanan L wrote:
 Please find the latest thread dump attached with mail.
 Tomcat 7 still crashes without acceptCount.  I am wrong on this
 assumption.
 The response code is 504. It takes about 2 hours for this occur.
 The last status in http-apr-443 (In Server status ) is : 
 Max threads: 5000 
 Seems high, as Chris says.
 
 Current thread count: 249
 Can you post your full server.xml please, inline and with all XML
 comments/usernames/passwords removed.
 
 Current thread busy: 2 
 Low.
 
 Keeped alive sockets count: 40 
 Hmm?  Where does that come from?
 
 Max processing time: 300477 ms
 Processing time: 8788.765 s 
 Seems low for 2 hours of operation.  Where does that number come from?
 
 Request count: 9223
 Error count: 783
 That's about 10%.  What are those errors, exactly?
 
 Bytes received: 0.22 MB
 Bytes sent: 5.43 MB
 Both of those seem low for 2 hours of operation.
 
 What is your application/server doing?
 
 
 p
 
 
 What happens if you configure your HTTPS connector with fewer max
 threads, say, 50? Does the connector lock-up more quickly? What does
 your load profile look like? Is this observable in a testing
 environment or only in production? If you could set up a simple jmeter
 test against a test webapp, that would be ideal for trying to debug
 this issue.
 
 If you switch to NIO or BIO connector, does Tomcat become more stable,
 or do you experience the same phenomenon?
 
 -chris
 
 -
 To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
 For additional commands, e-mail: users-h...@tomcat.apache.org
 
 
 
 -- 
 Regards 
 Saravanan.L 
 
 This message and any attachment(s) contained here are information that is 
 confidential, proprietary to TE Software and Services Pvt Ltd. and its 
 customers. Contents may be privileged or otherwise protected by law. The 
 information is solely intended for the individual or the entity it is 
 addressed to. If you are not the intended recipient of this message, you are 
 not authorized to read, forward, print, retain, copy or disseminate this 
 message or any part of it.
 server.xml
 
 -
 To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
 For additional commands, e-mail: users-h...@tomcat.apache.org


Re: What monitoring do you use/recommend?

2011-04-21 Thread Kees Jan Koster
Hi,

Have a look at http://Java-monitor.com It will send mail or SMS when the tomcat 
dies. It will also make pretty graphs from the JMX data. And it is free. :)

Kees Jan

On 21 apr. 2011, at 17:25, Gautam R Singh (gautsing) gauts...@cisco.com 
wrote:

 Hi List,
 
 My team maintains a small Tomcat 6.x hosting environment for our group (
 intranet only) use. And its growing now (30+ production TC JVM
 instances). We haven't been doing any monitoring just the URL
 availability test . 
 
 And now we are looking for options to monitor it better, we enabled
 remote JMX on all the  JVMs but our existing paid monitoring software
 isn't smart enough to use the  JMX values intelligently. At the moment
 we just monitor the JMX attribute values (heap memory, threads, gc etc)
 and it spits out pretty graphs in reports. We would really want
 something which lets us -- if Currentthreads  are 95% of maxthreads,
 send warn email or run this script.
 
 Don't want to deploy another war in each of those webapps dir and have
 30 urls to check, something central which can query these via JMX rmi 
 maybe generate pretty graphs like those in jconsole?
 
 Thanks!
 
 -
 To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
 For additional commands, e-mail: users-h...@tomcat.apache.org
 

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: How to detect down of tomcat.

2011-03-20 Thread Kees Jan Koster
Or you can install http://java-monitor.com It will send you an e-mail or SMS 
when Tomcat dies. Plus graphs for memory and file descriptors etc

Kees Jan

On 20 mrt. 2011, at 12:07, André Warnier a...@ice-sa.com wrote:

 Or write the script in perl.  That way, it will be portable between 
 Unix/Linux/Windows and basically whatever.
 
 Darryl Lewis wrote:
 You could write something similar using windows powershell. Do you have that 
 installed on your server?
 On 20/03/11 2:14 PM, Hide hide3...@ob4.aitai.ne.jp wrote:
 Hi, Darryl.
 Thanks for your advice.
 Your script looks like very useful.
 But in my case, tomcat is running on Microsoft Windows.
 I am looking for a method to detect the down of tomcat by log file.
 - Original Message -
 From: Darryl Lewis darryl.le...@unsw.edu.au
 To: Tomcat Users List users@tomcat.apache.org
 Sent: Sunday, March 20, 2011 12:00 PM
 Subject: Re: How to detect down of tomcat.
 Put this in a cronjob to fire every minute
 #!/bin/sh
 if [ `ps -ef|grep tomcat|grep -v grep|wc -l` -lt 1 ]
  then
  subject=`tomcat down; date`
  address=m...@domain.com
  ps -efatt.txt
  mail -s $subject $addr -- -fno-reply@yourdomain att.txt
 fi
 Fill in the address with your email address, and you can also pipe an 
 attachment
 For myself, I have scripts that detects when the service is down, sends me 
 an email, then tries to restart it, then will email
 if it has managed to recover it. If it can't restart it after 5 minutes, 
 then I get an SMS.
 In the morning, I can quickly see if it failed overnight, and my beauty rest 
 only gets disturbed in the really bad cases.
 On 20/03/11 1:38 PM, Hide hide3...@ob4.aitai.ne.jp wrote:
 How to detect down of tomcat.
 Helo.
 My environment is tomcat7, java1.6, windows.
 When process of tomcat terminated abnormally,
 is there any method or setting that output the abnormal termination to a log 
 file?
 If there is it, please let me know.
 tomcat is the premise that is not service of windows, but even service is 
 good.
 The motive that wants to know such a thing is because I want to detect down 
 of tomcat in  automatically without human operation.
 I set a file and keyword in a log monitor tool, and it  detects down of 
 tomcat automatically.
 Thanks for your advice.
 -
 To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
 For additional commands, e-mail: users-h...@tomcat.apache.org
 -
 To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
 For additional commands, e-mail: users-h...@tomcat.apache.org
 
 
 -
 To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
 For additional commands, e-mail: users-h...@tomcat.apache.org
 

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Accessing context information remotely - Context.getAvailable() etc.

2011-01-06 Thread Kees Jan Koster
Dear Ziggy,

 I was looking at the above for the above information as i am working on a
 client tool that tries to find out this exact information. The tool i am
 using connects to Tomcat via JMX but i am not sure if i can get the same
 information via JMX. Can i access the Context class? or is there any other
 way (Mbeans?) i can check if a context is running via JMX?

You can get the same information using JMX. That's how Java-monitor.com does 
it. :)

Why are you making a tool to get this information? There are loads of tools out 
there.
--
Kees Jan

http://java-monitor.com/
kjkos...@kjkoster.org
06-51838192

Change is good. Granted, it is good in retrospect, but change is good.


-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Tomcat died on java.lang.OutOfMemoryError: requested 2147483664 bytes for Chunk::new. Out of swap space? message

2010-05-28 Thread Kees Jan Koster
Dear Leon,


 It'd be nice to see some speed comparisons between -client -server and
 -Xint options and not only -server vs -Xint.


I did some benchmarks with these settings. I was actually exploring
hyperthreading in P4 hardware when I found -server to be twice as fast
for even simple programs.

http://java-monitor.com/forum/showthread.php?t=552

Ever since I have been calling -server the go faster flag. :)
-- 
Kees Jan

http://java-monitor.com/forum/
kjkos...@gmail.com
06-51838192

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Tomcat Shutdown suddenly / random

2010-04-17 Thread Kees Jan Koster
Dear All,

 I don't believe Tomcat has any System.exit calls in it, so you could
 grep your code looking for such calls.


Note that findbugs can be used for that. It will issue a warning for code that 
calls System.exit().
--
Kees Jan

http://java-monitor.com/
kjkos...@kjkoster.org
06-51838192

Change is good. Granted, it is good in retrospect, but change is good.


-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Stopping Catalina From MBean Server

2010-03-12 Thread Kees Jan Koster
Dear Gerukan,

 Is anybody try to stop the catalina engine from jconsole. I have been using
 Tomcat 6.0.20, and trying to stop Catalina from jconsole. I click
 Catalina/Service/Catalina/Operations/stop on the MBean view. INFO messages
 are written to the console related with stopping operation like below;
 
 .
 INFO : Stopping service CATALINA
 INFO : Stopping Coyote HTTP/1.1 on http-8080
 
 But never shut downs cleanly and waits there. If you look at the MBean view
 now, some of them are removed.


A while back I wrote a short howto on diagnosing Tomcat servers that hang on 
shutdown. Perhaps you find it useful? 
http://java-monitor.com/forum/showthread.php?t=616 In short: make a thread dump 
and hunt down the threads that should have died, but have not.
--
Kees Jan

http://java-monitor.com/
kjkos...@kjkoster.org
06-51838192

The secret of success lies in the stability of the goal. -- Benjamin Disraeli


-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Tomcat dies suddenly

2010-02-03 Thread Kees Jan Koster

Dear Carl,

So this problem happens on one machine or on more than one? If it is  
limited to one machine, I would be inclined to run memtest86 on it to  
see if the RAM is good.


Kees Jan

On 4 feb 2010, at 02:07, Carl c...@etrak-plus.com wrote:


Chris,

Interesting idea.  I tried over the weekend to force that situation  
with JMeter hitting a simple jsp that did some data stuff and  
created a small display.  I pushed it to the point that there were  
entries in the log stating it was out of memory (when attempting to  
GC, I think) but it just slowed way down and never crashed.  I could  
see from VisualJVM that it had used the entire heap but, again, I  
could never get it to crash.


Strange because it doesn't have the classic signs (slowing down or  
throwing out of memory exceptions or freezing), it just disappears  
without any tracks.  I am certain there is a reason somewhere, I  
just haven't found it yet.


Thanks for your suggestions,

Carl

- Original Message - From: Christopher Schultz ch...@christopherschultz.net 


To: Tomcat Users List users@tomcat.apache.org
Sent: Wednesday, February 03, 2010 5:45 PM
Subject: Re: Tomcat dies suddenly



-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Chuck,

On 2/3/2010 5:00 PM, Caldarale, Charles R wrote:

From: Carl [mailto:c...@etrak-plus.com]
Subject: Re: Tomcat dies suddenly



I am hoping I can see failure at the point of failure
with the heap dump options


That won't have any effect on the Linux OOM killer.  If it is the  
OOM killer taking out Tomcat, the JVM will not receive any  
notification - all threads will just be terminated with extreme  
prejudice.  There won't be a chance for the heap dump to happen.


Maybe what Carl should try is to actually cause an OOME without
triggering the OOM Killer.

Carl: you said that everything is copacetic when you run with a  
smaller
heap, right? Well, run with that smaller heap, but then write a  
simply
servlet/JSP/whatever that just allocates huge, say, byte[] buffers  
until
it gets an OOME and verify that you get a heap dump when that  
happens.


- -chris
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAktp/JEACgkQ9CaO5/Lv0PBI0ACgmDLJVxM5xDiN5UIFsqqKRj7i
2J8AoL8ENGsYxwudtFrLy+tZTzmr/rxC
=4yC9
-END PGP SIGNATURE-

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org




-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Tomcat writing the wrong timestamp on compiled JSP's

2009-08-14 Thread Kees Jan Koster

Dear Mon Cab,

Given the results below it looks like this is not a daylight savings  
time issue.  In fact its extremely odd behavior.  Both Tomcat and  
the OS have the correct time, and yet when Tomcat compiles the JSP,  
the java and class files in the work directory have a create /  
modified time-stamp exactly 1 hour ahead of the time that they were  
created.


I have seen these issues in situations where I was working on an NFS  
drive when the server and my local machine had different ideas about  
what time it was.


Are you working on a local disk, or a network mounted drive?
--
Kees Jan

http://java-monitor.com/
kjkos...@kjkoster.org
06-51838192

The secret of success lies in the stability of the goal. -- Benjamin  
Disraeli



-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Tomcat writing the wrong timestamp on compiled JSP's

2009-08-14 Thread Kees Jan Koster

Dear Mon Cab,


Yes.  That fixed it.  Thankyou Kees.


Glad to help.


For some reason, the issue was with my  WinSCP client.

When I edited a jsp and then looked at the jsp file timestamp on the  
remote machine with WinSCP it showed the timestamp as my the current  
time (local and remote system times are the same).  However, when I  
looked up the timestamp of the same edited JSP on the remote box it  
was stamped an hour ealier than the current time.


I reconfigured WinSCP not to preserve the timestamp, and that fixed  
the issue.  The wierd thing is that now WinSCP is showing the remote  
JSP files as being timestamped an hour later.  Since the system time  
on my local machine is correct,  I'm a bit confused as to what  
WinSCP is doing here.


I have yet to meet a developer who truly understands working with time  
zones and who can write code that deals with multiple time zones  
correctly. I have met loads of developers who think they can,  
though. ;-)


Also, NTP is your friend.
--
Kees Jan

http://java-monitor.com/
kjkos...@kjkoster.org
06-51838192

Human beings make life so interesting. Do you know that in a universe  
so full of wonders,
they have managed to invent boredom. Quite astonishing... -- Terry  
Pratchett



-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: JNDI DataSource Leaks

2009-08-07 Thread Kees Jan Koster

Dear Chris,

I have to restart Tomcat regularly because it exhausted my MySQL  
connections. Show processlist confirms the problem.


I use Hibernate. Do you?

I'll dig deeper later when I have more time.

Kees Jan

On 7 aug 2009, at 16:53, Christopher Schultz ch...@christopherschultz.net 
 wrote:



-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

All,

Recently, there was a post on the list regarding connection pool  
leakage

from Tomcat (ref:
http://www.nabble.com/Right-way-to-close-database-connection-pool-td24832197.html 
).

I'm sure this question has come up before as well.

I contributed a listener class that would shut down a JNDI DataSource
and installed it in my development environment. Satisfied that I was
protected from the evils of JDBC connection pool leakage, I moved on
with my life.

This morning, as I did a live build-and-re-deploy of my webapp, I saw
the JNDIDataSourceShutdownListener doing its thing, and I got to
thinking: I receploy my development webapp over and over again during
the day and I've never run out of database connections. It's pretty  
rare

that I have to really bounce Tomcat, so I decided to see what happened
when I disabled my listener and let the alleged leak occur.

My environment:
Linux 2.6.14-gentoo-r5 #2 PREEMPT Sat Dec 17 16:30:55 EST 2005 i686  
AMD

Athlon(tm) XP 1700+ AuthenticAMD GNU/Linux
java version 1.6.0_13
Java(TM) SE Runtime Environment (build 1.6.0_13-b03)
Java HotSpot(TM) Client VM (build 11.3-b02, mixed mode, sharing)
Tomcat 5.5.26
MySQL Connector/J 5.1.7 (installed into CATALINA_HOME/common/lib)
MySQL Server 5.0.70

I deploy my webapp by creating a directory in my appBase and filling  
it

with files, including my META-INF/context.xml file:

Context reloadable=true
  WatchedResourceWEB-INF/struts-config.xml/WatchedResource

  Resource name=jdbc/myDataSource
   auth=Container
   type=javax.sql.DataSource
   maxActive=1
   maxIdle=1
   maxWait=1

url=jdbc:mysql://localhost.localdomain/myDb? 
characterEncoding=utf8amp;dumpQueriesOnException=true

   username=scott
   password=tiger
   driverClassName=com.mysql.jdbc.Driver
   removeAbandoned=true
   removeAbandonedTimeout=30
   logAbandoned=true
   testOnBorrow=true
   validationQuery=/* ping */ SELECT 1
   /

  Resource name=jdbc/myOtherDataSource
   auth=Container
   type=javax.sql.DataSource
   maxActive=1
   maxIdle=1
   maxWait=1

url=jdbc:mysql://localhost.localdomain/myOtherDb? 
characterEncoding=latin1amp;dumpQueriesOnException=true

   username=scott
   password=tiger
   driverClassName=com.mysql.jdbc.Driver
   removeAbandoned=true
   removeAbandonedTimeout=30
   logAbandoned=true
   testOnBorrow=true
   validationQuery=/* ping */ SELECT 1
   /
/Context

Yes, I have two JNDI DataSources.

I re-deploy my webapp by simply replacing whatever files need to be
updated. If I touch a .class file in WEB-INF/classes, Tomcat will  
reload

my webapp.

I disabled my JNDI DataSourceShutdownListener and repeatedly  
recompiled
a class and updated my webapp's deployment directory. Tomcat  
redeployed
my web application each time, and I ran mysqladmin -u root  
processlist
every second or so during the restart to see what was happening with  
the

server.

If I was lucky, I could see both the old connection (there's only  
one)

from my primary DataSource (the first one listed) and the new one at
the same time (my webapp reads a bunch of stuff from the db on  
startup,

so a JDBC connection is immediately created and used from the primary
DataSource. The secondary DataSource is rarely used and no connections
were ever established via that DataSource during my tests.

After a second or two, the old connection would disappear from MySQL
server's process list.

Sometimes, I could get it to hang around for as much as 30 seconds  
after

the redeploy, but it always dies. I suspect that the delay has to do
with GC scheduling.

Finally, after several restarts, I tried checking the heap:

$ ./jmap -histo:live 16816 | grep BasicDataSource
369: 2240  o.a.t.dbcp.dbcp.BasicDataSource

Hmm... maybe there are a bunch of dead ones laying around:

$ ./jmap -histo 16816 | grep BasicDataSource
369: 2240  o.a.t.dbcp.dbcp.BasicDataSource

Nope.

So it appears that on my setup, this leak does not occur. (!)

I have a theory about this.

In all my years of using MySQL, I have discovered that it is very
developer-friendly. That is, it is very tolerant of abuse: you can  
write
the sloppiest JDBC code imaginable and never run out of resources on  
the

server side.

Oracle, on the other hand, I have observed to be very consistently
adamant about managing every little detail of your connections,
statements, cursors, etc.: if you forgot to close a ResultSet  
somewhere,
you were screwed (in spite of the fact that the JDBC spec requires  
that

ResultSets bound to Statements 

Re: Tomcat Memory Script

2009-06-16 Thread Kees Jan Koster

Dear Matt,

I am not too familiar with jmap, jstack or jinfo.  I could write a  
script
that uses jmap to get the memory of the tomcat running and then  
store the

necessary information in a log file.


That is an option, or you could use a tool that does that for you,  
plus make nice graphs. Check out http://java-monitor.com and see http://java-monitor.com/forum/livedemo.php 
 for a live demo. It should take you about five minutes to set up. If  
it takes you longer, I'd love to hear why. :-)

--
Kees Jan

http://java-monitor.com/forum/
kjkos...@kjkoster.org
06-51838192

Change is good. Granted, it is good in retrospect, but change is good.


-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Preventing OutOfMemoryError: Java heap space

2009-05-13 Thread Kees Jan Koster

Dear Todd,


I'm not sure I can use session counting, as my
session size is not consistent. I could try to estimate
the size of each session, and keep a global counter,
but that seems like a lot of work.


JMX offers quite a bit of insight in what your GC is doing. You could  
implement throttling as a function of the number of full GC's that  
your system experiences. While full GC's do happen from time to time,  
you could trigger if they happen more than once per so-many seconds.  
Actual values would probably be highly application-specific.


I agree with someone else that 256MB is not a whole lot or RAM for a  
busy server. With current prices of RAM I would go for a gig or two  
and take it from there.



I understand that garbage collection is, err, whimsical,
but I think I'm going to give it a go anyway.
I will keep in mind that the memory results
from Runtime will probably under-report the
available memory. I'm going to add an explicit
request for garbage collection, _before_ the memory
becomes seriously depleted.



Here is what happens if you do http://java-monitor.com/forum/showthread.php?t=188 
 It is not pretty, I can tell you that. I add -XX:-DisableExplicitGC  
to my JAVA_OPTS for this very reason.


--
Kees Jan

http://java-monitor.com/forum/
kjkos...@kjkoster.org
06-51838192

The secret of success lies in the stability of the goal. -- Benjamin  
Disraeli



-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: #include'ing property files into conf/catalina.properties

2009-04-26 Thread Kees Jan Koster

Dear uma_rk,


We centralize configurations in /etc/conf and hence I would
like to import property configuration files into
${CATALINA_BASE}/conf/catalina.properties
using #include as in

   // conf/catalina.properties
   ...
   #include /etc/conf/mytomcat.properties
   ...

Please let me know if this is possible.



Not out of the box. I'm sure that you can script something to this  
effect in your system's startup script though. Add some placeholders  
and used sed or even gcc's precompiler if you insist on the #include  
syntax.


Personally I store all my configurations in SVN, relying on SVN's diff  
function to help me iron out any differences. Granted, that won't  
scale beyond 10 or so Tomcat configurations, but it does the job until  
you reach that stage.

--
Kees Jan

http://java-monitor.com/forum/
kjkos...@kjkoster.org
06-51838192

Change is good. Granted, it is good in retrospect, but change is good.


-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: 15 second for redeployment is to much

2009-04-19 Thread Kees Jan Koster

Dear Khlystov,

 1. 5 second (using maven) compile source ( usually it is 1 or 2  
files )

 2. 0 second copy *.class file into Tomcat/webapps


Stop using Maven for simple compiles and write a small shell script  
that just calls javac with the webapp's WEB-INF/classes as output dir.



 3. 5-7 seconds waiting while Tomcat finds that my webapp deployed
files are changed


There is a timer somewhere that you can lower for this. I forget  
precisely which one. It will slow down Tomcat a bit, but you will  
redeploy faster.



 4. 1 seconds takes to undeploy my webapp
 5. 3-5 seconds takes to deploy ( really initialize Wicket  Spring
Beans frameworks with my data)



Well, you chose these frameworks, so you'll have to live with their  
startup times. Lazy initialisation *may* help, if you initialise more  
than you need for a specific test.


--
Kees Jan

http://java-monitor.com/forum/
kjkos...@kjkoster.org
06-51838192

Rule 1 for being in a hole: stop digging.


-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Is there a configurable parameter in web.xml for....

2009-03-10 Thread Kees Jan Koster

Dear Paul,

... the time period that tomcat spends honouring current requests  
when the

server is shutdown?

We have a web app used for secure file transfers and occasionally we  
need to
take it down, however some requests for downloads can take more than  
an hour

as the system allows very large files to be uploaded.

I know tomcat will stop taking new requests when the server is  
stopped, but

what would be good would be to set a parameter saying fully honour all
current requests before you completely finish (tomcat may already do  
this I

am not sure).



Tomcat does not do this out of the box. Since you have special  
requirements, you could program this yourself.


You could write a servlet that shuts down the HTTP connector using  
JMX. I am not 100% sure that that will not kill the running threads,  
but you can easily test that. Here is some code to access the  
connector and stop and start it. http://java-monitor.com/forum/showthread.php?t=169 
 Accessing the Tomcat server to kill it is a matter of finding the  
right mbean and method to invoke. You can use jconsole to examine the  
mbeans in your Tomcat server.

--
Kees Jan

http://java-monitor.com/forum/
kjkos...@kjkoster.org
06-51838192

Rule 1 for being in a hole: stop digging.


-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Tomcat Shutdown

2009-03-10 Thread Kees Jan Koster

Dear Aleksandr,


So how to ping to application so that tomcat is going to be shutdown?


http://java.sun.com/javaee/5/docs/api/javax/servlet/ServletContextListener.html

Register it in web.xml

--
Kees Jan

http://java-monitor.com/forum/
kjkos...@kjkoster.org
06-51838192

The secret of success lies in the stability of the goal. -- Benjamin  
Disraeli



-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Hello

2009-02-12 Thread Kees Jan Koster

Dear Okey,

Am using windows vista and i wish to know what version of apache  
tomcat to download.



Any version you like.

--
Kees Jan

http://java-monitor.com/forum/
kjkos...@kjkoster.org
06-51838192

Rule 1 for being in a hole: stop digging.


-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: deploying web application on remote server

2009-02-12 Thread Kees Jan Koster

Dear sneha,

I have developed web application using netbeans , I wish to deploy  
on remote server .
I have placed files under / webapps  directory of remote server.  
Tomcat is unable to locate libraries .  how do I make tomcat locate  
libraries which are under WEB-INF/lib folder


Why don't you give us an error message to look at? Then we might be  
able to help you.


--
Kees Jan

http://java-monitor.com/forum/
kjkos...@kjkoster.org
06-51838192

Rule 1 for being in a hole: stop digging.


-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: How to exclude some classes to being serialized in sharing session with clustered tomcats?

2009-02-10 Thread Kees Jan Koster

Dear Stanimir,

How to exclude some classes to being serialized in sharing session  
with

clustered tomcats?
I`m using hibernate, spring, java mail, apache commons dbcp, pool ...
and to serialize/deserialize sessions all the classes must implement
Serializable (or Externalizable), and I think that it`s not a solution
to correct all classes I use in all APIs. And why the application  
scope

beans are serialized too?



They are probably referenced from objects in your sessions. Please  
read up on the Serializable and Externalizable interfaces and Java's  
transient keyword.

--
Kees Jan

http://java-monitor.com/forum/
kjkos...@kjkoster.org
06-51838192

Human beings make life so interesting. Do you know that in a universe  
so full of wonders,
they have managed to invent boredom. Quite astonishing... -- Terry  
Pratchett



-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: [Tomcat] [daemon] java.lang.OutOfMemoryError unable to create new native thread

2009-02-03 Thread Kees Jan Koster

Dear Steve,

One additional restriction I have is a security bureaucracy from  
hell.  As far as console access I have a two-hop connection.


Is there no test system that you can use to reproduce this, under less  
insane restrictions? Have you considered hauling your behind to the  
data center to sit behind the console for a few hours? In the past I  
found that I could spend days fighting the bizarre rules with half- 
working technical solutions, or just go to the actual machine and look  
at the display there. Of course, it was only a two hour drive in my  
case. Yours might well be at the other end of the world.


As far as GUI access I have some crappy device to log into that lets  
me have really bad keyboard/mouse control of the machine, which,  
unless I can overcome this means that GUI-based tools are not going  
to work, and as for remote GUI access, see above security bureaucracy.


Which means I'm looking for command-line equivalents for what   
JConsole does, particularly the threads tab.  Any ideas along that  
path?


There are some JMX command line tools, but JMX is really easy to use  
from code. You could write a simple JSP page to give you the figures  
that way. Script with curl/wget and graph with Excel. :)

--
Kees Jan

http://java-monitor.com/forum/
kjkos...@kjkoster.org
06-51838192

The secret of success lies in the stability of the goal. -- Benjamin  
Disraeli



-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: dbcp pool freezing

2009-02-03 Thread Kees Jan Koster

Dear Eric,


and see that all my threads are in the WAITING state from
org.apache.tomcat.dbcp.pool.impl.GenericObjectPool.borrowObject
(GenericObjectPool.java:810)

I don't believe I have any connection leaks in my code


Belief is not a substitute for evidence...  Your webapp is clearly  
not

returning connection objects to the pool in a timely fashion.


I am tempted to agree with you; I just am having trouble  
understanding how

or why they aren't being returned properly.


I'd suggest you look into hooking your application up to Java- 
monitor.com. It will pick up on Tomcat-managed data sources  
automatically, and it can also help you do Hibernate session leak  
detection (if you use Hibernate). http://java-monitor.com/forum/livedemo.php 
 shows you what it looks like. Just click on another server @ ...  
to see the database connection pool usage and Hibernate sessions over  
the past two days (scroll down to Hibernate Sessions).


If you prefer a local solution, check out p6spy. It has the capability  
of giving you a stack trace for each abandoned database connection.  
Alternately, it can show you the stack trace of each allocated JDBC  
connection. Of course, such stack traces are relatively expensive to  
make for each database operation, so you may want to disable that  
functionality once you solved your issues. :)


--
Kees Jan

http://java-monitor.com/forum/
kjkos...@kjkoster.org
06-51838192

Human beings make life so interesting. Do you know that in a universe  
so full of wonders,
they have managed to invent boredom. Quite astonishing... -- Terry  
Pratchett



-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Facing “Javax.servlet.servletException: c annot connect to windows server”. error

2009-01-23 Thread Kees Jan Koster

Dear prakash.s,

  I had visited the link suggested by you, please let me know  
how to

change the java property -Djava.awt.headless=true

  Is it just enough to type the command prompt?


For tomcat, you can either edit catalina.sh and add it after the Java  
command, for example.


Google for tomcat JAVA_OPTS.
--
Kees Jan

http://java-monitor.com/forum/
kjkos...@kjkoster.org
06-51838192

Human beings make life so interesting. Do you know that in a universe  
so full of wonders,
they have managed to invent boredom. Quite astonishing... -- Terry  
Pratchett



-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Facing “Javax.servlet.servletException: c annot connect to windows server”. error

2009-01-22 Thread Kees Jan Koster

Dear S.Prakash,

   I am using jrxml for preparing the reports in excel  
files. It is
working fine in windows but if the same is implemented (server)MAC  
OS tomcat
I am facing  Javax.servlet.servletException: cannot connect to  
windows

server – not enough.

 I am using Tomcat 5.5.28 as server, MYsql as database and  
MAC(Tiger)

as OS. Please suggest to over come this issue.



Have you considered trying to use -Djava.awt.headless=true and  
unset DISPLAY? http://java-monitor.com/forum/showthread.php?t=3

--
Kees Jan

http://java-monitor.com/forum/
kjkos...@kjkoster.org
06-51838192

Human beings make life so interesting. Do you know that in a universe  
so full of wonders,
they have managed to invent boredom. Quite astonishing... -- Terry  
Pratchett



-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: JMX Controlpanel Application

2009-01-21 Thread Kees Jan Koster
Dear Gerardus,

 I was just wondering if anyone can recommend a open source that one can
 use to build control panels based on jmx properties published by the
 jvm or your own application.

 We have monitoring software that can alert us when some jmx values
 exceeds a threshold but I would like to see a tool where I can easily
 collate different servers and be able to connect a button to a jmx
 action. (apologies if I don't use the correct jmx terminology).


JMX is pretty easy to use from your own code. I wrote some JSP's in
the past that would do simple management operations on MBeans in a
Tomcat server. Here is some code that I wrote to restart a Tomcat
connector using JMX.

Otherwise, there are some command line tools that alloy you to make
JMX calls and use JMX operations.

--
Kees Jan

http://java-monitor.com/forum/
kjkos...@kjkoster.org
06-51838192

The secret of success lies in the stability of the goal. -- Benjamin Disraeli

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



networkaddress.cache.ttl and networkaddress.cache.negative.ttl

2009-01-20 Thread Kees Jan Koster
Dear All,

Do any of you guys tune networkaddress.cache.ttl or
networkaddress.cache.negative.ttl? If so, what values do you use?

-- 
Kees Jan

http://www.kjkoster.org/
kjkos...@gmail.com
06-51838192

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Is it possible to delay HTTP port opening?

2009-01-18 Thread Kees Jan Koster

Dear Jesper,

At server startup, is it possible to configure tomcat to not open  
it's http ports so early?


By default the server starts to receive http requests quite long  
before initialization is complete. These requests are held open  
until the server is ready to respond, and then the response is sent.


In my case this behavior is not desirable, I would like the server  
to be fully ready and warmed up before the http port is actually  
opened for requests.


The reason is the server is part of a load balanced pool, and if the  
load balancer detects a just-started server too early, users will  
experience unacceptably long response times.


I believe the suggestion to improve the loadbalancer detection logic  
is the better one. But, in case that is a closed source beast:


You could use a script on the Tomcat machine to only open the HTTP  
ports in the firewall of that machine after a few seconds from Tomcat  
starting. Each machine does have its own port filtering, right?


You could review the code in your Tomcat webapp to take away some of  
the slow starting-ness. On modern hardware a webapp should be up and  
running in a few seconds, and careful background-loading should spread  
out other startup initialisation.


--
Kees Jan

http://java-monitor.com/forum/
kjkos...@kjkoster.org
06-51838192

The secret of success lies in the stability of the goal. -- Benjamin  
Disraeli



-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: How to turn off JNDI datasource connection pooling

2009-01-16 Thread Kees Jan Koster

Dear Keith,

It's not clear what you want to do (as opposed to what you don't  
want to
do).  Is your goal to use a  new DB connection for every DB access  
your

webapp makes, or do you want to do DB connection 

pooling inside your webapp, or ???



Not using connection pooling at all is a real performance killer.



- Chuck


The security for the data within the database is entirely baked into  
the
restriction that every user has their own database connection. As  
far as I
can tell it is not possible to use connection pooling a retain  
secure access

to the data without an awful lot of re-work.

At the moment I am using a new DB connection for every DB access my  
app
makes. Later I may implement my own database polling but either way  
it will

be my code initiating connection requests not Tomcat's.

Setting maxactive to zero stops exceptions but the app just seems to  
be

hanging.



Two options that I see:

1) Why are you still using Tomcat's pool at all? Just create your own  
connections in the code. Instead of each lookup just do the old  
driver.createConnection() etc. Where driver is some static somewhere.


2) Write a trivial connection pool and drop it into the Tomcat lib.  
Use the new Tomcat JDBC pool code as a starting point.

--
Kees Jan

http://java-monitor.com/forum/
kjkos...@kjkoster.org
06-51838192

The secret of success lies in the stability of the goal. -- Benjamin  
Disraeli



-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: connector restart / api

2009-01-13 Thread Kees Jan Koster

Dear Mike,

What is the recommended way if any, of restarting the http  
Connector ?  i.e.

is there an api for achieving this?



You asked before. I suggested you use JMX. Have you made any headway  
in that direction?

--
Kees Jan

http://java-monitor.com/forum/
kjkos...@kjkoster.org
06-51838192

Rule 1 for being in a hole: stop digging.


-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: connector restart / api

2009-01-13 Thread Kees Jan Koster

Dear Mike,

You mentioned JMX - would I be able to use JMX in such a way that it  
would
allow me to restart the connector programatically upon a url request  
into my

web app?


I wrote some sample code that does just that, have a look at
  http://java-monitor.com/forum/showthread.php?t=169

Does this answer your question?

--
Kees Jan

http://java-monitor.com/forum/
kjkos...@kjkoster.org
06-51838192

Human beings make life so interesting. Do you know that in a universe  
so full of wonders,
they have managed to invent boredom. Quite astonishing... -- Terry  
Pratchett



-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Pros and cons of readonly UserDatabase (tomcat-users.xml)

2009-01-08 Thread Kees Jan Koster

Dear Petr,

any comment on this subject? The question is related to OpenSolaris  
package

(*) where we have all files owned by root and tomcat is executed with
dedicated user credentials.

Currently tomcat-user.xml and conf directory is owned by tomcat user  
but it

makes some noise in our package auditing.

The question is what is limitation of setting user database as  
readonly (in
server.xml) for Tomcat 6.0.18 and having tomcat-user.xml and conf  
directory

owned by root.



Does tomcat-users.xml ever have to be written from Tomcat? I routinely  
run with tomcat-users.xml as read-only and it is no problem for me. I  
don't actually use that mechanism at all.

--
Kees Jan

http://java-monitor.com/forum/
kjkos...@kjkoster.org
06-51838192

Human beings make life so interesting. Do you know that in a universe  
so full of wonders,
they have managed to invent boredom. Quite astonishing... -- Terry  
Pratchett



-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Tomcat ./shutdown

2009-01-07 Thread Kees Jan Koster

Dear Thinh,

I use apache-tomcat-5.5.17 and sometimes when I call ./shutdown.sh,  
the java process which runs Tomcat still alive.


Because this java process is still alive, the next call ./startup.sh  
does not work. Thus, I have to kill this Java process first.


Could you please give me a hint how I avoid this problem?



Here is some discussion on your issue: 
http://java-monitor.com/forum/showthread.php?t=83

Basically, kill -3 Tomcat as it hangs after you tried to shut it down.  
Then solve the problem that causes your Tomcat to hang.

--
Kees Jan

http://java-monitor.com/forum/
kjkos...@kjkoster.org
06-51838192

The secret of success lies in the stability of the goal. -- Benjamin  
Disraeli



-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Tomcat restart using code

2009-01-07 Thread Kees Jan Koster

Dear Mike,


Since I have not found a documented way of refreshing the
ServerSocketFactory (in order to reload the ssl trust store)
I would like to be able to perform a Tomcat Restart from within i.e.
restart Tomcat using java code inside the servlet.
Restarting the connector would also do the job for me.



There was some discussion about this subject on Java-monitor: 
http://java-monitor.com/forum/showthread.php?t=152

You can use JMX to find the connector mbeans to restart them.

I'm curious why you would want to do that, though?
--
Kees Jan

http://java-monitor.com/forum/
kjkos...@kjkoster.org
06-51838192

The secret of success lies in the stability of the goal. -- Benjamin  
Disraeli



-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: what have i done to get 9 million cookies?

2009-01-06 Thread Kees Jan Koster

Dear Leon,


i'm performing a jmap -histo:live on a tomcat which froze because of
full (8GB) old space gen, and my top 10 looks like:

num #instances #bytes  class name
--
  1:  19268009 2655683368  [C
  2:  17410092 1392807360   
org.apache.tomcat.util.buf.MessageBytes
  3:  17411294 1114322816   
org.apache.tomcat.util.buf.ByteChunk
  4:  17410562  974991472   
org.apache.tomcat.util.buf.CharChunk

  5:  19275640  771025600  java.lang.String
  6:   8697280  626204160  javax.servlet.http.Cookie
  7:   8699584  417580032   
org.apache.tomcat.util.http.MimeHeaderField

  8:   188  134247456
[Lorg.apache.tomcat.util.http.MimeHeaderField;
  9:198645  114493776  [Ljava.lang.Object;
 10: 21303   30450504  [B


So how did I manage to get almost 9 million of mimeheaderfields and
cookies and 17 millions message bytes and chunks.
During normal operation mode the number of the above doesn't increase
except before the gc freeze.



You can try to generate a heap dump and analyse it using jhat. Trouble  
is, jhat requires insane amounts of memory. So for you 8GB dump you'd  
need something in the order of 32GB RAM for jhat.


If that is feasible, you could lower the memory limits on your  
machine, run the tests again to get a smaller dump with (hopefully)  
the same characteristics.

--
Kees Jan

http://java-monitor.com/forum/
kjkos...@kjkoster.org
06-51838192

The secret of success lies in the stability of the goal. -- Benjamin  
Disraeli



-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Servlets works fine, JSP's don't

2009-01-02 Thread Kees Jan Koster

Dear davefury,


The logs doesn't give me any information about the error.

The environment is Debian Etch with Apache2, mod_jk connector and  
tomcat 5.


Hmmm, Debian... Are you using the sucky repackaged Tomcat from the  
distro, or the normal one that you downloaded from tomcat.pache.org  
manually?


If you are using the repackaged one, the Debian package is a  
nonstandard configuration that (among other things) suppresses much of  
the debug output of Tomcat.


To eliminate Apache from the equation, you could consider an ssh  
tunnel. I'd like to know that your Tomcat is not the Debian package  
first, though.

--
Kees Jan

http://java-monitor.com/forum/
kjkos...@kjkoster.org
06-51838192

The secret of success lies in the stability of the goal. -- Benjamin  
Disraeli



-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Tomcat 5.5 error

2008-12-25 Thread Kees Jan Koster
thank u again. I have downloaded the binary version and placed it on  
my

desktop and And ran it using sh startup.sh.
and  then I access the http://localhost:8080/ site successfully. but  
when i

try to access  http://localhost:8080/mms_test. I get the same error as
before. However when I try to access the log file, there is only one  
file:

catalina.out and here it's its content:
./catalina.sh: 357: /usr/bin/java/bin/java: not found
./catalina.sh: 357: /usr/bin/java/bin/java: not found
./catalina.sh: 357: /usr/bin/java/bin/java: not found


You did set JAVA_HOME?
--
Kees Jan

http://java-monitor.com/forum/
kjkos...@kjkoster.org
06-51838192

The secret of success lies in the stability of the goal. -- Benjamin  
Disraeli



-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Performance with Tomcat

2008-12-22 Thread Kees Jan Koster

Dear Chris,

We've been running into some issues lately with our Tomcat 6  
instances where performance will slow to a crawl.  Unfortunately, no  
error messages are present in the logs and we really don't know why  
this is happening.  It does appear that the issue is happening when  
we get a lot of users on the system at one time.  It would make  
sense, but we're only talking about 300 or so concurrent users.   
There must be a point of misconfiguration on our part but none of us  
really have any experience with Tomcat outside of simply setting it  
up and running it out of the box, which isn't much.  So, that leads  
me to why I'm posting to the user list:


1. Are there any tools or utilities we can use to get an  
understanding of what Tomcat is doing while it's running (processes,  
memory per process, and more)?


VisualVM, JConsole, Java-monitor.com, many commercial tools.

2. I suspect there are some very large Tomcat installations out  
there.  Has any information from those installations been  
published?  Is there a guide or set of documentation on how to scale  
with Tomcat as a web server?


There is a lot of documentation, but more on tuning Java, rather than  
Tomcat.  Tomcat has surprisingly few tunables that get mentioned on  
this list. It is pretty lightweight in the sense that there is not a  
whole lot of Tomcat going on between you and an incoming HTTP request.


Most likely, if you tune the underlying VM to your workload, your  
problems go away (or move to a place that is not your jurisdiction).


Perhaps we can help?

What is your machine doing when Tomcat is slow? Network/disk I/O- 
bound? CPU-bound? What percentage is your machine spending in system  
time, as opposed to user time?

--
Kees Jan

http://java-monitor.com/forum/
kjkos...@kjkoster.org
06-51838192

The secret of success lies in the stability of the goal. -- Benjamin  
Disraeli



-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Redeploy leaks

2008-12-21 Thread Kees Jan Koster

Dear Adriano,

As I had having OutOfMemory exceptions (PermGen) when redeploying an  
application, I started to verify things using Eclipse Memory Analyzer.


I've discovered some real leaks, for example caused by the Java  
Disposer thread being instantiated using the Webapp classloader.  
After fix this, when I redeploy the application, Memory Analyzer  
shows that there are no non-weak/soft references to the undeployed  
classloader. But it (and the classes allocated by it) is never  
garbaged collected.


I've tried different VM switches (-XX:+CMS*) and none make the  
classloader be collected. Thinking about word Perm (permanent) and  
some sources, I've done non-web testing and there a custom  
classloader *is* garbaged collected.


So what could be the problem when running in Tomcat?

I'm using Tomcat 6.0.18, JDK 1.6.0-10 (Linux and Windows) and Apache  
Wicket. I've not put any libraries in tomcat/lib, they are all on  
the WEB-INF/lib. Wicket uses ThreadGlobals, but I don't think this  
may be a problem, because Eclipse Memory Analyzer seems to show  
references from them, but it didn't show any references in my case!


Here's some more discussion in that subject. http://java-monitor.com/forum/showthread.php?t=7 
 In particular, that thread suggests you read http://opensource.atlassian.com/confluence/spring/pages/viewpage.action?pageId=2669 
 for some known permgen leak offenders. Perhaps some of these might  
give you more corners to peel at for your application?

--
Kees Jan

http://java-monitor.com/forum/
kjkos...@kjkoster.org
06-51838192

Human beings make life so interesting. Do you know that in a universe  
so full of wonders,
they have managed to invent boredom. Quite astonishing... -- Terry  
Pratchett



-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Sessions not releasing for apache-tomcat 5.5.23

2008-12-21 Thread Kees Jan Koster

Dear Sudip,


But recently there are couple of occasions where one or
more users are failing to forcefully logoff the session.(thelogs shows
clearly the pending sessions keeps on increasing and the value unbound
is never called for the particular user failing to forcefully logoff.


Well, we cannot look into your code, so there really is nothing that  
we can help you with. I would say that you should write a few unit  
tests with httpunit and use those to reproduce the situation you try  
to solve. Then test and debug from there.


Unless you think this is due to some kind of bug in Tomcat, in which  
case we need a test case that reproduces this problem.

--
Kees Jan

http://java-monitor.com/forum/
kjkos...@kjkoster.org
06-51838192

The secret of success lies in the stability of the goal. -- Benjamin  
Disraeli



-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Tomcat MySQL Server Configuration

2008-12-21 Thread Kees Jan Koster

Dear Carl,

I am trying to figure out  the best way to configure a multi-server  
setup

for Tomcat and MySQL.  Someone gave me the a list of configuration
suggestions (see link below).  My question is is configuration 3  
(see link

below) a good way to go when scaling up from our current configuration
(config. 0)?  If not, which one would be the best.  I know this is  
pretty
generalize but I a just looking for a standard 2-4 server  
configuration that

is used the most and that is well balance.

http://www.sieducation.com/images/Server Topologies
2.JPGftp://ftp-dom.earthlink.net:21//webdocs/images/Server



I cannot access that link. Dunno if it's the spaces or permissions.
--
Kees Jan

http://java-monitor.com/forum/
kjkos...@kjkoster.org
06-51838192

Rule 1 for being in a hole: stop digging.


-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: How do you determine the amount of Tomcat threads in use?

2008-12-17 Thread Kees Jan Koster

Dear Mark,

Just a quick question on how to see threads in use, I have been  
using prstat
-L -p tomcat java process, however I suspect this is not the  
correct way

to do it.


You can also attach jconsole of vsiualvm to check. That has the added  
benefit of being able to see not only the actual number of threads in  
use, but also the fill levels of your Tomcat thread pools.

--
Kees Jan

http://java-monitor.com/forum/
kjkos...@kjkoster.org
06-51838192

Rule 1 for being in a hole: stop digging.


-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: No printer found error on Tomcat restart

2008-12-17 Thread Kees Jan Koster

Dear Tony,

We have a Tomcat 5.5.20 installation running as a service on Windows  
2003
Server standard x64 operating system using version 1.6.0_07 (x86)   
jre.


The Tomcat service is running as a user which has all administrator  
rrights

and is started automatically on server startup.


Are you absolutely sure that the user rights are identical for a  
console start and a reboot-start?

--
Kees Jan

http://java-monitor.com/forum/
kjkos...@kjkoster.org
06-51838192

Human beings make life so interesting. Do you know that in a universe  
so full of wonders,
they have managed to invent boredom. Quite astonishing... -- Terry  
Pratchett



-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: How to serve JSPs (and other resources) from within a jarfile?

2008-12-16 Thread Kees Jan Koster

Dear Simon,


I have embedded the jspwiki project within my own webapp, to provide a
help engine. The jspwiki project provides java classes (in a jarfile)
plus some .jsp files and assorted resource-files (images, scripts,  
etc).
Currently I put all the java classes as a jarfile in my classpath  
(ok),

and also unpack the jsp and resource files into my webapp's content
directory (ugly).


Could you elaborate on why using a separate webapp/war-file for the  
wiki is not working for you?


In your shoes I would probably do just that. Break out the help engine  
into its own webapp for people to install separately.

--
Kees Jan

http://java-monitor.com/forum/
kjkos...@kjkoster.org
06-51838192

The secret of success lies in the stability of the goal. -- Benjamin  
Disraeli



-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Question on JVM memory in tomcat

2008-12-13 Thread Kees Jan Koster

Dear user080701,

I am using the tomcat manager to monitor the health of the tomcat  
server. I found that the session of JVM, it shown the following  
information:


JVM
Free memory: 38.13 MB Total memory: 111.18 MB Max memory: 1365.37 MB


As David pointed out, this is probably measured against the committed  
memory, not the max memory.


I just wrote a small post about memory leaks http://java-monitor.com/forum/showthread.php?t=150 
 In that post I also talk about the difference between maximum memory  
and committed memory.



Is my tomcat in good condition or not?

It seems that the free memory is only 38.13MB?

I have added the following lines in my startup.sh
export JAVA_HOME=/opt/jdk
export JAVA_OPTS=-Xmx1536m
export CATALINA_HOME=/opt/tomcat

How to know whether my tomcat can use the memory or not?



You need some form of monitoring that plots max, committed and used  
memory over time, rather than give you samples in numeric format.


You could hook your Tomcat up to Java-monitor. Java-monitor tracks you  
memory usage over two days, so you can see how the memory usage  
develops over time. The graphs in the post are made with Java-monitor.


To use Java-monitor just register on the Java-monitor forum and  
download the probe once you are logged in.

--
Kees Jan

http://java-monitor.com/forum/
kjkos...@kjkoster.org
06-51838192

The secret of success lies in the stability of the goal. -- Benjamin  
Disraeli



-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: configure JNDI to avoid error Last packet sent to the server was xxxxx ms ago

2008-12-09 Thread Kees Jan Koster

Dear removeps-groups,


Thanks for the links.  But in answer to the issues below:

chmod 600 is not sufficient because the admin of my website should  
not be able to see the passwords either.  And if you're using a web  
hosting service, all the more reason.


The decryption algorithm may need a license key which is installed  
only on that machine, so copying the contents of the lib folder may  
not be sufficient.  Though I have to admit, mines is not that complex!


Euh. You admin probably has root. Even chmod 000 won't stop him. If  
your implementation does not work with a license server, you've wasted  
your time. Sorry. :-)


Have you managed to fix your connection pool issues?

Kees Jan


--- On Sun, 12/7/08, Kees Jan Koster [EMAIL PROTECTED] wrote:


From: Kees Jan Koster [EMAIL PROTECTED]
Subject: Re: configure JNDI to avoid error Last packet sent to the  
server was x ms ago

To: Tomcat Users List users@tomcat.apache.org
Date: Sunday, December 7, 2008, 12:39 AM



Hmm. Lots of trouble for a file that you can just chmod 600
to avoid
this whole issue. But that's just how I do this.

You realize of course that this precisely as safe as
storing a plain-
text password. I mean, if I can read this file with the
encrypted
password, I can see that you use a non-standard MySQL
driver. So I
would just download the contents of your Tomcat's lib
directories. I
presume they have the same directory and file permissions
as the data
source config file.

I don't care what the password is. I just copy your
config, plop the
contents of your Tomcat's lib dir into mine and I can
connect to your
database just fine.




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




--
Kees Jan

http://java-monitor.com/forum/
[EMAIL PROTECTED]
06-51838192

The secret of success lies in the stability of the goal. -- Benjamin  
Disraeli



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: configure JNDI to avoid error Last packet sent to the server was xxxxx ms ago

2008-12-09 Thread Kees Jan Koster

Dear removeps-groups,


Thanks for the links.  But in answer to the issues below:

chmod 600 is not sufficient because the admin of my website should  
not be able to see the passwords either.  And if you're using a web  
hosting service, all the more reason.


The decryption algorithm may need a license key which is installed  
only on that machine, so copying the contents of the lib folder may  
not be sufficient.  Though I have to admit, mines is not that complex!


Euh. You admin probably has root. Even chmod 000 won't stop him. If  
your implementation does not work with a license server, you've wasted  
your time. Sorry. :-)


Have you managed to fix your connection pool issues?

Kees Jan


--- On Sun, 12/7/08, Kees Jan Koster [EMAIL PROTECTED] wrote:


From: Kees Jan Koster [EMAIL PROTECTED]
Subject: Re: configure JNDI to avoid error Last packet sent to the  
server was x ms ago

To: Tomcat Users List users@tomcat.apache.org
Date: Sunday, December 7, 2008, 12:39 AM



Hmm. Lots of trouble for a file that you can just chmod 600
to avoid
this whole issue. But that's just how I do this.

You realize of course that this precisely as safe as
storing a plain-
text password. I mean, if I can read this file with the
encrypted
password, I can see that you use a non-standard MySQL
driver. So I
would just download the contents of your Tomcat's lib
directories. I
presume they have the same directory and file permissions
as the data
source config file.

I don't care what the password is. I just copy your
config, plop the
contents of your Tomcat's lib dir into mine and I can
connect to your
database just fine.




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




--
Kees Jan

http://java-monitor.com/forum/
[EMAIL PROTECTED]
06-51838192

The secret of success lies in the stability of the goal. -- Benjamin  
Disraeli



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: configure JNDI to avoid error Last packet sent to the server was xxxxx ms ago

2008-12-07 Thread Kees Jan Koster

Dear removeps-groups,

How to configure JNDI in order to avoid the error Last packet sent  
to the server was x ms ago.?  I've seen two other errors which  
seem to be from the same cause: Communications link failure and  
Connection.close90 has already been called.


This is what I've come up with, but wonder if it is is good and  
efficient:


 Resource name=jdbc/myname
   auth=Container
   type=javax.sql.DataSource
   driverClassName=my.custom.mysql.Driver
   url=[EMAIL PROTECTED]:mysql://localhost:3306
   username=user
   password=encode:abcdefg
   initialSize=1 maxActive=15 maxIdle=15  
minEvictableIdleTimeMillis=4320
   maxWait=5000 removeAbandoned=true  
removeAbandonedTimeout=30 logAbandoned=true
   testOnBorrow=true testWhileIdle=true  
validationQuery=select 1/



The my.custom.mysql.Driver class decodes and decrypts the password,  
and passes these to the base class, which is  
com.mysql.jdbc.NonRegisteringDriver.


Hmm. Lots of trouble for a file that you can just chmod 600 to avoid  
this whole issue. But that's just how I do this.


You realize of course that this precisely as safe as storing a plain- 
text password. I mean, if I can read this file with the encrypted  
password, I can see that you use a non-standard MySQL driver. So I  
would just download the contents of your Tomcat's lib directories. I  
presume they have the same directory and file permissions as the data  
source config file.


I don't care what the password is. I just copy your config, plop the  
contents of your Tomcat's lib dir into mine and I can connect to your  
database just fine.


I read that the validationQuery=select 1 validates the connection  
before returning it to the user.  If the select statement fails,  
then the connection is removed from the pool and a new one is created.


What I'm not sure is if I need the testOnBorrow=true and  
testWhileIdle=true.


Here is how I dealt with that issue: http://java-monitor.com/forum/showthread.php?t=70 
 You can see my config file in the last post of the thread.


I found you need only testWhenIdle. I set it to once a minute, so that  
I never have stale connections in the pool, thus the issue of dealing  
with them never comes up. I have been running like this for months and  
seen no issues since.


No overhead that I notice, but I'd love to see some scientific  
measurements from you to prove me wrong. From anyone, for that  
matter. ;-)

--
Kees Jan

http://java-monitor.com/forum/
[EMAIL PROTECTED]
06-51838192

Human beings make life so interesting. Do you know that in a universe  
so full of wonders,
they have managed to invent boredom. Quite astonishing... -- Terry  
Partchett



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: When does Tomcat throw an OutOfMemory exception?

2008-11-30 Thread Kees Jan Koster

Dear Chuck,


To add to Leon's list: running out of file descriptors.


Actually, in such situations you get 'java.io.IOException: Too many  
open files' or 'java.net.SocketException: Too many open files'. Not an  
OutOfMemory error.


/nitpick
--
Kees Jan

http://java-monitor.com/forum/
[EMAIL PROTECTED]
06-51838192

Rule 1 for being in a hole: stop digging.


-
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: When does Tomcat throw an OutOfMemory exception?

2008-11-30 Thread Kees Jan Koster

Dear Chuck,


Actually, in such situations you get 'java.io.IOException: Too many
open files' or 'java.net.SocketException: Too many open files'. Not  
an

OutOfMemory error.


Only if it's related to an application-initiated action, such as  
opening a stream.  If FD exhaustion is detected during an internal  
JVM operation, that will often result in an OOME.


Oh, that is interesting. Thank you for correcting me. I guess they  
needed a RuntimeException and picked OOME. Grepping through the  
sources reveals that there are some other sources of OOME's too. I'd  
have to look at them to see which resource is actually being depleted,  
but it's a reminder to read the exception message with some attention.

--
Kees Jan

http://java-monitor.com/forum/
[EMAIL PROTECTED]
06-51838192

Human beings make life so interesting. Do you know that in a universe  
so full of wonders,
they have managed to invent boredom. Quite astonishing... -- Terry  
Partchett



-
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: Configuration Quandary - Servicing static page from app root

2008-11-29 Thread Kees Jan Koster

Dear John,


Sure would appreciate some feedback or ideas on this...



Have you looked at Apache's mod_rewrite at all? I sounds like that  
module might help.

--
Kees Jan

http://java-monitor.com/forum/
[EMAIL PROTECTED]
06-51838192

The secret of success lies in the stability of the goal. -- Benjamin  
Disraeli



-
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: Threadpool doesn't contain any threads

2008-11-26 Thread Kees Jan Koster

Dear Praveen,

Everyday we are noticing the tomcat not responding on a port. On  
further inspection we noticed that the thread pool that is serving  
this port has no threads. Right around the time tomcat goes into  
this state, we noticed that there is a thread death, and get the  
following stack trace


Does this happen randomly on the day, or at a specific time of day? Is  
it reproducible on a test machine?


What other activity is going on around the time that Tomcat dies? Cron  
jobs? Backups? Network changes?


Did anyone else notice this issue. Another minor caveat is, we built  
Tomcat using JDK 1.5 but are running it on JDK 1.6. Could this be  
causing any issue?


Hum. You built your own Tomcat? Is there a test environment that you  
can test this application with a pre-built one from Apache.org? Just  
to make sure.


Also I used Jconsole and noticed that currentThreadBusy and  
currentThreadCount are both -1.


I'm not sure that these figures can be trusted once the thread pool  
has died.

--
Kees Jan

http://java-monitor.com/forum/
[EMAIL PROTECTED]
06-51838192

Human beings make life so interesting. Do you know that in a universe  
so full of wonders,
they have managed to invent boredom. Quite astonishing... -- Terry  
Partchett



-
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: What does tomcat look like?

2008-11-26 Thread Kees Jan Koster

Dear Leon,


http://images.google.de/images?q=tomcat%20architectureie=utf-8oe=utf-8rls=org.mozilla:en-US:officialclient=firefox-aum=1sa=Ntab=wi


Thanks for the help. I had already entered the exact same query  
earlier today.



depends on your desired detail grade.


Well, more than what these images give me. I'm looking for a drawing  
that shows me how connectors, thread pools and executors are wired  
together.


This one comes close, but does not show where Tomcat's subsystems  
live. http://www.vsj.co.uk/pix/articleimages/apr04/tomcat3.jpg


So, that image, with yet more detail.

--
Kees Jan

http://java-monitor.com/forum/
[EMAIL PROTECTED]
06-51838192

The secret of success lies in the stability of the goal. -- Benjamin  
Disraeli



-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



What does tomcat look like?

2008-11-26 Thread Kees Jan Koster

Dear All,

I am looking for a good architecture drawing of Tomcat. I found lots  
of text descriptions of what Tomcat looks like internally, but I am  
looking for a graphical representation. Preferably one that shows  
internal components such as thread pools and connectors.


I found many generic JEE pictures, but they are too abstract.

--
Kees Jan

http://java-monitor.com/forum/
[EMAIL PROTECTED]
06-51838192

The secret of success lies in the stability of the goal. -- Benjamin  
Disraeli



-
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: Threadpool doesn't contain any threads

2008-11-26 Thread Kees Jan Koster

Dear Praveen,

And what about my question below?


Did anyone else notice this issue. Another minor caveat is, we built
Tomcat using JDK 1.5 but are running it on JDK 1.6. Could this be
causing any issue?


Hum. You built your own Tomcat? Is there a test environment that you
can test this application with a pre-built one from Apache.org? Just
to make sure.


--
Kees Jan

http://java-monitor.com/forum/
[EMAIL PROTECTED]
06-51838192

The secret of success lies in the stability of the goal. -- Benjamin
Disraeli

-
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: mysql timeout

2008-11-22 Thread Kees Jan Koster

Dear Adam,

2 - use something like DBCP to enforce a validation query for the  
connection

from the pool.

Does anyone have any feedback/advise on this issue?  It appears to  
be quite

common.  I am running on Redhat Linux, Tomcat 5.5.26


Perhaps this discussion is useful to you?

http://java-monitor.com/forum/showthread.php?t=70

--
Kees Jan

http://java-monitor.com/forum/
[EMAIL PROTECTED]
06-51838192

The secret of success lies in the stability of the goal. -- Benjamin  
Disraeli



-
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: java.lang.Exception: Socket bind failed: [730048]

2008-11-21 Thread Kees Jan Koster

Dear Toby,


Another thing I have found is that Tomcat slows down when a lot of
people are connected and requesting to the DB. My maxActive = '150'
for the database and maxThreads = '300'. The task manager doesn't show
high CPU usage and there is always atleast 2GB RAM free. Any ideas on
why this is happening? DB server is running fine too. In the past, the
DB server CPU would be high when this happened, but now that's Not the
case.


How does the I/O on the box behave?
--
Kees Jan

http://java-monitor.com/forum/
[EMAIL PROTECTED]
06-51838192

The secret of success lies in the stability of the goal. -- Benjamin  
Disraeli



-
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: Hard limits in Tomcat?

2008-11-20 Thread Kees Jan Koster

Dear Leon,


Oh, don't be so dramatic. There is a whole world out there of smaller
companies that have one or two Tomcat servers in production,  
running on the
cheapest shared server environment they could find. This product  
targets
companies that have two or three developers, one of whom has been  
pressed

into doing the admin role on the side.


yes, but why should they give their very sensitive data into the hand
of someone? You understand that tomcat operation profile provides
perfect opportunity for a potential attacker or competitor? Especially
when there are tools which does the same without giving the data away.


I see, so you are saying that Tomcat's JMX stats are very sensitive.  
Is that true in all cases? For each and every running instance of  
Tomcat?


This is basically the same discussion as is currently raging between  
using internal mail servers and using Google's. I note that both you  
and I are using Google mail. Some company policies forbid the use of  
external mail systems precisely for the reasons you suggest. I've even  
worked at companies that firewalled hotmail.com to keep their  
employees off of it. Other companies decide to outsource all of their  
mail services to Google for the convenience and savings it offers.


I apologize if the operational model of Java-monitor startled you.  
That was
not my intention. It works this way because that takes the care and  
feeding
of the monitoring platform away from the user. Some people like  
that while

others, such as yourself, prefer not to work like this.


Why dont you just supply another web/app which collects the data
locally in the customers environment?


Well, it's kind'a hard to send out an e-mail message that your app  
server has died, when the monitor is running inside that very same  
server. Also, I have plans for rules processing that should help  
predict server death. I'm not sure everyone will want to have the  
overhead of such processing in their operational environment.


I'm not asking anyone to switch away from their existing tools. I'm  
certainly not suggesting that you use it, as Java-monitor is clearly  
not suited for your environment.


--
Kees Jan

http://java-monitor.com/forum/
[EMAIL PROTECTED]
06-51838192

Human beings make life so interesting. Do you know that in a universe  
so full of wonders,
they have managed to invent boredom. Quite astonishing... -- Terry  
Partchett



-
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 to prevent Tomcat redirect my request

2008-11-20 Thread Kees Jan Koster

Dear Jim,


I deployed a web application foo.war into tomcat 5.x .  When I used
httpclient to send post request to http://localhost:8080/foo;, I  
always
get the http 302 redirect response .  How can I prevent Tomcat to  
reply

redirect response and directly adding the slash  to my request
url http://localhost:8080/foo/; to get what I want . I see web  
browser can
automcatically resend the request to redirected location but  
httpclient
can not.  Is there  configurations for that ?   Could anyone shed   
some

lights ?


I usually use httpunit, not httpclient. The advantage is that it does  
all the cookies, 302 responses and lord knows what else in the HTTP  
protocol, allowing me to focus on the logic instead of the protocol.


Maybe that's an alternative route for you, if Tomcat cannot be stopped  
from redirecting your app.

--
Kees Jan

http://java-monitor.com/forum/
[EMAIL PROTECTED]
06-51838192

Rule 1 for being in a hole: stop digging.


-
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: Hard limits in Tomcat?

2008-11-19 Thread Kees Jan Koster

Dear Chris,

I am setting up a monitoring system for Tomcat servers and I am  
looking

for hard limits in Tomcat servers in general.

I found a few so far: file descriptors, memory pools (ok, these are  
jdk

limits) and thread pools.

Are there any other hard limits that I can run into?


I would call these soft limits, as they can be changed.


Ah, sorry for the confusion. I should have asked for limits that are  
hard at run-time. Thread pool sizes may be editable, but they are  
fixed once Tomcat runs.



What limits are relevant? For instance, Java doesn't allow you to have
any method with more than 64k of code. I suppose that's of little
consequence to a running JVM, since the code would never be loaded.


Yes, I ran into that limit for a generated servlet once. This is not  
the kind of limit that I am looking for, as it is caught compile-time,  
not run-time.


If you are going to count memory (heap?) and file descriptors, I  
suppose

you could also count CPU time, since that is a limitable resource on
*NIX systems.


Hmm. It's really only useful if I can monitor both the maximum  
available time and the used time. I have no idea how I would measure  
that, even at unix level. It gets even more messy in virtual servers.


If you really are talking about soft limits, then you probably also  
want

to see the number of requests accepted but not yet being handled
(controlled by the Connector's acceptCount attribute), the  
number of

request processors (is this thread pools above?), the number of
connections total/available/used in JDBC connection pools.



Ah, that is interesting too: queue fill levels that should under  
normal circumstances be more or less empty. Much like the  
ObjectPendingFinalizationCount. Thanks for that.


How would I use it, though? In my Tomcat acceptCount has a value of  
100. That's probaly an upper limit. What is the 'un-use' property that  
goes with this upper limit?


What MBean can I talk to about JDBC connection pooling?

--
Kees Jan

http://java-monitor.com/forum/
[EMAIL PROTECTED]
06-51838192

Human beings make life so interesting. Do you know that in a universe  
so full of wonders,
they have managed to invent boredom. Quite astonishing... -- Terry  
Partchett



-
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: Hard limits in Tomcat?

2008-11-19 Thread Kees Jan Koster

Dear Leon,


I think the question you wanna ask yourself first is,
do you want to monitor tomcat or do you want to monitor your  
application?


I want to monitor Tomcat, not the application. I'm using the  
information to improve the Tomcat monitoring on Java-monitor.com.  
Currently you can see the memory pools/thread pools/file descriptors  
and their limits. I was just curious if there are any other pool-like  
structures inside Tomcat.


I'm sure that there are many applications out there that have pools  
and limits, but Java-monitor works for all Tomcats.

--
Kees Jan

http://java-monitor.com/forum/
[EMAIL PROTECTED]
06-51838192

The secret of success lies in the stability of the goal. -- Benjamin  
Disraeli



-
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: Hard limits in Tomcat?

2008-11-19 Thread Kees Jan Koster

Dear Leon,


is there a demo available on the java-monitor.com? sofar i only find a
php forum :-)


The forum has the monitoring tool built-in. A bit weird at forst, but  
it makes it really simple to post questions, as you can just post  
graphs from the tool right on the forum. No need to make screenshots.  
If you register and log in, the tool shows up.


I have not put any screenshots hi-res on-line yet. I have only two  
hands. :-( I should do that. Here are some low-res ones: http://java-monitor.com/forum/showthread.php?t=123


--
Kees Jan

http://java-monitor.com/forum/
[EMAIL PROTECTED]
06-51838192

The secret of success lies in the stability of the goal. -- Benjamin  
Disraeli





--
Kees Jan

http://java-monitor.com/forum/
[EMAIL PROTECTED]
06-51838192

Rule 1 for being in a hole: stop digging.


-
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: Hard limits in Tomcat?

2008-11-19 Thread Kees Jan Koster

Dear Chris,


Ah, sorry for the confusion. I should have asked for limits that are
hard at run-time. Thread pool sizes may be editable, but they are  
fixed

once Tomcat runs.


Gotcha. Hard runtime limits makes a whole lot more sense. Sorry for  
not

jumping to that obvious conclusion. I wasn't trying to be a jerk ;)


Don't worry. Better to ask for clarification than to assume. I wish  
more people would follow your example.


If you are going to count memory (heap?) and file descriptors, I  
suppose

you could also count CPU time, since that is a limitable resource on
*NIX systems.


Hmm. It's really only useful if I can monitor both the maximum  
available
time and the used time. I have no idea how I would measure that,  
even at

unix level. It gets even more messy in virtual servers.


I don't see why virtual servers would be trickier: the kernel should  
be
counting beans properly. In terms of getting that information, you  
need

to call getrlimit to see what the limit is. I'm not sure where to get
the current resource usage, though.


Hmmyeah. We're way off into OS-land here.

Virtual servers get esepcially tricky when a few are running on a host  
and you're in one of them. You may still be able to measure your own  
cpu usage, but you have no idea at all how much was available. So you  
can never tell if you're using what is available or not. I run Java- 
monitor's components on the bare iron for that very reason. So that I  
can see what uses the cpu and optimise the right places.


If you really are talking about soft limits, then you probably  
also want

to see the number of requests accepted but not yet being handled
(controlled by the Connector's acceptCount attribute), the  
number of

request processors (is this thread pools above?), the number of
connections total/available/used in JDBC connection pools.



Ah, that is interesting too: queue fill levels that should under  
normal

circumstances be more or less empty. Much like the
ObjectPendingFinalizationCount. Thanks for that.

How would I use it, though? In my Tomcat acceptCount has a value of  
100.
That's probaly an upper limit. What is the 'un-use' property that  
goes

with this upper limit?


Do you mean something like a minimum accept count? By definition, the
minimum accept count is 0, since you're talking about the number of
connections that the socket will accept. It can certainly always be
zero. But this is an OS thing, and is set when you bind to the  
socket. I

don't think there's a way to change this through Java after the socket
has been bound.


Grr. Off into OS-land again. Oh well. :-)


What MBean can I talk to about JDBC connection pooling?


You should get yourself a copy of LabmdaProbe and basically steal all
that code. Better yet, just use LambdaProbe and save yourself a lot of
headache. I'm sure they'd appreciate any code you'd like to donate to
the project to sniff other limits (like file descriptors).


Yes, LambdaProbe sure looks nice. My probe code is available from  
Google code (http://code.google.com/p/java-monitor-probes/) but really  
all I do so query JMX mbeans.


Hmm. Maybe I should talk to the devs of the new default connection  
pool to incorporate a pool MBean too. That's useful for all of us,  
regardless of monitoring tool in use.


For Java-monitor I have to keep in mind that I cannot do anything  
invasive. I want the probe to be so lightweigth that installation is a  
mere 5 minutes work and has no measurable impact on the JVM's run-time  
performance.

--
Kees Jan

http://java-monitor.com/forum/
[EMAIL PROTECTED]
06-51838192

Human beings make life so interesting. Do you know that in a universe  
so full of wonders,
they have managed to invent boredom. Quite astonishing... -- Terry  
Partchett





--
Kees Jan

http://java-monitor.com/forum/
[EMAIL PROTECTED]
06-51838192

The secret of success lies in the stability of the goal. -- Benjamin  
Disraeli



-
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: Hard limits in Tomcat?

2008-11-19 Thread Kees Jan Koster

Dear Leon,


well, downloaded, installed, started, klicked, ... deleted...

you should announce that your war is SENDING DATA to the central
server in LARGE letters :-)

which users are you targeting? No one i know (and i'm in the webapp
business for about 10 years) will ever going to use this stuff, since
its opposes all security guidelines which exists in the real
applications world, without considering if its useful or not. It may
sound a bit harsh, but any admin who installs java-monitor webapp on
companies server should be fired at once (and probably will be).


Oh, don't be so dramatic. There is a whole world out there of smaller  
companies that have one or two Tomcat servers in production, running  
on the cheapest shared server environment they could find. This  
product targets companies that have two or three developers, one of  
whom has been pressed into doing the admin role on the side.


I apologize if the operational model of Java-monitor startled you.  
That was not my intention. It works this way because that takes the  
care and feeding of the monitoring platform away from the user. Some  
people like that while others, such as yourself, prefer not to work  
like this.


Even in large companies, Java-monitor has its place. I spoke to one of  
my users this week and he tells me that he uses Java-monitor on the  
test machine because the process of getting JBoss performance  
statistics out of their hosting company takes days. I like it because  
I can check the status of my servers from my iPhone.

--
Kees Jan

http://java-monitor.com/forum/
[EMAIL PROTECTED]
06-51838192

Rule 1 for being in a hole: stop digging.


-
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: Request Logging in Tomcat 6

2008-11-18 Thread Kees Jan Koster

Dear Raphael,

I've been working with performance measurements of web services and  
I've
faced this problem. For each request to my system (running in a  
tomcat 6) I

need to log these information:


Received Bytes (request content length)
Served Bytes (response content length)
Response Time (the time taken by the server to process the request)


CPU Time (optional)

I/O Time (optional)

URI
Cookies(the value of some specific cookies)
Request Content Data



If you need this much detail, best write your own servlet filter and  
log it yourself.


http://www.onjava.com/pub/a/onjava/2001/05/10/servlet_filters.html

CPU and I/O times are tricky. If you get that to work, let me know. :-)

--
Kees Jan

http://java-monitor.com/forum/
[EMAIL PROTECTED]
06-51838192

Human beings make life so interesting. Do you know that in a universe  
so full of wonders,
they have managed to invent boredom. Quite astonishing... -- Terry  
Partchett



-
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: Request Logging in Tomcat 6

2008-11-18 Thread Kees Jan Koster

Dear Raphael,

I've been working with performance measurements of web services and  
I've
faced this problem. For each request to my system (running in a  
tomcat 6) I

need to log these information:


Received Bytes (request content length)
Served Bytes (response content length)
Response Time (the time taken by the server to process the request)


Actually, the latter two are simple:

http://java-monitor.com/forum/showthread.php?t=5
--
Kees Jan

http://java-monitor.com/forum/
[EMAIL PROTECTED]
06-51838192

The secret of success lies in the stability of the goal. -- Benjamin  
Disraeli



-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Hard limits in Tomcat?

2008-11-18 Thread Kees Jan Koster

Dear All,

I am setting up a monitoring system for Tomcat servers and I am  
looking for hard limits in Tomcat servers in general.


I found a few so far: file descriptors, memory pools (ok, these are  
jdk limits) and thread pools.


Are there any other hard limits that I can run into?

--
Kees Jan

http://java-monitor.com/forum/
[EMAIL PROTECTED]
06-51838192

The secret of success lies in the stability of the goal. -- Benjamin  
Disraeli



-
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: Tomcat vs Daemons

2008-11-18 Thread Kees Jan Koster

Dear Nate,

I am porting an application from Windows to Linux which makes heavy  
use of
servlets. I have a fairly intensive background process (currently a  
windows
service) that requires no user interaction. I plan to rewrite the  
code in

Java and I am wondering if there is any notable performance difference
between running the Java code under Tomcat as opposed to running the  
code

directly as a daemon.


No there is not. Tomcat just handles the HTTP serving part and the  
processing is done in Java, just as it would it it were a Tomcat-less  
JVM.



Since the application requires Tomcat, I know I can
code it up as a servlet and kick off the processing in the init()  
function
and not worry about executing the code directly as a daemon. Since  
this is a
performance sensitive process I want to make sure that I choose the  
optimal

route.


Performance is determined by many factors.


Does anybody know how java code running as a servlet compares
performance-wise to the same code running as a daemon? Is one way  
generally

better than the other?



No difference. You'd need something that handler HTTP access to your  
servlet, so you'd wind up with something like Tomcat anyway.


I think you have a strange idea of what a daemon is. After all, most  
of us run Tomcat as a daemon.


--
Kees Jan

http://java-monitor.com/forum/
[EMAIL PROTECTED]
06-51838192

The secret of success lies in the stability of the goal. -- Benjamin  
Disraeli



-
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: Tomcat request processing gets stuck

2008-11-18 Thread Kees Jan Koster

Deear Michal,


When i checked the tomcat using jconsole i see that the object
RequestProcessor
accumulates to many objects which i guess may show the cause of this
problem.


Uhm. Could you explain what you mean here? I don't understand what you  
are trying to say.


You see too many request processors? How many? What is the maximum and  
the expected number?

--
Kees Jan

http://java-monitor.com/forum/
[EMAIL PROTECTED]
06-51838192

The secret of success lies in the stability of the goal. -- Benjamin  
Disraeli



-
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: Tomcat Hanging Intermittently

2008-11-18 Thread Kees Jan Koster

Dear Gaurav,


I have tomcat server with apache (mod_jk) and mysql running on my box.
Initially there were no issues with the server. But from past one  
month, the
tomcat application hangs and websites also doesn't open. Though when  
i run

nmap localhost, it shows me 8080 and ajp13 services running.


You could try to make a thread dump to see what Tomcat is doing. Any  
errors in the logs that you did not expect?


I have notices that in last 1 month serveral websites have been  
hosted on
the box. Earlier around 6-10 websites were hosted but now it has  
increased

to 20. Is it putting load on the server.


Virtual server, or actual iron?


I am facing another issue.
Most of the websites have .war files deployed, so whenever i  
restarts the
tomcat, it takes 90 seconds to start the tomcat. Time duration has  
also

incereased as the  no. websites have increased.

Kindly provide me some solution so that i don't have to face any  
downtime in

future.


Well, you can start by installing multiple instances of Tomcat and  
placing a few sites in each. If you have the memory I would probably  
aim for having one Tomcat instance per handful of web application (as  
long as they are not inter-dependent). Then use Apache to route the  
traffic to the right application.


That way, if one appliction screws up you don't have to restart the  
whole Tomcat server, just the one instance.

--
Kees Jan

http://java-monitor.com/forum/
[EMAIL PROTECTED]
06-51838192

Rule 1 for being in a hole: stop digging.


-
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: Logging Tomcat errors

2008-11-14 Thread Kees Jan Koster

Dear Peter,

I guess it should be easy enough to distinguish between severe  
errors and ordinary errors, but how do you distinguish between 500  
errors application runtime errors? I specifically want to report  
errors that occur at the container level and not at the application  
level... I hope this makes sense.


Each logged line has an associated categry. You could configure your  
logging to only log the container level categories.


--
Kees Jan

http://java-monitor.com/forum/
[EMAIL PROTECTED]
06-51838192

Human beings make life so interesting. Do you know that in a universe  
so full of wonders,
they have managed to invent boredom. Quite astonishing... -- Terry  
Partchett



-
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: Debian + Apache 2.2 + Tomcat 5.5

2008-11-14 Thread Kees Jan Koster

Dear Alex,

The debian Tomcat package is notoriously hard to use. In your shoes I  
would switch to a normal Tomcat server from apache.org.


In /usr/share/tomcat5.5-webapps/ I move the folder ROOT to ROOT_BACK  
and move my App folder shop_v1 to ROOT
After that and a restart of Tomcat... nothing will be browseable..  
not index.jsp nor test.jsp within ROOT with simple hello...

The message HTTP 404
The requested resource (/) is not available.


Try /index.jsp and see if that works. If it does, check the welcome  
file list in your web.xml.


--
Kees Jan

http://java-monitor.com/forum/
[EMAIL PROTECTED]
06-51838192

Human beings make life so interesting. Do you know that in a universe  
so full of wonders,
they have managed to invent boredom. Quite astonishing... -- Terry  
Partchett



-
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: Change Tomcat's bind address?

2008-11-13 Thread Kees Jan Koster

Dear Søren,


How do i change Tomcat 6's bind address?



http://java-monitor.com/forum/showthread.php?t=32

--
Kees Jan

[EMAIL PROTECTED]
06-51838192

Rule 1 for being in a hole: stop digging.


-
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: Apache 6.0.16

2008-11-13 Thread Kees Jan Koster

Dear Dan,

Yes it works with apache-tomcat.5.5.25, the port comes up and  
listens on Port 8005.  I can stop and start at will, no problem.


The installation I have is 6.0.16, no mods to server.xml and this is  
one that throws the error.


Strange. When I try a stock 6.0.16, freshly downloaded from apache.org  
the error message is eerily similar if something is listening on port  
8005 already. Apart from the German message, of course.


Nov 13, 2008 9:21:13 PM org.apache.catalina.core.StandardServer await
SEVERE: StandardServer.await: create[8005]:
java.net.BindException: Address already in use
at java.net.PlainSocketImpl.socketBind(Native Method)
at java.net.PlainSocketImpl.bind(PlainSocketImpl.java:359)
at java.net.ServerSocket.bind(ServerSocket.java:319)
at java.net.ServerSocket.init(ServerSocket.java:185)
	at org.apache.catalina.core.StandardServer.await(StandardServer.java: 
373)

at org.apache.catalina.startup.Catalina.await(Catalina.java:642)
at org.apache.catalina.startup.Catalina.start(Catalina.java:602)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at  
sun 
.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java: 
39)
	at  
sun 
.reflect 
.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java: 
25)

at java.lang.reflect.Method.invoke(Method.java:585)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)

Are yu absolutely sure that nothing is listening on port 8005 when you  
started the 6.0.16 server? You can check using the advise in http://java-monitor.com/forum/showthread.php?t=22


Note that AIX is not in the list of sample commands. Could you let me  
know afterwards what commands you use on AIX to find out who is  
listening? It would be nice for future reference.

--
Kees Jan

http://java-monitor.com/forum/
[EMAIL PROTECTED]
06-51838192

The secret of success lies in the stability of the goal. -- Benjamin  
Disraeli



-
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: Problem to install APR Tomcat Native Library

2008-11-13 Thread Kees Jan Koster

Der Torsten,

I got it sorted out with ldd as suggested here on the list but it is  
certainly good to know about truss - thank you!


I am curious what performance gain APR has for your application  
server. Did you do any load tests? If so, could you please publisch  
the results?

--
Kees Jan

http://java-monitor.com/forum/
[EMAIL PROTECTED]
06-51838192

Human beings make life so interesting. Do you know that in a universe  
so full of wonders,
they have managed to invent boredom. Quite astonishing... -- Terry  
Partchett



-
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: Apache 6.0.16

2008-11-13 Thread Kees Jan Koster

Dear Dan,

Thanks for the info, I have verified that my existing Tomcat is  
offline.  My existing Apache Tcat 5.5.25 binds to the port without  
incident, only the out of the box 6.0.16 is causing the problem,  
with the identical message as yours.


I'm using netstat -an |grep 8005 on AIX, to only list if the port is  
in use/listening.   I've done a 'man netstat'  and cannot find the  
command to list the actual process, still checking AIX commands to  
see what available.


When I issue the ./shutdown.sh and execute the netstat command  
again, no rows are returned, which would normally indicate the port/ 
socket is released. Let me reiterate, my existing will come up and  
bind to the port.


Bizarre.

Before the server shutdown automatically, I can access the 8080 port  
and display the Apache splash page.


Any thing else to check?


No idea, really. Sorry.

--
Kees Jan

http://java-monitor.com/forum/
[EMAIL PROTECTED]
06-51838192

Human beings make life so interesting. Do you know that in a universe  
so full of wonders,
they have managed to invent boredom. Quite astonishing... -- Terry  
Partchett



-
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: Using tomcat to hold many open connections.

2008-10-06 Thread Kees Jan Koster

Dear Uprooter,

I'm looking for a server that has to hold many (web services) remote  
clients

for controlling them.
I want to do things like sending power off command to a bunch of  
machines

remotely.


Building a botnet? :-)


The clients are usually windows machines behind firewalls  NAT or web
proxies that only allow HTTP (this is why I thought of webservices)

The regular request-response fashion that servlet follows  is not  
suitable

here since the initiator of the operation is the server.
What can I do in order to solve this and still use web services?


If you have the resources, you can just block in the servlet on your  
server. It's pretty expensive since Tomcat uses a thread per request I  
believe. Java threads are expensive (256kB each?), so that adds up  
quickly. You could spend some time tuning your thread stacks, though.  
Depending on your actual number of clients, you should be able to get  
this to work with a few GB of RAM.


But then, 20K client polling once an hour might be cheaper. You may  
want to find a way to stagger the requests though.


--
Kees Jan

http://java-monitor.com/forum/
[EMAIL PROTECTED]
06-51838192

The secret of success lies in the stability of the goal. -- Benjamin  
Disraeli



-
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: Another confused person trying to get jconsole to monitor tomcat.

2008-10-03 Thread Kees Jan Koster

Dear Martin,


http://www.jdocs.com/tomcat/6.0.14/org/apache/catalina/ServerFactory.html
ServerFactory.getServer() will return
org.apache.catalina.ServerFactory



Thanks for the information. I changed the mbean server code to make  
use of all available mbean servers and now my code can always see  
Tomcat's mbeans as well as the platform ones. Excellent.

--
Kees Jan

http://java-monitor.com/forum/
[EMAIL PROTECTED]
06-51838192

Rule 1 for being in a hole: stop digging.


-
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: problem in running Jconsole remotely --Connection refused

2008-10-02 Thread Kees Jan Koster

Dear Subhrajyoti,


  I am facing problem in running Jconsole remotely . In my
machine from where I am running Jconsole I have jdk1.6...I am trying  
to
connect to TOmcat6.0.18 running on a windows 2003 server  
machine(with JDK
1,5) ...I have a batch file with the following contents : When I  
execute

the batch file Tomcat is starting okay. But when I am trying to run
Jconsole to connect to the Tomcat , I am always getting a connection
refused  error. I think I have set up the parameters correctly here ?
Apart from this all the .bat files that comses bundled with  
Tomcat6.0.18
are kept same.  I can ping the server from my machine without any  
problem

.


JConsole remotely is a problem. Recently I have started work on an on- 
line monitoring tool that allows you to monitor memory and threads  
without any firewall trickery.


If you register at http://java-monitor.com, you can download a small  
WAR file (~35kB) that will collect the memory stats. Read more on http://java-monitor.com/install.html


Oh, it also does thread deadlock detection, but that's just a  
freebie. ;-)

--
Kees Jan

http://java-monitor.com/forum/
[EMAIL PROTECTED]
06-51838192

The secret of success lies in the stability of the goal. -- Benjamin  
Disraeli



-
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: Another confused person trying to get jconsole to monitor tomcat.

2008-10-02 Thread Kees Jan Koster

Dear Mark,

I got bitten by this recently. I am working on a LifecycleListener  
(that
can be configured in server.xml) that fixes both ports that are used  
by
jconsole. This makes it much easier to configure firewalls, tunnel  
through

PuTTY etc.

If I get it finished in time, it will be in 6.0.19+. If not, a later
version. Keep an eye on the change log and/or the dev list.



Since you are knowledgeable in the sources for Tomcat, are you aware  
of any programmatic way to register the Catalina mbeans? I'd like to  
do so from code, without specifying any command line options.


For JBoss I found a special JMXserver class that I can load using  
reflection. Is there such a thing for Tomcat?

--
Kees Jan

http://java-monitor.com/forum/
[EMAIL PROTECTED]
06-51838192

The secret of success lies in the stability of the goal. -- Benjamin  
Disraeli



-
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 you have your dev environment setup?

2008-10-02 Thread Kees Jan Koster

Dear All,

I've been doing a lot of webapp development on tomcat, but currently  
my

process is all manual.  I write the code in Eclipse, and then copy the
appropriate files over to tomcat.  I'd like to automate and  
standardize my

process.

So would y'all mind explaining how your dev environment is  
configured?  I'd

appreciate the insight.  TIA.


I develop in Eclipse and rsync the files over to my test box.  
Passwordless ssh and a little script.

--
Kees Jan

http://java-monitor.com/forum/
[EMAIL PROTECTED]
06-51838192

Rule 1 for being in a hole: stop digging.


-
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: Tomcat 5.5.26 OutOfMemoryError -Xms -Xmx Set

2008-08-29 Thread Kees Jan Koster

Dear Tom,

I'd like to confirm that I am trying the right things in fixing a  
memory

error and discover what else I can do to resolve my problem. I realise
this is a common problem as I have Googled, read the Tomcat memory FAQ
and searched the mailing lists. I have tried looking at catalina.out
however I am not a java programmer.


Here is a quick-start memory tuning guide I wrote earlier.

http://java-monitor.com/forum/showthread.php?t=30

Basically, you have to find and tune the right memory pool. Use  
jconsole to see what memory pool fills up.


Hope this helps.
--
Kees Jan

http://java-monitor.com/forum/
[EMAIL PROTECTED]
06-51838192

Human beings make life so interesting. Do you know that in a universe  
so full of wonders,
they have managed to invent boredom. Quite astonishing... -- Terry  
Partchett



-
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: Custom error page with stacktrace

2008-08-24 Thread Kees Jan Koster

Dear All,


In your error page, the variable exception is set to the exception
(if any). You can get the error message and stack trace from the
exception like this:

pException message: %= (exception == null) ?  :
exception.getMessage() %/p
%
String stStack = ;
if (exception != null) {
java.io.StringWriter sw = new java.io.StringWriter();
exception.printStackTrace(new java.io.PrintWriter(sw));
stStack = sw.toString();
}
%
pStack trace:/p
pre
%= stStack %
/pre



You can make this even more readable by using the individual stack  
trace elements instead of the string writer. That way you can give  
those lines that have your own classes a different colour. What I do  
is show my own classes in bold red in the stack trace. That way I know  
what code to check faster.


Check out 
http://java.sun.com/javase/6/docs/api/java/lang/Throwable.html#getStackTrace()
--
Kees Jan

http://java-monitor.com/forum/
[EMAIL PROTECTED]
06-51838192

Rule 1 for being in a hole: stop digging.


-
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: Tomcat ignores the missing JDBC DataSource reference in web.xml

2008-08-24 Thread Kees Jan Koster

Dear Gennady,


My web.xml descriptor missing reference to JDBC data source defined in
context.xml (resource-ref section), but web application runs just  
fine

and pooled data source consumed by hibernate.



Same here. I read somewhere that the tutorials are wrong and the this  
is the way it's supposed to work. Sorry, no link.

--
Kees Jan

http://java-monitor.com/forum/
[EMAIL PROTECTED]
06-51838192

The secret of success lies in the stability of the goal. -- Benjamin  
Disraeli



-
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: override 100-continue response in servlet

2008-08-24 Thread Kees Jan Koster

Dear Craig,

I'm writing a servlet to allow large-file uploads (with ranges and  
resume). One issue I noticed was that if the range is invalid (I do  
the checks in doPut), and I return a 416, the client (curl in this  
case) continues to upload the body (possibly gigabytes of data that  
will be discarded) because tomcat already sent the 100-continue.


Ah. Rebuilding FTP? :-)

Maybe I could just force the connection to close somehow, but I'd  
like to respond with the 416 instead of tomcat's immediate 100- 
continue. Is there a way to override the 100-continue behaviour so I  
can perform the checks and return 100 or 416 myself?


You could use a servlet-filter to do the checks earlier? Other that  
that, you're looking at hacking Tomcat itself.



If not, how could I force the connection to close immediately?


response.getOutputStream().close() ?
--
Kees Jan

http://java-monitor.com/forum/
[EMAIL PROTECTED]
06-51838192

The secret of success lies in the stability of the goal. -- Benjamin  
Disraeli



-
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: Another confused person trying to get jconsole to monitor tomcat.

2008-08-21 Thread Kees Jan Koster

Dear Bill,


I've been through the docs.  I've been through Google.  I can't seem
to figure this out.

Server: Tomcat 6.0.18, JDK: 1.6.0_07, Redhat Server 5.2
Client: jconsole from JDK 1.6.0_07 on Windows XP

I've got all of these in $CATALINA_OPTS and they do show up in
the java command line when I run ps:

-Dcom.sun.management.jmxremote
-Dcom.sun.management.jmxremote.port=12345
-Dcom.sun.management.jmxremote.ssl=false
-Dcom.sun.management.jmxremote.authenticate=false

The Redhat server is running iptables and disallows most things that
aren't 80/443.  Any other ports that are needed are generally opened
up only to specific IP's.

I've opened up the JMX port specified above on the Linux firewall:

iptables -A INPUT -s myClientsIp -p tcp -m tcp --dport 12345 -j ACCEPT

I run jconsole:

C:\PathToJava\binjconsole myServer.myDomain.com:12345

It can't make the connection.  I've got a feeling it's something to  
do with

the firewall.  I've seen some stuff that suggests that there's another
unspecified port opened up but it didn't really make sense to me.

Note that the server and the client are at different facilities  
connected

over the internet which is why I eventually want to get it going with
authentication and SSL but I can't even get this simple insecure
version of the connection to work.



I just spent a few hours trying to figure this out myself. The problem  
you are facing is that RMI uses dynamic port allocation. The port you  
are specifying is that of the RMI registry, which only acts as a  
naming service.


The actual JMX port is dynamically chosen by the RMI registry, so  
opening a single port on the firewall does not actually help.


The simple case will never work for your environment. You have to go  
SSL for this to even work. Here is a blog post by Daniel Fuchs with a  
step-by-step for ssl and single port RMI http://blogs.sun.com/jmxetc/entry/jmx_connecting_through_firewalls_using


In the end I just gave up and I now open the firewall between my dev  
machine's IP and the test machine's IP when I need jconsole. I have  
better things to do with my time than fight RMI. :-/

--
Kees Jan

http://java-monitor.com/forum/
[EMAIL PROTECTED]
06-51838192

Human beings make life so interesting. Do you know that in a universe  
so full of wonders,
they have managed to invent boredom. Quite astonishing... -- Terry  
Partchett



-
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: Disabling catalina.out log

2008-08-20 Thread Kees Jan Koster

Dear Emerson,

Truncating? It should be a rolling file, rolling over daily. You  
can just
remove the old versions. Is this a stock tomcat, one from the  
ports, or

maybe a particularly old one?



catalina.out is set at the catalina.sh:


$CATALINA_BASE/logs/catalina.out 21 


This file is not rateable, as it is jsut a redirection.


You are right. Woops, I thought it was a rotatable file. Maybe I  
restart my Tomcats too often. :)



We are thinking in moving this redirection to  /dev/null or just
remove the redirection.
Is it a sense thing to do?


To get rid of an ever-growing file, yes. However, you have to make  
really sure that you still get all the stack traces and whatnot that  
is in that file, only get them into a rolling file.


A. Wait. Now I know why I never run into this. I run my Tomcats in  
screen using catalina.sh run, so catalina.out is written to the  
console instead of a file. I do get a nice daily log e.g. catalina. 
2008-08-20.log.


That would mean it is safe to redirect catalina.out to /dev/null, as  
long as you have the daily logs.


--
Kees Jan

http://java-monitor.com/forum/
[EMAIL PROTECTED]
06-51838192

Human beings make life so interesting. Do you know that in a universe  
so full of wonders,
they have managed to invent boredom. Quite astonishing... -- Terry  
Partchett



-
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: Disabling catalina.out log

2008-08-19 Thread Kees Jan Koster

Dear Irwan Hadi,


Just curious if anybody knows how to disable tomcat from logging to
catalina.out, possibly by editing the server.xml file?


check out ${tomcat}/conf/logging.conf

True that we can link catalina.out to /dev/null or truncate the file  
every

now and then, but we prefer to use a more sane approach, than just
truncating the file...


Truncating? It should be a rolling file, rolling over daily. You can  
just remove the old versions. Is this a stock tomcat, one from the  
ports, or maybe a particularly old one?


The most sane approach would be to work with your developers to have  
some logging policy that both you and the developers can work with.  
You'll need at least the exception traces when Tomcat dies, or you're  
blind.


But then, there is nothing like saving a few bucks in disk space at  
the expense of hours of blind debugging. :-)

--
Kees Jan

http://java-monitor.com/forum/
[EMAIL PROTECTED]
06-51838192

Human beings make life so interesting. Do you know that in a universe  
so full of wonders,
they have managed to invent boredom. Quite astonishing... -- Terry  
Partchett



-
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: Tomcat monitoring

2008-08-15 Thread Kees Jan Koster

Dear Tokajac,


As far as I see  http://www.zabbix.com http://www.zabbix.com  is not
available for WinXP (that's my platform).


*shrug* You could always run it on FreeBSD or Linux in VMWare.


I downloaded Zapcat. Can Zapcat be useful without zabbix?


No, it only works as a bridge to Zabbix. That's what it was designed  
to do.


Here is a discussion about some other tools that you can use to  
monitor your VM. http://java-monitor.com/forum/showthread.php?t=1  
There is also Zenoss and MC4J.


Hope this helps.
--
Kees Jan

http://java-monitor.com/forum/
[EMAIL PROTECTED]
06-51838192

Human beings make life so interesting. Do you know that in a universe  
so full of wonders,
they have managed to invent boredom. Quite astonishing... -- Terry  
Partchett



-
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: Tomcat monitoring

2008-08-14 Thread Kees Jan Koster

Dear Tokajac,


I want to monitor performance of Tomcat server when I'm running an
application.

Memory usage, threads, objects, user sessions, sql queries and as
much as
possible of other information on server.


JMX is the way to go. JConsole was already suggested. If you want to
really monitor the performance of an application you also need
information from the actual host (disk I/O load, network load,
processor load, RAM fill level.

You should consider that tools such as JConsole only show data that is
gathered as long as JConsole is running. External monitoring tools
also allow you to gather information continuously, across reboots and
new software versions. That gives you the ability to 1) do long term
resource requirements prediction and 2) see what version of your
application introduced or solved the memory leak. :)

There are loads of tools out there that can do this. Personally, I use 
http://www.zabbix.com
, combined with the Zapcat JMX to Zabbix bridge 
(http://www.kjkoster.org/zapcat/Tomcat_How_To.html
).
--
Kees Jan

http://java-monitor.com/forum/
[EMAIL PROTECTED]
06-51838192

Human beings make life so interesting. Do you know that in a universe
so full of wonders,
they have managed to invent boredom. Quite astonishing... -- Terry
Partchett


  1   2   >