Re: TomCat 6 performance issues

2009-12-24 Thread Elli Albek
Can you run a load test from another computer on the local network? Something like apache AB gives a histogram and you should be able to tell what percentage of your requests is the 5 seconds range. It is best to run it directly to the tomcat private IP that is used inside the local network, to mak

Re: 2 Apache 1 Tomcat

2009-12-17 Thread Elli Albek
A note on reverse proxy: request.getRemoteIP() will normally return the IP of the proxy and not the IP of the client. In Tomcat you will probably need to add a valve such as RemoteIPValve (search this list) to fix the IP of the incoming request. Otherwise your log files will show the IP of the prox

Re: 2 Apache 1 Tomcat

2009-12-16 Thread Elli Albek
Or use apache as reverse HTTP proxy in front of Tomcat. In that case tomcat is an HTTP server and there is nothing special to do (just configure HTTP connector). You can put as many apache reverse proxies as you need, tomcat configuration is agnostic to the proxies for the most part. This will also

Re: [OT] Context Chicken & Egg Problem

2009-12-16 Thread Elli Albek
Another simple way to use tomcat with eclipse is to start tomcat with remote debugging, and attach to it from eclipse. A couple of switches in the tomcat startup script should do it. - To unsubscribe, e-mail: users-unsubscr...@tom

Re: Very slow shutdown - 3 mins

2009-12-15 Thread Elli Albek
You have many threads that are not part of Tomcat, as Chuck mentions. Whatever you start in the webapp you have to close as well. You can close via a shutdown listener (Context listener), or if you use something like Spring which already has built in shutdown hook, implement their shutdown interfac

Re: Char Encoding text streams on Tomcat 5.5 and Linux

2009-12-02 Thread Elli Albek
y vent? E On Wed, Dec 2, 2009 at 8:17 AM, Christopher Schultz < ch...@christopherschultz.net> wrote: > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > Elli, > > On 12/2/2009 2:40 AM, Elli Albek wrote: > > On your Linux box type “locale” + enter. The results

Re: Char Encoding text streams on Tomcat 5.5 and Linux

2009-12-01 Thread Elli Albek
Hi, On your Linux box type “locale” + enter. The results should be UTF 8. If not change it. You can also set it in the file encoding java environment variable as suggested above as extra safety measure. Tomcat’s logic of determining the encoding from the request only applies when Tomcat is parsin

Re: Java Out of Heap Issue

2009-11-18 Thread Elli Albek
I consider old code part of application code :) no age discrimination when it comes to memory leaks. >> What you describe in your memory graph is a simple memory leak. >> Generally, I would look in that order: > >  1a. Old code? Look for improperly closed DB connections. > >> 1.      Sessions >> 2

Re: Java Out of Heap Issue

2009-11-16 Thread Elli Albek
You can try getting an object dump from a profiler and see which objects are the source of memory starvation. Simple JSPs are very unlikely to cause memory starvation, but you mentioned “application code”, which implies that you have more than simple JSPs. A few things you want to cross off your p

Re: Some advice on apache tomcat

2009-11-16 Thread Elli Albek
You can also look at squid to serve static files and load balance. So squid fronts tomcat and your other apps. Squid can serve your static files as well. All you have to do it make sure your static files return a cache header like max-age, and squid will serve them without going to the origin (tomc

Re: Possible to do async processing?

2009-11-16 Thread Elli Albek
Hi, The advices given above are good. If you make this job triggered by a servlet, then an attacker can use it to easily bring down your system with excessive load. You also have problems of clean shutdown. The thread pool that you start needs to have blocking shutdown with some context listener,

Re: Regarding 1 Webserver Multiple Web App project

2009-11-14 Thread Elli Albek
Tomcat by itself as a web server can do that without too much complexity. If you use something in front of it, then that something need to know which domains go to tomcat as well. You don't necessarily need to front tomcat with apache/AJP. You can have tomcat be the web server as well, or front it

Re: Memory, handles and threads increasing in Tomcat 5.5

2009-11-13 Thread Elli Albek
Hi, Without knowing what your application is doing, here is something you should look at: External dependencies. If your application is stable performance wise at steady state for a few thousands of GC cycles, and then jumps in resources out of nowhere, it is very possible that this is due to an

Re: Tomcat 6 encoding issue

2009-11-12 Thread Elli Albek
You can try forcing the JVM to start with UTF 8 using a JVM parameter. -Dfile.encoding=UTF-8 Where you put it depends on how you start tomcat, I think JAVA_OPTS will do it. This is quick and may work. You can also try to force the servlet output stream to be in the encoding that you want from your

Re: Tomcat 6 encoding issue

2009-11-11 Thread Elli Albek
Which library are you using to get the external page? java.net? HttpClient? What do you do with the page that you download? It looks from the exception that you are writing it to the servlet IO, is that the case? Are both of your tomcats running on the same JVM version? E On Wed, Nov 11, 2009 a

Re: [OT] WebappClassLoader and undeploy

2009-11-11 Thread Elli Albek
Actually Mark can you take a quick look at the class I sent and see if it makes sense. I swapped juli with commons logging (which is in bin) but now I am not sure this is necessary, this library may already be loaded regardless of this filter. E ---

Re: [OT] WebappClassLoader and undeploy

2009-11-11 Thread Elli Albek
Tomcat 5.5 version + log message when executed: /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to

Re: [OT] WebappClassLoader and undeploy

2009-11-10 Thread Elli Albek
Sorry Mark. Well this class loading scheme (context class loader -> static variable) sounds little like a bug. Thanks for that startup class. I think it will solve a problem that we have (using imageio). So you just add it as high up as possible in the server.xml hierarchy? E --

Re: WebappClassLoader and undeploy

2009-11-09 Thread Elli Albek
Thomas, what is the issue with javax.imageio? Do they really use context class loader for loading static variables? - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.a

Re: WebappClassLoader and undeploy

2009-11-09 Thread Elli Albek
Managing class loaders is done in the JVM. Tomcat cannot force the JVM to garbage collect class loaders, in the same way that it cannot force the JVM to garbage collect any object. If the class loader is unreachable, and all other objects that this class loader provided are also unreachable, then t

Re: [OT] ConnectionPool question

2009-11-07 Thread Elli Albek
parent child relationships. E On Fri, Nov 6, 2009 at 5:54 PM, Christopher Schultz wrote: > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > Elli, > > Okay, I think we've hijacked Josh's thread enough to at least mark it as > off topic. :) > > On

Re: SEVERE: All threads (700) are currently busy, waiting. Increase maxThreads (700) or check the servlet status

2009-11-06 Thread Elli Albek
As Charles suggested, you need a thread dump. There is too much complexity in your setup to be able to find your problem without actually inspecting the machine, but a thread dump can take you right to the source of the problem in a matter of minutes. --

Re: ConnectionPool question

2009-11-05 Thread Elli Albek
Hi, > Elli, > > On 11/4/2009 7:01 PM, Elli Albek wrote: >> I also >> remember that closing a connection closes statements and result sets, but it >> has been a while since I read the source. > > Pooled connections are almost certainly not behaving this way. T

Re: ConnectionPool question

2009-11-04 Thread Elli Albek
As far as I remember, "abandoned" is a connection that was not closed. So if you call recycle on a connection it will not generate abandoned message. The messages that you see are from connections that you do not close. I also remember that closing a connection closes statements and result sets, bu

Re: ConnectionPool question

2009-11-03 Thread Elli Albek
2 years at my current > > employer. Thank you all again. > > > > - Josh > > > > > > On Mon, Nov 2, 2009 at 3:40 PM, Christopher Schultz < > > ch...@christopherschultz.net> wrote: > > > >> -BEGIN PGP SIGNED MESSAGE- > >> Hash: SHA1 >

Re: Tomcat and PermGen

2009-11-03 Thread Elli Albek
Thanks for this link. Reading that page made me a little pessimistic. E On Mon, Nov 2, 2009 at 9:38 PM, Caldarale, Charles R < chuck.caldar...@unisys.com> wrote: > > From: Gerwood Stewart [mailto:gstew...@une.edu.au] > > Subject: RE: Tomcat and PermGen > > > > Do you know of any ways to track do

Re: Tomcat Memory and Garbage Collection questions...

2009-11-02 Thread Elli Albek
A question: Do you guys use hot deployment of applications? If you do *not*, then Joseph’s tips are the first things to look at, in short it is the application code keeping too many references. If you do hot deployment, then the number of possibilities goes up significantly. Now you are also talk

Re: [OT] Hammers and nails (was Re: A question about log-rotation on "catalina.out")

2009-11-02 Thread Elli Albek
How did this make it into the tomcat users list? :) CPAN: Driven by users. Java (JCP) Driven by vendors.

Re: starting tomcat from ant not working

2009-11-02 Thread Elli Albek
Hi, This is how we start tomcat from ant. ${server} is your tomcat installation directory. Then we have a condition on a URL, so we know tomcat actually starts and handling HTTP requests. Notice the startup folder and catalina home argument. This is to avoid conflicts with other tomc

Re: ConnectionPool question

2009-11-02 Thread Elli Albek
Oops, I had a copy paste error. Version 2 has the filter method twice. Ignore the first, use the second. Notice this code was written in an email client, not an IDE :) E

Re: ConnectionPool question

2009-11-02 Thread Elli Albek
Here is some idea for you: First, you have two static methods to get and return the connection inside a listener class. Those methods do not have anything to do with the listener (which is an instance), and also and also do not need synchronization. Synchronizing on getConnection can be a big bott

Re: DBCP woes (running out of cursors).

2009-10-28 Thread Elli Albek
nly stop what it starts by itself. E On 10/28/09, Christopher Schultz wrote: > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > Elli, > > On 10/28/2009 12:21 AM, Elli Albek wrote: >> In terms of listeners, I saw that Tomcat executes requests while in >> the closi

Re: DBCP woes (running out of cursors).

2009-10-27 Thread Elli Albek
Thanks for your replies. I agree that Tomcat should be responsible for all objects that are configured in Tomcat, and the web app should be responsible for objects that are created by the webapp. Currently it does not happen properly in tomcat. This is not related to DBCP code, it is all Tomcat cod

Re: DBCP woes (running out of cursors).

2009-10-26 Thread Elli Albek
Hi, More information about tomcat shutdown and object swapping probably belongs in the development list. It is quite a bit of work to extend DBCP and write extensions to tomcat, and at the end of the day most of those problems I would consider as bugs. DBCP specifically cannot be easily extended, w

Re: DBCP woes (running out of cursors).

2009-10-26 Thread Elli Albek
Hi, I did not follow this thread form the beginning, but I can provide a few tips about using connection pools in tomcat. 1. DBCP has quite a few problems in the area of scalability. We have our own modified version of the source that makes it more concurrent, and I believe some of those changes we

Re: How can I prevent Quartz multiple execution after tomcat restart

2009-10-23 Thread Elli Albek
Where is your spring configuration file? Is it inside the war file? When you have two hosts, do you have the war file in both? If this is he case you may deploy the entire war file twice. Generally a deployed war file can run only in one host. If you run it in two hosts, you are deploying the en

Re: How to know when tomcat is ready to serve request

2009-10-23 Thread Elli Albek
hread after the server is completely started. I have not used Server LifeCycleListener before. I will give it a try. Appreciate any help. Thanks. On Thu, Oct 22, 2009 at 7:48 PM, Elli Albek wrote: > If this is the case you can assume that the war file is deployed. > > I don't trust the

Re: Starting web app with properties set

2009-10-22 Thread Elli Albek
Load the properties using java.util.Properties, and store them in a place that is accessible in the war (like a static variable or context attribute). If you are thinking about properties such as database/mail server connections, then keep the OUTSIDE of the war file, not in XML or other things

Re: How to know when tomcat is ready to serve request

2009-10-22 Thread Elli Albek
spawned from the contextInitilized method of a ServletContextListener.(Inside the war) On Wed, Oct 21, 2009 at 11:53 PM, Elli Albek wrote: > Where does the code that needs to know that reside? How is it initialized? > Is it inside tomcat (war file

Re: Valves being converted to Filters?

2009-10-22 Thread Elli Albek
This is my concern as well. Our custom login valve is using values from the form authentication valve that are not accessible in the war file. For example they allow reconstruction of a post request and replacing roles and principals, which I doubt can be done with a filter in a simple way witho

Re: How to know when tomcat is ready to serve request

2009-10-21 Thread Elli Albek
Where does the code that needs to know that reside? How is it initialized? Is it inside tomcat (war file, valve, JNDI resource) or outside the tomcat JVM? E - Original Message - From: Anup K Ram To: users@tomcat.apache.org Sent: Wed, 21 Oct 2009 16:56:50 -0700 (PDT) Subject: How to know

Re: Cannot set remote address in valve (Tomcat 5.5)

2009-10-21 Thread Elli Albek
Tomcat with x-forwarded-for="@clientIp, @the-trusted-proxy-that-is-not-the-load-balancer" Does it make sense ? Cyrille -- Cyrille Le Clerc clecl...@xebia.fr cyri...@cyrilleleclerc.com http://blog.xebia.fr On Wed, Oct 21, 2009 at 6:57 AM, Elli Albek wrote: > > A quest

Re: Does Tomcat http support subdomains?

2009-10-21 Thread Elli Albek
> My initial response to that article is that it's vague drivel. > "If you are an incredibly savvy and experienced web developer, no doubt > you already have a DreamHost account" - should be all you need to read > to make a reasonable critical assessment of the quality of this article. :)

RE: Cannot set remote address in valve (Tomcat 5.5)

2009-10-20 Thread Elli Albek
bia-france/wiki/XForwardedFilter On Mon, Oct 5, 2009 at 11:19 PM, Elli Albek wrote: > > Hi, > > We can add the header to the custom valves, but then in addition we have to > change a few log file configurations, create a servlet filter and maybe > something else I cant think of n

RE: Valves being converted to Filters?

2009-10-20 Thread Elli Albek
So is there still going to be an API to plug into the tomcat internals and do things that the servlet API does not support? E -Original Message- From: Cyrille Le Clerc [mailto:clecl...@xebia.fr] Sent: Tuesday, October 20, 2009 4:06 PM To: Tomcat Users List Subject: Re: Valves being conv

RE: Cannot set remote address in valve (Tomcat 5.5)

2009-10-05 Thread Elli Albek
client IP without requiring the same code again. * * @author Elli Albek, www.sustainlane.com */ public class RemoteIPValve extends ValveBase { private static final Pattern ipExpr = Pattern.compile("^[\\da-fA-F]+(\\.[\\da-fA-F]+)+"); private String forwardedForH

Re: Cannot set remote address in valve (Tomcat 5.5)

2009-10-05 Thread Elli Albek
execute before the filters. -Tim Christopher Schultz wrote: > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > Mark, > > On 10/2/2009 5:55 AM, Mark Thomas wrote: >> Elli Albek wrote: >>> A few reasons why not to do this as a servlet filter: >>> >>

Re: Cannot set remote address in valve (Tomcat 5.5)

2009-10-05 Thread Elli Albek
- Original Message - From: Christopher Schultz To: Tomcat Users List Sent: Fri, 2 Oct 2009 07:32:06 -0700 (PDT) Subject: Re: Cannot set remote address in valve (Tomcat 5.5) >> 2. There are other valves like request filters that cannot work without the >> correct IP, as well as custom l

RE: Cannot set remote address in valve (Tomcat 5.5)

2009-10-02 Thread Elli Albek
A few reasons why not to do this as a servlet filter: 1. There are many web apps on the server and I don't want to include the filter in each. 2. There are other valves like request filters that cannot work without the correct IP, as well as custom login valve. 3. We have a few environments and I

RE: Cannot set remote address in valve (Tomcat 5.5)

2009-10-02 Thread Elli Albek
Cannot set remote address in valve (Tomcat 5.5) -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Elli, On 9/27/2009 12:19 AM, Elli Albek wrote: > public void setRemoteAddr(String remoteAddr) { > // Not used > } > > The variable is protected so I cannot access it dir

Re: Cannot set remote address in valve (Tomcat 5.5)

2009-09-27 Thread Elli Albek
Thanks for the response. Is there any problem in fixing this method to actually set the variable (which is already in the class)? I think the set methods should actually set the values, so others can write such extensions without putting their code in the apache packages. Right now I guess the

Cannot set remote address in valve (Tomcat 5.5)

2009-09-26 Thread Elli Albek
Hi, We have Tomcat behind a load balancer. The servlet API and tomcat libraries see the load balancer IP as the client IP. I tried to write a simple valve which will extract the IP from HTTP header X-Forwarded-For and continue the valve chain using this IP as the client IP. This will be the first