Re: Performance issues when adding Tomcat JK redirector to IIS's Default Web Site?

2010-02-15 Thread Peter Crowther
Steve, you're likely to get more specific answers if you can tell us
versions: what version of the redirector, and what versions of IIS?
Also, can you tell us whose instructions you followed to get it
working, as there are some out there that are... how shall I say it...
less than ideal :-).

Cheers,

- Peter

On 15 February 2010 11:30, Steve Ryan st...@acme.ie wrote:
 Dear All



 I've tried googling this but can't find much, so I was hoping one of you
 guys might be able to help me.



 My web application lives under IIS's Default Web Site. It needs to use the
 Tomcat JK redirector, so I have added the redirector as an ISAPI Filter on
 the Default Web Site. This means any websites which live under the
 Default Web Site will use the redirector.



 This is fine, however, there are other third-party websites which live under
 IIS's Default Web Site, which means the change I made above (adding the
 redirector as an ISAPI Filter on the Default Web Site) also affects these
 third party websites.



 So my question is this:



 Are there any known performance issues with the Tomcat JK redirector, in
 particular, any performance issues which could affect the third-party
 websites as explained in my example above?



 Any advice appreciated.



 Cheers



 Steve



-
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-14 Thread Peter Crowther
On 13 February 2010 15:29, Caldarale, Charles R
chuck.caldar...@unisys.comwrote:

 Does memtest86+ fire up enough threads to heat up all the cores?


No.  It's a pure memory tester, and it's single-threaded so that it always
knows what's adjacent to each bit.

- Peter


Re: What governs a URL connection timeout?

2010-02-12 Thread Peter Crowther
A swift Google for:
  java url openStream timeout
reveals:
  
http://stuffthathappens.com/blog/2007/09/10/urlopenstream-might-leave-you-hanging/
as its first hit.

In essence: the timeout is controlled by setTimeout on UrlConnection.

On 12 February 2010 11:59, Chris Mannion chris.mann...@icasework.com wrote:
 Hi all

 Hoping someone can shed some light on a little puzzle I have.  This
 may be more a Java programming problem than a Tomcat problem so
 apologies if that is the case but it's specific to a system running on
 Tomcat so I'm asking here too.  One of our servlets is opening a URL
 connection to hit an external URL, the external URL can sometimes take
 a while to respond and when that happens the URL connection throws a
 socket timeout exception (see the stack trace below).  What I can't
 work out is what determines how long the connection waits before it
 times-out, we don't set anything explicitly in our code and it doesn't
 seem to be related to the servlet timeout in the connector, does
 anyone know what determines the timeout length and how it can be
 changed?  The code is simply -

 public void outputUrl(OutputStream p_out, String p_url) {
  try {
          URL t_url = new URL(p_url);
          InputStream t_inputStream = t_url.openStream();
          // Read from the input stream, and write to the output stream
          byte[] l_buffer = new byte[10]; // buffer holding bytes to
 be transferred
          int l_nbytes = 0;  // Number of bytes read
          while ((l_nbytes = t_inputStream.read(l_buffer)) != -1)
             p_out.write(l_buffer,0,l_nbytes);
          t_inputStream.close();
          }
  catch (Exception e)
   {
     nsglog.error(String.valueOf(e), e);
   }
  }

 The error trace is -

 java.net.SocketTimeoutException: Read timed out
       at java.net.SocketInputStream.socketRead0(Native Method)
       at java.net.SocketInputStream.read(SocketInputStream.java:129)
       at java.io.BufferedInputStream.fill(BufferedInputStream.java:218)
       at java.io.BufferedInputStream.read1(BufferedInputStream.java:256)
       at java.io.BufferedInputStream.read(BufferedInputStream.java:313)
       at sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:659)
       at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:604)
       at 
 sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:961)
       at java.net.URL.openStream(URL.java:1007)
       at ep.ext.outputUrl(ext.java:446)

 So it's the attempt to open the input stream on the URL that is timing
 out, what governs that timeout?

 --
 Chris Mannion
 iCasework and LocalAlert implementation team
 0208 144 4416

 -
 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: What governs a URL connection timeout?

2010-02-12 Thread Peter Crowther
Chris, did you actually read the link or was that a knee-jerk
response?  Notably the following, taken from between the first and
second boxed pieces of code on that page:

The openStream() method is actually just a shortcut for
openConnection().getInputStream().
... plus the source of openStream() to prove it.

So, yes, you *are* using a URLConnection internally.  And... correct,
you're not setting any timeouts in your code.  But you want to.  That
page provides code further down that allows you to set such a timeout.

- Peter

On 12 February 2010 12:24, Chris Mannion chris.mann...@icasework.com wrote:
 Thanks Peter but we're not using a URLConnection, nor are we
 explicitly setting any timeouts, as you can see from the code.

 On 12 February 2010 12:06, Peter Crowther peter.crowt...@melandra.com wrote:
 A swift Google for:
  java url openStream timeout
 reveals:
  http://stuffthathappens.com/blog/2007/09/10/urlopenstream-might-leave-you-hanging/
 as its first hit.

 In essence: the timeout is controlled by setTimeout on UrlConnection.

 On 12 February 2010 11:59, Chris Mannion chris.mann...@icasework.com wrote:
 Hi all

 Hoping someone can shed some light on a little puzzle I have.  This
 may be more a Java programming problem than a Tomcat problem so
 apologies if that is the case but it's specific to a system running on
 Tomcat so I'm asking here too.  One of our servlets is opening a URL
 connection to hit an external URL, the external URL can sometimes take
 a while to respond and when that happens the URL connection throws a
 socket timeout exception (see the stack trace below).  What I can't
 work out is what determines how long the connection waits before it
 times-out, we don't set anything explicitly in our code and it doesn't
 seem to be related to the servlet timeout in the connector, does
 anyone know what determines the timeout length and how it can be
 changed?  The code is simply -

 public void outputUrl(OutputStream p_out, String p_url) {
  try {
          URL t_url = new URL(p_url);
          InputStream t_inputStream = t_url.openStream();
          // Read from the input stream, and write to the output stream
          byte[] l_buffer = new byte[10]; // buffer holding bytes to
 be transferred
          int l_nbytes = 0;  // Number of bytes read
          while ((l_nbytes = t_inputStream.read(l_buffer)) != -1)
             p_out.write(l_buffer,0,l_nbytes);
          t_inputStream.close();
          }
  catch (Exception e)
   {
     nsglog.error(String.valueOf(e), e);
   }
  }

 The error trace is -

 java.net.SocketTimeoutException: Read timed out
       at java.net.SocketInputStream.socketRead0(Native Method)
       at java.net.SocketInputStream.read(SocketInputStream.java:129)
       at java.io.BufferedInputStream.fill(BufferedInputStream.java:218)
       at java.io.BufferedInputStream.read1(BufferedInputStream.java:256)
       at java.io.BufferedInputStream.read(BufferedInputStream.java:313)
       at sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:659)
       at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:604)
       at 
 sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:961)
       at java.net.URL.openStream(URL.java:1007)
       at ep.ext.outputUrl(ext.java:446)

 So it's the attempt to open the input stream on the URL that is timing
 out, what governs that timeout?

 --
 Chris Mannion
 iCasework and LocalAlert implementation team
 0208 144 4416

 -
 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





 --
 Chris Mannion
 iCasework and LocalAlert implementation team
 0208 144 4416

 -
 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 dies suddenly

2010-02-12 Thread Peter Crowther
On 12 February 2010 16:43, Carl c...@etrak-plus.com wrote:
 1.  There is no place in the code that we intentionally put an exit().  I
 have grepped for exit() and found nothing.  The system stops in a different
 place every time... the last entry in catalina.out has never been the same
 (over 15-20 failures.)

I'm wondering about a concurrency issue, given that the failure occurs
more frequently under load but can occur at other times.  But it's
difficult to think of one that would cause a silent crash like this,
unless you're using a library somewhere that makes use of the crash
and burn school of error handling!

... actually, that's a thought.  There *is* a way of you
distinguishing the VM exiting in an orderly fashion, quitting, or
being terminated, and that's to add a tiny webapp that just registers
a shutdown hook
(http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Runtime.html#addShutdownHook%28java.lang.Thread%29).
 If you're willing to add that debug code, then you could log a
message (or simply touch a file).  If there's no message/file, the VM
is shutting down due to an error or someone's calling halt
(http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Runtime.html#halt%28int%29).

As another small piece of debugging, it would be very interesting to
capture the exit status of the JVM.  How are you starting it, and is
there any chance of inspecting the code on exit?  A non-zero exit
code, in particular, would be interesting.

As a third, rather larger, piece of debugging, you could consider
running Tomcat under a security manager that allowed all operations
except exit.  This may be tough to get right, especially on a
production server, but it would definitely tell you whether there were
any Java calls to Runtime.exit() or Runtime.halt().

Finally, is there any native code in any part of your application?
This is, of course, outside of any of the JVM handlers; a failure of
native code can (and occasionally does!) cause mayhem.

None of this is a solution, I'm afraid.  It's all just more debugging
and gathering more information.  But the problem is sufficiently
unusual that I think you're going to have to keep on debugging it :-(.

- Peter

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



Re: how to know if tomcat is completely started

2010-02-11 Thread Peter Crowther
In that case, you want a LifecycleListener
(http://tomcat.apache.org/tomcat-6.0-doc/api/org/apache/catalina/LifecycleListener.html)
looking for the AFTER_START event.  You can then write code in the
listener to do something unambiguous when the event triggers - I'd
write a file somewhere, but I'm old-fashioned like that.

Configuration is performed by adding a Listener element to your
server.xml - see
http://tomcat.apache.org/tomcat-6.0-doc/config/listeners.html for some
of the docs, though I'm not aware of a tutorial anywhere that shows
how to implement and add one.  You'll want to nest yours inside the
Server element, I think.

- Peter

On 11 February 2010 12:15, Jan Van Besien janvanbes...@gmail.com wrote:
 Pid wrote:

 On 11/02/2010 11:15, Jan Van Besien wrote:

 Hi all,

 I'm using tomcat-6.0.18 with java-1.6.0-18 on ubuntu-9.10.

 We are using the tanuki service wrapper to run tomcat as a linux
 service, more or less as described in [1].

 We also have a monitoring mechanism which checks the health of the
 running tomcat with all the applications deployed into it by making
 certain well choosen http requests that test some core functionality of
 our applications. If some of this fails, a system is in place to have
 another redundant server (with another tomcat) take over.

 Now the problem is that we only want the monitoring mechanism to start
 monitoring after tomcat is completely started (successful or not). So I
 would like to know what my options are to ask a running tomcat if it
 has more startup/deployment work to do, or if it is finished.

 The log files contain things like INFO: Server startup in 39188 ms, so
 clearly tomcat knows this information. I could ofcourse parse the log
 files, but I would prefer a more robust mechanism. Maybe a java API, or
 JMX or something like that?

 How do you define completely started?  E.g. The server might start but
 the applications not start.

 I agree this is a subtile question, but whatever makes tomcat decide to log
 Server startup in xxx ms is good for me. Note that it also logs this if
 one of the deployments failed.

 Apart from JMX, there a number of things you can do within the server and
 each application that could lead to a notification.  Implement a
 ServletContextListener for an application, or a LifecycleListener for the
 server.

 I don't want anything in my applications per se, because when tomcat fails
 to deploy one of my applications (for whatever reason), I still want to know
 that tomcat is finished trying to deploy my applications.

 Kind regards
 Jan

 -
 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: Java heap size limit

2010-02-11 Thread Peter Crowther
On 11 February 2010 14:56, Jeffrey Janner jeffrey.jan...@polydyne.com wrote:
 Also, as I've heard several times here, set the -Xms and -Xmx settings to the 
 same to improve garbage collect efficiency. (did I interpret that correctly?)

Allocation efficiency - and to make sure you actually get the memory
when you need it!

If you allocate a small heap initially, then need to expand it later,
you have the following potential problems:
1) CPU time to expand the heap - during which your application may be
unresponsive, I'm not sure how the modern JVMs work.
2) The system may have overcommitted memory in the meantime, so may
need time to flush other data or programs to disk - again, your
application may be unresponsive during this time.
3) Most insidiously, if the system's loaded or allocated something
that it can't move in the middle of your process' address space, it
may be unable to move that.  In this case, you won't be able to expand
the heap at all - even though there's plenty of free memory in the
machine, and you could have had the extra space if you'd asked for it
to start with.

That's my understanding, anway.  Chuck, should I have put my fireproof
suit on before posting this? :-)

- Peter

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



Re: Java heap size limit

2010-02-11 Thread Peter Crowther
On 11 February 2010 15:29, Caldarale, Charles R
chuck.caldar...@unisys.com wrote:
 From: Peter Crowther
 3) Most insidiously, if the system's loaded or allocated something
 that it can't move in the middle of your process' address space, it
 may be unable to move that.

 Doesn't happen.  The JVM reserves the maximum heap space, but doesn't commit 
 or otherwise touch it until needed.  Nothing else can be allocated in the 
 reserved space.  Regardless, once an item (e.g., DLL) is loaded in a 
 particular process space, it won't be moved (it might be removed, but not 
 relocated).

That's good to know.  My deep knowledge of process memory allocation
is still stuck in the dark ages, with the old-style UNIX brk(2); at
least the modern OSs are better than that!

- Peter

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



Re: 64bit Server + JDK 1.5 (64bit) + Tomcat 5.0.28?

2010-02-11 Thread Peter Crowther
On 11 February 2010 16:14, Stefan Rainer s.rai...@teamaxess.com wrote:
 BUT as far as I know, tomcat 5.0.28 is compiled for 32 bit.

Tomcat is pure Java, and is therefore not compiled for any particular
word size.  You may be using native libraries which are compiled for
particular architectures, but Tomcat itself will run quite happily on
a 64-bit JDK.

- Peter

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



Re: redeploying war files

2010-02-10 Thread Peter Crowther
On 10 February 2010 10:39, Jan Van Besien janvanbes...@gmail.com wrote:
 Can I safely delete the exploded files if tomcat is still running as well?
 In that case, I could do it always, without checking if tomcat is running.

You shouldn't get any errors in your RPM if you delete the files.
Tomcat itself has error handling whenever it fails to find a file it's
expecting, as far as I know.  If your webapp is processing any
requests at the time it's removed and redeployed, you'll probably want
to put in appropriate error handling in case it suddenly can't find a
resource it thought was available!

- Peter

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



[OT] Re: [Fwd: Re: Parameters disappear from PUTs]

2010-02-09 Thread Peter Crowther
On 9 February 2010 15:26, Christopher Schultz
ch...@christopherschultz.net wrote:
 I've learned a lot from
 reading and participating in many discussions on this list, and I think
 you probably will, too, if you stick around.

I think many of us have learned a lot.  Sometimes it's been technical,
sometimes on how to deal with conflict!  I no longer use Tomcat in
production, but I stick around on the list for the interesting
architectural issues - of which this has been one, thanks to Chas and
the many responders - and to get the popcorn out when an especially
entertaining war breaks out.

- Peter

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



Re: Heap size rule for Tomcat 5.5

2010-02-06 Thread Peter Crowther
On 5 February 2010 18:05, evebill8 evebi...@hotmail.com wrote:

 Cool!  I just want to confirm if the rule is right.  My IT guy also does
 not
 believe it.

 It wasn't a bad rule of thumb as a place from which to start tuning when
typical server memory sizes were 0.5G to 2G - it reserved sort-of enough
RAM for the OS and the non-heap parts of Java and sort-of enough RAM for
the web application, though as you can imagine that varied quite a lot.  But
it could never really be said to be optimal, and ideally you'd always
measure and tune.

These days, there's so much more RAM in most servers that tuning becomes
more relevant if the load's high.  If your application is very heavy on disk
reads, for example, you might do better to reduce its heap size in order to
give the OS more space to cache disk pages.  By contrast, I have one *very*
heavy compute application (not directly a web app) that likes all the RAM it
can get as heap memory to cache intermediate results in case they can be
re-used.

- Peter


Re: Tomcat dies suddenly

2010-02-05 Thread Peter Crowther
On 5 February 2010 14:41, Carl c...@etrak-plus.com wrote:
 Bill,

 ulimit -a shows the following:
[...]
 open files                      (-n) 1024
[...]
 This looks fine except the 'open files'.  I don't think we would exceed that
 number but it might be possible.

Note that a socket uses a file descriptor in UNIX, so you should
include open sockets in that calculation.

- Peter

-
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-05 Thread Peter Crowther
On 5 February 2010 15:16, Carl c...@etrak-plus.com wrote:
 Do you see any harm in just doubling the number (to 2048) just to see if it
 has an impact?

I wouldn't expect any problems, but I don't know your server as well
as you do.  Just don't hold me responsible if your Tomcat fails / the
dog eats the hamster / someone holds you hostage for the release of
the unknown soldier's grandmother (delete all that don't apply).

I'd suggest checking about limits that may be compiled into the
kernel, too.  File descriptor usage masks used to be stored as
bitmasks in arrays, and the kernel used to have fixed maximum sizes.
But then, this is coming from someone who every day walks past a
museum containing a computer with a total of 1,024 bits of memory...
things may have improved since then.

- Peter

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



Re: max heap size on Windows server 64 bit

2010-02-04 Thread Peter Crowther
On any 64-bit OS, more than 2G is fine.  I know several places running
dedicated application servers with 16G RAM and 12G Java heaps.

Where have you read about the 2G recommendation?  I want to send them an
email... :-).

- Peter

On 4 February 2010 07:53, Wolfgang Hummel wolfgang.hum...@energy4u.orgwrote:

 Hi,

 we are running tomcat 6.20 on windows server 2003 64bit with java 1.6
 (64bit) as a Windows service.
 Everything works fine but I have to increase max. heap size to 4 GB (now 2
 GB).
 Machine has abaout 8 GB ram.
 I know, how to do this - but I read, that it is not recommanded to
 configure more than 2 GB???
 Is it true or is it depending on operating system?

 Thanx and regards
 Wolfgang



Re: Timeout when sending message via HTTP out of a webapp. on tomcat 6.20

2010-02-04 Thread Peter Crowther
Timeouts from what to what?  If from your webapp (acting as a client) to a
SAP host, this is something Tomcat neither knows nor cares about; you will
have to configure the code you have written to connect so that it uses a
longer timeout.

- Peter

On 4 February 2010 17:01, Wolfgang Hummel wolfgang.hum...@energy4u.orgwrote:

 Hi,

 we are sending large messages via http from a tomcat-webapps to a SAP host.
 Sometimes we are getting timeouts.
 Now my question:
 Is there a parameter in tomcat 6 to increase the timeout time?

 Thanks and best regards

 Wolfgang Hummel




Re: Tomcat access is very slow

2010-02-03 Thread Peter Crowther
Mike, you'll probably get a few comments about thread hijacking - might be
worth starting a new thread.

Is there any way you could get a Wireshark or similar trace?  It'd be very
interesting to know what bytes the browser sent when in the request, for
example, and whether the browser half-closed the socket.

Also, which Connector are you using?  What happens if you use a different
one?

Cheers,

- Peter

On 3 February 2010 17:37, youngm you...@gmail.com wrote:


 I am having a similar problem though I only see this problem in Google
 Chrome.  I request my home page in chrome and it takes 100 sec to load the
 page.  If I load the page in Firefox it loads excellent.  I downgrade to
 tomcat 6.0.20 and everything works great in chrome.

 This is hitting a server using localhost so it's not a host
 resolve/timeout problem.

 I hooked a profiler up to my app running tomcat 6.0.24 and hit the home
 page.  All of the time is taken in the following trace.

 org.apache.coyote.http11.InternalInputBuffer.parseRequestLine()
 org.apache.coyote.http11.InternalInputBuffer.fill()
 java.net.SocketInputStream.read(byte[], int, int)
 [Wall Time]  java.net.SocketInputStream.socketRead0(FileDescriptor, byte[],
 int, int, int)

 Tomcat 6.0.24 is spending 100 sec 99% of the request in the socketRead0
 call
 above.

 Again I don't see this problem with Tomcat 6.0.20 in any browser.  In
 Tomcat
 6.0.24 I have tested Firefox 3.5, IE 8 and Chrome 4.0.249.78.  I only see
 this problem in Chrome.

 Any ideas?

 Mike




 Yves Yu wrote:
 
  Dears,
 
 
 
  I’m not a very new to Tomcat \with a few projects experience.
 
  I got a new note book, everything is very fast except tomcat access.
 
 
 
  I run a new project in my new tomcat(5.5.28 with no other project in
  webapp), I need about 2-5 minutes to open a page.
 
  Same environment on my colleague, it only need 10 seconds at most.
 
 
 
  Some colleague said they met this situation before, but when they
  reinstall
  the OS, it works well,
 
  Do I have any other ways except reinstall OS?
 
 
 
  Thank you in advance, following is my environment configuation.
 
 
 
  HP 4311s with 2G Memory
 
  Tomcat 5.5.28, new and clear.
 
  No virus.
 
 
 
 
 
  Best Regards,
 
  Yves
 
 

 --
 View this message in context:
 http://old.nabble.com/Tomcat-access-is-very-slow-tp27179689p27440294.html
 Sent from the Tomcat - User mailing list archive at Nabble.com.


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




Re: Tomcat 6.0.24 Google Chrome

2010-02-03 Thread Peter Crowther
Good luck hunting it down.  I suggest changing one other Tomcat variable,
namely whether you're using the Java or native connector.

- Peter

On 3 February 2010 19:56, youngm you...@gmail.com wrote:


 A couple of updates.  I've confirmed it doesn't only happen in Tomcat
 6.0.24
 and it doesn't only happen in Chrome.  It seems to happen less often the
 longer the server is up.  I though I had the problem more narrowed down
 than
 I do.  I'll keep testing and see if I can provide some better information.
 Otherwise consider this thread closed unless anyone else has happened to
 see
 a similar problem.

 Mike



 youngm wrote:
 
  (This is a new thread to discuss a problem I accidentally posted to the
  Tomcat access is very slow)
 
  I'm having a performance problem on Tomcat 6.0.24 and Google Chrome.  I
  request my home page in chrome and it takes 100 sec to load the page.  If
  I load the page in Firefox it loads excellent.  I downgrade to tomcat
  6.0.20 and everything works great in chrome.
 
  This is hitting a server using localhost so it's not a host
  resolve/timeout problem.
 
  I hooked a profiler up to my app running tomcat 6.0.24 and hit the home
  page.  All of the time is taken in the following trace.
 
  org.apache.coyote.http11.InternalInputBuffer.parseRequestLine()
  org.apache.coyote.http11.InternalInputBuffer.fill()
  java.net.SocketInputStream.read(byte[], int, int)
  [Wall Time]  java.net.SocketInputStream.socketRead0(FileDescriptor,
  byte[], int, int, int)
 
  Tomcat 6.0.24 is spending 100 sec 99% of the request in the socketRead0
  call above.
 
  Again I don't see this problem with Tomcat 6.0.20 in any browser.  In
  Tomcat 6.0.24 I have tested Firefox 3.5, IE 8 and Chrome 4.0.249.78.  I
  only see this problem in Chrome.
 
  Any ideas?
 
  Mike
 
  Peter Crowther suggested I connect Wireshark and see what is going on.
 
 
  I will do so and reply to this thread.
 

 --
 View this message in context:
 http://old.nabble.com/Tomcat-6.0.24-Google-Chrome-tp27440921p27442417.html
 Sent from the Tomcat - User mailing list archive at Nabble.com.


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




Re: w3wp randomly crashes when redirector is used

2010-02-03 Thread Peter Crowther
Steve, I'm with you - the issue does look unpleasantly similar.  I wonder
whether some experimentation with running the redirector under a local
account with particular rights set might tell you which right was required,
and hence which one might be causing an issue?

But in the longer term, the stack trace shows it's faulting in the
redirector's TerminateFilter, while waiting on a critical section.  Looking
at this plus the identical stack trace in Bugzilla, it does feel like it's
an issue with the redirector.

Does it always happen in your app, or is it intermittent?  If intermittent,
is it more likely to trigger when something's under load?

- Peter

On 3 February 2010 22:12, Steve Ryan st...@acme.ie wrote:

 Hi Andre

 Thanks for your reply.

 W3wp.exe is the process which manages the application pool where the
 redirector lives.

 I'm fairly confident the problem is due to the redirector because the crash
 only occurs when the redirector is used. Also, there is an open bug (45063)
 which appears to be a very similar issue.

 I do of course accept the problem could lie at Microsoft's door though. :)

 I guess I'm hoping someone has heard of this issue before, and knows of
 some
 sort of workaround which doesn't involve using the Local System account.

 Cheers

 Steve

 -Original Message-
 From: André Warnier [mailto:a...@ice-sa.com]
 Sent: 03 February 2010 21:58
 To: Tomcat Users List
 Subject: Re: w3wp randomly crashes when redirector is used

 Steve Ryan wrote:
  My issue is due to Tomcat Connectors 1.2.28.
 
  Is there a more specific mailing list for such issues? The Tomcat
 Connectors
  website shows users@tomcat.apache.org as the mailing list.
 
 No. If your issue is indeed due to the Windows version of the mod_jk
 connector, then you are on the correct list.

 I am far from the specialist on the Windows/jk side of things, but I am
 still puzzled however.
 According to your explanation below, the application which crashes is
 something called w3wp.exe.  This does not really sound like an
 application which lives under Java and Tomcat.
 The jk redirector's function is to redirect (or rather proxy) some
 HTTP requests from IIS to a back-end Tomcat, so that these requests are
 processed by a Tomcat-based application.  Conversely, the response from
 this Tomcat-based application is then returned through the jk
 redirector, back to IIS, and from there to the client.
 What motivates my puzzlement is that, if w3wp.exe is really an
 application which lives under IIS and not Tomcat, then there does not
 seem to exist any reason why the jk redirector would have anything to do
 with it.

 My knowledge being limited, there might well be something I am missing
 in all of this.


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

 No virus found in this incoming message.
 Checked by AVG - www.avg.com
 Version: 9.0.733 / Virus Database: 271.1.1/2665 - Release Date: 02/03/10
 08:09:00


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




Re: Getting a heap dump on OOME from Tomcat-as-a-service on Windows?

2010-02-02 Thread Peter Crowther
On 1 February 2010 22:23, Laird Nelson ljnel...@gmail.com wrote:
 Gave Everyone full control of the C:\crap directory.  Configured Tomcat
 through the service monitor to also append -XX:HeapDumpPath=C:\crap to the
 list of Java options.  Started and stopped the service.  Ran the build.
 Heap dumped, but no file was produced.  Searched the entire computer for
 .hprof files; no results.

 Anything else before giving up?

Follow the process with Process Explorer* from sysinternals (or
Technet, these days) and see whether/where it's trying to write the
file and what's stopping it from doing so.

- Peter

* Worth its weight in gold for tracing this kind of error

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



Re: Still unable to get a heap dump from Tomcat running on Windows as a service

2010-02-02 Thread Peter Crowther
On 2 February 2010 21:48, Laird Nelson ljnel...@gmail.com wrote:
 OK; leery of running my Tomcat as the administrator, but am not up to speed
 on which Windows users would be better choices.  I naturally assumed that
 the local user selected by default was appropriate.

LocalSystem can impersonate any user on the computer, but has no
rights over the network.  It's actually a very highly privileged
account - if an application running as LocalSystem wanted to, it could
impersonate the local Administrator account without requiring a
password.  There are a few niceties about what that impersonated
Administrator account could do... but not many.

If you doubt this, note that IIS runs as LocalSystem and uses
impersonation to handle integrated login - it just sets the thread
handling the request to the required identity before handling the
request, and sets it back afterwards ;-).

 I believe you can also download resource kit from Microsoft that has tools
 that lets you watch all objects opened by a process ( so, look if Tomcat is
 even trying to open the file ). Its been a while, so don't recall tool
 sytax.

Process Explorer (
http://technet.microsoft.com/en-us/sysinternals/bb896653.aspx ) would
be my weapon of choice here.

- Peter

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



Re: tomcat memory usage

2010-01-26 Thread Peter Crowther
2010/1/26 Hüsnü Þentürk husnusent...@yahoo.com

 Hi,
 In our company, we are using apache tomcat as a windows service. We defined
 jvm parameters --JvmMs 512 --JvmMx 512 in service.bat. But application is
 using 600,980 KB memory. I expect the application not to use more then 512
 MB.

 Can you explain me, the reason of this stuation.

 You are setting the memory that Java uses to store heap objects.  That is
not the only memory Java uses.  Other uses include:
- The JVM code itself;
- Native code stacks per-thread;
- Native objects such as sockets and threads;
- Any loaded DLLs.

You have no direct way of controlling the size of any of these.  If you want
to reduce Java's memory usage, you can reduce its heap space after
monitoring what the process' overheads are.

- Peter


Re: Tomcat 100% CPU usage after moving from Java 5 to 6

2010-01-26 Thread Peter Crowther
2010/1/26 Leon Rosenberg rosenberg.l...@googlemail.com

 Another customer of mine was playing with gc settings for nearly a
 year, because his tomcats collection times went higher and higher, and
 after a short look at the heap dump with jmap and jhat, we found out
 that he had 100.000.000 uncollectable garbage objects in the heap (2/3
 of his heap actually). Instead of investigating his heap pollution he
 spent 11 month playing with gc options to setup a faster gc. In the
 end the problem was solved in two days.

 Definitely.  I've had the same in Smalltalk, the same in C# under the CLR.
Fewer live objects in the heap = faster GC.  Creating fewer short-lived
objects = less time spent in GC and in tenuring objects.  Almost always, the
root of a GC performance problem isn't the GC at all :-).

- Peter


Re: Please Validate this Question

2010-01-23 Thread Peter Crowther
2010/1/23 Karthik Nanjangude karthik.nanjang...@xius-bcgi.com:
 1)       A Custom built  web application  uses Quartz  process ( Kron  job)  
 every  20  minutes  to DB  (JNDI based Connection pool )  to process some 
 data on  when deployed on  single  system,

 2)       The same is deployed on a Apache 2x - tomcat CLUSTER mode as 2 
 instances on 2 different independent System.

 Question:   Does each instance of the application be connection to DB every 
 20 minute based on the Kron -Job Configuration.

Yes.  The instances are independent.

 If so Is there any way within the Cluster Configuration to prevent this issue?

Not that I am aware of.  You will have to design your application
appropriately.  For example, could these jobs run every 10 minutes if
both nodes are up rather than every 20?  If so, you could code your
app so that one node ran the job at :00, :20 and :40 and the other
node ran it at :10, :30 and :50.

- Peter

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



Re: mod_jk errors with tomcat 6.0.20 and Apache 2.0.52

2010-01-22 Thread Peter Crowther
I'm not an AJP expert, but I suspect:

- You're telling AJP to use a secure connection between httpd and Tomcat;
- The Tomcat connector on port 8443 is a SSL connector, not an AJP connector;
- AJP is getting confused.

I believe you should only need to configure one worker (the one on
8009); AJP is capable of passing through the information as to whether
or not the data arrived securely or not at httpd.

I suspect you'll get a better answer once the States wakes up, but
that's my guess.

- Peter

2010/1/22 Matt Turner m4tt_tur...@hotmail.com:

 Hi All,



 I have an existing Apache 2.0.52 installation, and a new tomcat 6.0.20 
 installation.

 They are both sitting on the same Linux box - uname -a returns the following:

 Linux [machine name] 2.6.9-55.ELsmp #1 SMP Fri Apr 20 16:36:54 EDT 2007 
 x86_64 x86_64 x86_64 GNU/Linux



 I'd like if possible to add mod_jk to enable the two to talk to each other, 
 without fiddling with the existing tomcat / apache versions.



 So far I've build mod_jk 1.2.28 from source on the destination machine, and 
 set up the following workers:



 (in apache conf)

 IfModule mod_jk.c
  JkWorkersFile /etc/httpd/conf/workers.properties

  JkLogFile /etc/httpd/logs/mod_jk.log

  JkLogLevel debug

  JkLogStampFormat [%a %b %d %H:%M:%S %Y] 

  JkWorkersFile /etc/httpd/conf/workers.properties

  JkLogFile /etc/httpd/logs/mod_jk.log

  JkLogLevel debug

  JkLogStampFormat [%a %b %d %H:%M:%S %Y] 

  JkRequestLogFormat %w %V %T

  JkOptions +ForwardURICompatUnparsed

  JkExtractSSL On
  JkHTTPSIndicator HTTPS
  JkSESSIONIndicator SSL_SESSION_ID
  JkCIPHERIndicator SSL_CIPHER
  JkCERTSIndicator SSL_CLIENT_CERT
 /IfModule



 (in apache conf, inside a virtual host)

 SSLEngine on
 SSLCertificateFile /etc/httpd/conf/filename

 SSLCertificateKeyFile /etc/httpd/conf/filename

 SSLCACertificateFile /etc/httpd/conf/filename

 JkMount /* tomcatssl



 (in workers.properties)

 # 
 # First tomcat server
 # 
 worker.tomcat1.port=8009
 worker.tomcat1.host=10.13.0.218
 worker.tomcat1.type=ajp13
 worker.tomcat1.lbfactor=50

 #-
 # SSL tomcat server
 #-
 worker.tomcatssl.port=8443
 worker.tomcatssl.host=10.13.0.218
 worker.tomcatssl.type=ajp13
 worker.tomcatssl.lbfactor=50





 However when I kick things off and visit a URL matching the above virtual 
 host, I get the following error message in mod_jk.log:



 [Thu Jan 21 18:51:07 2010] [303:2537062720] [info] init_jk::mod_jk.c (3183): 
 mod_jk/1.2.28 initialized
 [Thu Jan 21 18:51:30 2010] [30428:2537062720] [error] 
 ajp_connection_tcp_get_message::jk_ajp_common.c (1172): wrong message format 
 0x1503 from 10.13.0.218:8443





 Looking at jk_ajp_common.c I can see the following @ line 1172:




 if (ae-proto == AJP13_PROTO) {
    if (header != AJP13_SW_HEADER) {

        if (header == AJP14_SW_HEADER) {
            jk_log(l, JK_LOG_ERROR,
                   received AJP14 reply on an AJP13 connection from %s,
                   jk_dump_hinfo(ae-worker-worker_inet_addr, buf));
        }
        else {
            jk_log(l, JK_LOG_ERROR,
                   wrong message format 0x%04x from %s,
                   header, jk_dump_hinfo(ae-worker-worker_inet_addr,
                                         buf));
        }





 So it seems the error has something do with AJP13 headers not being as 
 expected.



 Could anyone confirm that the 3 version numbers (2.0.52, 1.2.28, 6.0.20) are 
 compatible together ?



 If so - any ideas what might be going on here ?







 thanks,



 matt.

 _
 Tell us your greatest, weirdest and funniest Hotmail stories
 http://clk.atdmt.com/UKM/go/195013117/direct/01/

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



Re: RMI reaper thread prevents JVM from exiting

2010-01-22 Thread Peter Crowther
2010/1/22 Thomas Chabaud ext_chabaud.tho...@agora.msa.fr:
 I have a problem with a webapp using RMI. When I try to shutdown Tomcat
 instance, the JVM doesn't exit.
 I have called jstack to see the thread dump :

 http://pastebin.com/fa55647

 There is a non-daemon thread : RMI Reaper.

 I've tried to add a servlet context listener to force RMI Object unexport on
 shutdown, but it has no effect :

 http://pastebin.com/f324201e2

 I'm using Tomcat 6.0.18 on a Red Hat Enterprise Linux Server release 5.3.
 The JVM is a 64 bit JVM, version 1.6.0_07-b06 on a Intel Xeon E5420 CPU.

 What can I do to force this RMI reaper thread to stop ?

If you know you're about to exit the process, then one nasty trick
would be to find the thread in your context listener and *set* it to
be a daemon thread.  An ugly hack, but it might just work!

- Peter

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



Re: Securing Tomcat Applications from Reverse Engineering

2010-01-21 Thread Peter Crowther
2010/1/21 Kranti™ K K Parisa kranti.par...@gmail.com

 Hi,

 Can anyone throw some light on this topic, seems it is possible to convert
 the tomcat+tomcat web applications to native code to secure them and
 further
 to run them on client machines easily.

 Please check this.

 http://www.excelsior-usa.com/jetinternals.html

 How could we achieve this without the above tool? Because the pricing of
 the
 above tool is very costly.

 Well, you could always spend the developer-years to create your own version
of that tool... which would probably be *more* costly.  That's the company I
was aware of; I'm not aware of anyone else who has developed similar
technology.

No application is ever 100% secure from reverse engineering.  So, you have a
business decision to take.  How good is good enough protection for your
application?  Who are you defending against, and what kind of effort are you
assuming they're willing to put into the reverse-engineering?

As pointed out by another poster, you can compile JSPs to classes and you
can obfuscate your code.  Is that good enough?

- Peter


Re: How to use custom classloader to load my own app classes in tomcat?

2010-01-21 Thread Peter Crowther
2010/1/21 Chinmoy Chakraborty cch...@gmail.com

 How I can use my own custom classloader to load my own app classes inside
 webapp? Please share some ideas.

 1) Write custom classloader.
2) Write code in web app to use your custom classloader.

Sorry... if you want us to help you, I think you'll need to provide more
information about what you're trying to achieve.

- Peter


[OT] Re: Securing Tomcat Applications from Reverse Engineering

2010-01-21 Thread Peter Crowther
2010/1/21 Mark H. Wood mw...@iupui.edu

 Reverse engineering is not a technical problem; it is a legal
 problem.  You need a lawyer, not a program.

 Mmm, yes and no.  Burglary is also a legal problem, but I have locks (on /
around the things I want to keep, of a cost and quality appropriate to my
expected loss) as well as being able to engage a lawyer if required.

- Peter


Re: Building a more efficient war file

2010-01-21 Thread Peter Crowther
2010/1/21 Eric Pastoor epast...@vt.edu
 I run a tomcat based website which run about 10 sports leagues.  All of the 
 leagues have their own war based webapp.
[...]
 Am I going about this totally wrong?

Well, a quick cost/benefit analysis...
- How much does the memory and disk to hold the extra copies of the files cost?
- How much does your time to think about changing this cost?
- How much time do you expect to spend in / save by making any change?
- Do you expect the changed version to have teething troubles that
might impact your users?

Other than for (some value of) conceptual neatness, why do you want to
do this?  What part of your life, your users' life or your business'
life will this improve?

I'm not aiming to persuade you against making the change, by the way;
nor do I intend to teach grandmother to suck eggs if you've got a
business case.  It's just surprising how many people don't cost $500
of staff time and $10,000 of unscheduled downtime when trying to save
$10 of RAM ;-).

- Peter

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



Re: TOMCAT GC Issue

2010-01-20 Thread Peter Crowther
2010/1/20 Paulwintech paulwint...@gmail.com


 Hello,

   I am new to the Tomcat Administration, I have some 4 production servers
 running Tomcat6.x with Jdk - To monitor all my applications like
 Apache,Tomcat and Mysql we are using OPmanager-Application manager tool.

   Intermediately i get GC critical alert. That means some times GC
 collection goes high and remains for more than 10 mins. Then it clears the
 Grabage. But this is happening recently checked all possible logs found
 nothing. This is not happening every time, Say like twice in a day...

 Could you give us a bit more information?
+ JDK version?
+ What memory and GC settings are set?
+ Does the alert coincide with high usage on the servers?
+ Does it happen on all servers equally?  If not, what factors differ
between the servers?
+ *Exactly* what condition causes the monitor to report the alert?  Feel
free to point us at the web page describing the alert's definition in the
monitor.

Sorry to ask for that lot, but different Java versions can handle GC very
differently, and the options make a difference too.

- Peter


Re: War file encryption

2010-01-20 Thread Peter Crowther
If you control the servers on which the code is being deployed, you should
probably be taking other steps than encryption.

If you *don't* control the servers, you cannot stop someone decrypting your
code - sooner or later, it will have to be decrypted for Tomcat to use it.
Therefore you will have to give those servers the key to decrypt the code.

Javascript that will be sent to a browser is always available in the
clear, as the browser must be able to use it.  You should assume that if a
stream of bytes ever gets served out of a web server, it's gone out of the
server's control and could be copied.

However, you can still sort-of protect your code.  At least one company has
posted here that they have a Java compiler that compiles Tomcat + webapps +
JVM to one big native code executable.  You *could* buy a license to that
technology and use it.  I assume it's not cheap.

- Peter

2010/1/20 Kranti™ K K Parisa kranti.par...@gmail.com

 Hi,

 Is there any way that we could encrypt the war file that is getting
 deployed
 into tomcat?

 or can we make war files or jar files as native code files like dll files
 or
 so.

 the objective is to safe guard the code inside the war file (javascript,
 jsp, .class files)..etc


 Best Regards,
 Kranti K K Parisa



Re: Increase in rss and thread usage.

2010-01-19 Thread Peter Crowther
2010/1/19 kent.anders...@tieto.com

 Are using Tomcat 6.0.20. We have mointored it and can see that the rss and
 thread usage increases all the time.
 Is this someone else also have experienced?

 Almost always, if your resource usage increases over time, your application
has a resource leak.  In this case, I suspect your application is starting
threads.  It is far more likely to be your application than Tomcat causing
the problem.

Take two thread dumps some time apart and see what has changed.

- Peter


Re: Log files? - [solved]

2010-01-17 Thread Peter Crowther
2010/1/17 Hassan Schroeder hassan.schroe...@gmail.com:
 You're welcome to your opinion, but personally I think the whole
 splatter-files-all-over-the-system repackaging approach is horribly
 flawed for apps like Tomcat
[...]

Tomcat has a very strong view on where its files should live.
Some OSs have very strong views on where particular kinds of files should live.
The two views are at odds.

There are three ways of dealing with this:
Neither OS nor Tomcat teams do anything (leaving users and
re-packagers to deal with the mess).
OS teams become more flexible over file placement.
Tomcat team becomes more flexible over file placement.

I suspect - without proof - that adding in that flexibility to Tomcat
using a well-defined configuration file would take less of the
committers' time than the time that is consumed debugging problems
with repackaged Tomcats now.

- Peter

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



Re: Tomcat + Apache + AJP = high cpu usage:/

2010-01-15 Thread Peter Crowther
2010/1/14 pionier pionierp...@interia.pl:
 Linux vs4160 2.6.22-vs2.2.0.7-gentoo #4 SMP Mon Jul 27 01:53:39 Local time
 zone must be set--see zic  x86_64 AMD Phenom(tm) II X4 810 Processor
 AuthenticAMD GNU/Linux

Thanks.  OK, you've got a few options here.  This is all because a
process can only bind to a port  1024 on Unix if it's running as root
at the instant it binds.

- Fix your current configuration.  You're presently using
mod_proxy_ajp to pass data between httpd and Tomcat , which is less
mature than mod_jk.  mod_jk takes a bit of setting up, but that would
let you keep httpd if you want to.

- Run Tomcat as root and set up an HTTP Connector on port 80.  Not
good for security!

- Run Tomcat as non-root, set up an HTTP Connector on port 8080, and
configure the Linux kernel firewalling to redirect port 80 to port
8080.  Probably easier than setting up httpd, but it has a few
irritating features like having to set proxyPort on the connector.

- Start Tomcat using jsvc (see the section on Unix daemon at
http://tomcat.apache.org/tomcat-6.0-doc/setup.html for details) and
set up an HTTP Connector on port 80.  This allows you to start Tomcat
in a way that it can bind to port 80, but you then run it as an
unprivileged user (using the --user option to jsvc).  This is secure
and doesn't require stuff like proxyPort.

- Peter

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



Re: Tomcat + Apache + AJP = high cpu usage:/

2010-01-14 Thread Peter Crowther
2010/1/14 pionier pionierp...@interia.pl:
 When i configured Tomcat to work with Apache
 I discovered that immediately after  i run Apache, Tomcat i using 100% of
 cpu usage ;/
 can someone tell me whay is this happening ?

Apart from one guess, not without a lot more information or Andre's
Internet Telepathy add-on ;-).

The guess: You've defined an AJP connector in Tomcat's configuration,
but you're not using that from httpd.  You're using mod_proxy to
forward requests from httpd to Tomcat, but there's no HTTP connector
to receive them.

If this doesn't help, we could use a few more bits of information:
OS?
JVM version?
Apache httpd version?
Tomcat version?
Which process is using all the CPU?
Do you use httpd for anything else?
Does high CPU use start immediately, or after a request to httpd or Tomcat?

- Peter

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



Re: Overwriting and not overwriting when re-deploying a warfile

2010-01-14 Thread Peter Crowther
2010/1/14 Ludwig Magnusson lud...@itcatapult.com:
 I have a problem when i deploy a new version of my webapp. I want some of
 the files in my exisiting webapp to be overwritten, and I want some to be
 left as they are.
[...]
 Is this possible in any way?

Not if the files are stored directly under the webapp.

I believe the usual workaround is to store the files somewhere else
and add a Context to serve them.  You may need to investigate single
sign-on if users require authorisation to view particular files.

- Peter

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



Re: Tomcat dies suddenly (was JVM goes away)

2010-01-14 Thread Peter Crowther
2010/1/14 David kerber dcker...@verizon.net:
 Memtest86, which I believe is the same one Peter suggested (or at least a
 variation of it).  It just loops continuously until stopped.

I suggested memtest86+ (http://www.memtest.org/).  Memtest86
(http://www.memtest86.com/) is also available; I moved to the +
version when Chris Brady stopped development of the original for a
period.  The core tests are very similar, doing things like looking
for stuck bits (always 1 or always 0) or bits whose state can be
influenced by their neighbours'.

- Peter

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



Re: Tomcat + Apache + AJP = high cpu usage:/

2010-01-14 Thread Peter Crowther
2010/1/14 pionier pionierp...@interia.pl

 Tomcat :
 6.0.20
 Im useing apache only for transfering request from 80 to 8080
 High CPU usage starts exacly the same time i start apache...

 Then uninstall httpd, set up an HTTP connector on port 80 on Tomcat, and
run just Tomcat.

- Peter


Re: Tomcat + Apache + AJP = high cpu usage:/

2010-01-14 Thread Peter Crowther
2010/1/14 pionier pionierp...@interia.pl

 that is imposible... my virtual unix account do not allow that :/

 OK.  I noticed you didn't tell us before what OS you were running on.

Please tell us about the operating system you're running on.  At the moment,
we're guessing.

- Peter


Re: Tomcat dies suddenly (was JVM goes away)

2010-01-13 Thread Peter Crowther
Very difficult to know what the problem is.  One thing you can now do
(as you've switched to another production server) is to run a memory
test across the bad server.  A T110 doesn't use error-correcting
memory, as I recall, so a dodgy bit could cause problems.  Give it a
couple of hours with memtest86+ and you'll at least know whether
you've been chasing phantoms due to a hardware error.

(I'm perhaps biased - I've had memory errors on three low-end servers now)

- Peter

2010/1/13 Carl c...@etrak-plus.com:
 From the original posting:

 This is a new server, a Dell T110 with a Xeon 3440 processor and 4GB memory.  
 I have turned off both the turbo mode and hyperthreading.

 The environment:

 64 bit Slackware Linux

 java version 1.6.0_17
 Java(TM) SE Runtime Environment (build 1.6.0_17-b04)
 Java HotSpot(TM) 64-Bit Server VM (build 14.3-b01, mixed mode)

 Tomcat: apache-tomcat-6.0.20

 These are the current JAVA_OPTS=-Xms1024m -Xmx1024m -XX:PermSize=368m 
 -XX:MaxPermSize=368m

 In the previous posting, I noted that I have observed the memory usage and 
 general performance with Java VisualVM and have seen nothing strange.  GC 
 seems to be performing well and the memory rarely gets anywhere near the max. 
  New information: I thought I was seeing GC as memory usage was going up and 
 down but in fact it was mostly people coming onto the system and leaving it.  
 After several hours, the memory settles to a baseline of about 375MB.  Forced 
 GC never takes it below that value and the ups and downs from the people 
 coming onto and leaving the system also returns it to pretty much that value. 
  The maximum memory used never was above 700MB for the entire day.

 The server runs well, idling along at 2-5% load, except for a quick spike 
 during GC, serving jsp's, etc. at a reasonable speed.  Without warning and 
 with no tracks in any log (Tomcat or system) or to the console, the JVM will 
 just go away, disappear.  New information: The JVM does not just go away but 
 somehow Tomcat shutsdown as the ports used by Tomcat are closed (pointed out 
 by Konstantin.)  Sometimes, the system will run for a week, sometimes for 
 only several hours.  Initially, I thought the problem was the turbo or 
 hyperthreading but, no, the problem persists.

 When Tomcat shuts down, the memory that it held is still being held (as seen 
 from top) but it is nowhere near the machine physical memory.

 The application has been running on an older server (Dell 600SC, 32 bit 
 Slackware, 2GB memory) for several years and, while the application will 
 throw exceptions now and then, it never crashed.  This lead me to believe the 
 problem had something to do with the 64 bit JVM but, with without seeing 
 errors anywhere, I can't be certain and don't know what I can do about it 
 except go back to 32 bit.

 New information.

 Last evening, I observed the heap and permGen memory usage with Visual JVM.  
 It was running around 600MB before I forced a GC and 375MB afterward.  Speed 
 was good.  Memory usage from top was 2.4GB.  Five minutes later, Tomcat 
 stopped leaving no tracks that I could find.  The memory usage from top was 
 around 2.4GB.  The memory usage from Visual JVM was still showing 400MB+ 
 although the Tomcat process was gone.  I restarted Tomcat (did not reboot) so 
 Tomcat had been shutdown gracefully enough to close the ports (8080, 8443, 
 443.)  Tomcat stayed up for less than an hour (under light load) and stopped 
 again.  The memory used according to top was less than 3GB but I didn't get 
 the exact number.  I restarted it again (no server reboot) and it ran for the 
 rest of the night (light load) and top was showing 3.3GB for memory this 
 morning.

 I brought up a new server last night and have switched to that server for 
 production (same Linux, JDK, server.xml, JAVA_OPTS, etc.).  It would seem if 
 the problem is with my application or the JVM, that the problem will follow 
 me to the new server.

 Anyone have any ideas how I might track this problem down?

 Thanks,

 Carl

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



Re: Tomcat dies suddenly (was JVM goes away)

2010-01-13 Thread Peter Crowther
2010/1/13 Christopher Schultz ch...@christopherschultz.net:
 On 1/13/2010 8:49 AM, Peter Crowther wrote:
 Very difficult to know what the problem is.  One thing you can now do
 (as you've switched to another production server) is to run a memory
 test across the bad server.

 Usually, I would agree that physical memory problems are likely to be a
 problem, but every time I've had a physical memory problem (much more
 common than I'd like to admit!), the JVM has crashed in a more classic
 way: that is, with an hs_log file and almost always with a SIGSEGV,
 rather than this phantom thing described by Carl.

 The Linux OOM killer might be a suspect, except that the process is
 apparently not dying, which is very strange.

[...]
 The whole thing sounds weird. :(

Oh, I agree entirely - usually something will turn a reference bad and
you'll get a memory access somewhere off in hyperspace during a GC.
But it's an easy thing to check, and there is an (admittedly small)
possibility of seeing these symptoms.  Heck, with hardware errors
there's a small probability of seeing pretty much *any* symptoms.

- Peter

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



Re: Tomcat dies suddenly (was JVM goes away)

2010-01-13 Thread Peter Crowther
2010/1/13 David kerber dcker...@verizon.net:
 Make sure you let it run for quite a while.  I've had memory failures show
 up as late as 11 passes into a test run.

That's dedication - I usually end up stopping it after a couple of
runs.  Thanks David, I've learned something!

- Peter

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



Re: JVM goes away

2010-01-11 Thread Peter Crowther
2010/1/11 Carl c...@etrak-plus.com:
 This is a new server, a Dell T110 with a Xeon 3440 processor and 4GB memory.  
 I have turned off both the turbo mode and hyperthreading.

 The environment:

 64 bit Slackware Linux

 java version 1.6.0_17
 Java(TM) SE Runtime Environment (build 1.6.0_17-b04)
 Java HotSpot(TM) 64-Bit Server VM (build 14.3-b01, mixed mode)

 Tomcat: apache-tomcat-6.0.20

 JAVA_OPTS=-Xms2400m -Xmx2400m -XX:PermSize=512m -XX:MaxPermSize=512m

 I have watched observed the memory usage and general performance with Java 
 VisualVM and have seen nothing strange.  GC seems to be performing well and 
 the memory rarely gets anywhere near the max.

 The server runs well, idling along at 2-5% load, serving jsp's, etc. at a 
 reasonable speed.  Without warning and with no tracks in any log (Tomcat or 
 system) or to the console, the JVM will just go away, disappear.  Sometimes, 
 the system will run for a week, sometimes for only several hours.  Initially, 
 I thought the problem was the turbo or hyperthreading but, no, the problem 
 persists.

 When the JVM goes away, the memory that it held is still being held (as seen 
 from top) but it is nowhere near the machine physical memory.

 The application has been running on an older server (Dell 600SC, 32 bit 
 Slackware, 2GB memory) for several years and, while the application will 
 throw exceptions now and then, it never crashed the JVM.  This leads me to 
 believe the problem has something to do with the 64 bit JVM but, with errors, 
 I can't be certain and don't know what I can do about it except go back to 32 
 bit.

 I plan to reinstall Java tonight but, it would seem if the JVM were 
 corrupted, it simply would not run.

 Any ideas are welcome.

I'm with Andy: the Linux OOM killer would show those symptoms.  With
those settings, you're not leaving a lot of memory for the OS.  How
much swap do you have, and does the same thing happen if you reduce
the Java heap and permgen space?

- Peter

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



Re: How to change effective user id on Windows

2010-01-08 Thread Peter Crowther
2010/1/8 Amit Agarwal ami@gmail.com:
 HOw do we start TOmcat programatically using Bootstrap.start() API if we
 need to pass the user ?

You don't do it that way ;-).

By the time you start the Java virtual machine (JVM) that runs Tomcat,
that JVM must *already* be running as the user you want to use for
Tomcat.

If you're running Tomcat as a service, then commons-daemon (procrun,
renamed to tomcat6w.exe, as Chuck points out in another thread) does
exactly this.  It's a C program that wraps up the launch and
management of the JVM.  It makes sure that the JVM is launched as
whatever user is required.

If you're starting the JVM yourself, then you must make sure yourself
that whatever you use to launch Tomcat runs it as the correct user.
This may be as simple as logging in as that user and running a batch
file.

- Peter

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



Re: Incompatabilities?

2010-01-08 Thread Peter Crowther
2010/1/8 Alexander Skwar alexanders.mailinglists+nos...@gmail.com:
 Besides the load issue, they claim, that a different app of theirs doesn't
 work with Tomcat, but it's supposed to work with WebLogic and jBoss. Am
 I right in assuming, that this is most probably caused by bugs in their app,
 which (somehow only) get triggered by Tomcat?

Maybe!

Tomcat is a servlet container, implementing the Servlet spec (actually
specs; there are several versions).  If the supplier's application
doesn't run on Tomcat, it's not Servlet spec-compliant *or* is not a
pure servlet; it is instead relying on implementation-dependent
behaviour outside the Servlet spec that WebLogic and JBoss implement,
or requires J2EE support that those containers provide but Tomcat does
not.

If it's a pure servlet but is not Servlet spec-compliant, that is at
best a misfeature and at worst a bug.

If it requires J2EE features, then you shouldn't be trying to run it
under Tomcat or any other pure servlet container; you need a J2EE
container instead.  JBoss (which is based on Tomcat) has a Community
server which is free, as far as I can see.  I've not used it, but
there are certainly people on this list who use it on a regular basis.

- Peter

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



Re: High Load examples?

2010-01-07 Thread Peter Crowther
2010/1/7 Alexander Skwar alexanders.mailinglists+nos...@gmail.com:
 Right now, we're using Bea WebLogic as our application server. We'd like to
 change to Tomcat 6. Now the creator of the application being run on the
 App Server said, that Tomcat works very well under low usage / low load
 situations. But if there are many (unsure about the definition of
 many...)
 users, Tomcat might tend to not perform so well anymore.

 I suppose many might mean like 50-100+ concurrent users using the App
 or system at the same time.

 Now I'm wondering, if that's actually true - does Tomcat not perform well
 anymore, if there are many users using it? Does anyone of you maybe have
 real world examples of high profile / high load sites using Tomcat (6)?

University of Leeds routinely had 100+ active users on its Bodington
VLE, and I'm aware of Sakai sites that load-balance across 4-8 Tomcat
application servers that can serve around 5,000 concurrent users.

A correctly configured Tomcat has no problem at high loads.  It's
barely possible your application creator might be talking in code for
the following: Something in WebLogic means that our application runs
fine, whereas something in Tomcat tickles a bug in our application
that means it doesn't scale.  This isn't unusual - unless an
application is tested under many containers, it's very common for a
platform dependence to creep in.

- Peter

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



Re: How to change effective user id on Windows

2010-01-07 Thread Peter Crowther
2010/1/7 Amit Agarwal ami@gmail.com:
 Tomat on Linux starts as root to bind to
 port 80, and then switches effective user id to nobody. Windows does not
 appear to have concept of changing effective user. Tomcat service runs
 as a local system on Windows. Need to change the user for Tomcat
 after binding to port 80.

 How can this be achieved?

Just start Tomcat as the non-system user on Windows.  Windows does not
prevent any process binding to privileged ports.

- Peter

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



Re: How to change effective user id on Windows

2010-01-07 Thread Peter Crowther
2010/1/7 Looijmans, Mike mike.looijm...@oce.com:
 The current configuration is correct in terms of security - the 'SYSTEM'
 user is a limited account that has no access to the desktop nor shared
 network resources.

Sorry to pick you up on this one, Mike, but I think you're thinking of
Local*Service*, not Local*System*.  LocalSystem has full
administrative access to the local computer, including (for example)
being able to write a rogue DLL to a spare directory, then amend the
registry so that that DLL is loaded by every process that runs on the
machine from this point onwards.  Or create a new local account that
*does* have desktop access and spawn a process running as that user.
If you can compromise LocalSystem, you've got the machine.

Windows' LocalSystem is very, very close to Unix's root.  If you want
a non-privileged account, use LocalService not LocalSystem.  See, for
example 
http://blogs.msdn.com/jmanning/archive/2008/04/06/localsystem-root-localservice-nobody.aspx

- Peter

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



Re: How to prevent Tomcat 5.5 from undeploying applications

2010-01-07 Thread Peter Crowther
2010/1/7  jean-claude_carri...@ibi.com:
 We have a Tomcat 5.5.17 with a approot.xml file in
 conf\Catalina\localhost just pointing to a shared disk location
[...]
 How can we prevent this from happening, because whenever the disk is
 back online, someone has to manually copy back the context root into the
 location.

Use reliable, and hence local, storage.  If you *have* to have the
master copy on a network drive, you could keep your applications on
G:\ibi but set up Windows file replication so that there's a replica
on the Tomcat server.

- Peter

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



Re: Toggling

2010-01-06 Thread Peter Crowther
What is the trigger to toggle a web application?

What is the result of toggling the web application?  If it is toggled to
https, does it suddenly become available to all users on https and
unavailable to all users on http?

- Peter

2010/1/6 Nikita Manohar nikita.mano...@gmail.com

 I would like to know if an entire web application can be toggled between
 http and https in Tomcat.

 Thank you,
 -Nikita



Re: Toggling

2010-01-06 Thread Peter Crowther
2010/1/6 Nikita Manohar nikita.mano...@gmail.com

 The trigger here is suppose in a web application there is a welcome page
 which is to be re-directed to a user's homepage after login. The secure
 information (login page) should be toggled to https and the rest as http.

 Is it possible to do so automatically?

 This is asked fairly regularly on this list - search the archives for
secure login and I suspect you'll come up with many examples.

However, I think you have a security problem with your application.  Is the
user's session identity somehow less valuable than the user's password?  If
the session identity is stolen after login (easy over normal HTTP - just
sniff the cookie or the URL, whichever contains the session ID) then an
attacker can do anything the user could do.  Is this an acceptable security
risk?  If not, you should simply run everything over SSL.  With modern
processors and typical web applications, the extra CPU cycles required for
SSL at the server are rarely a concern.

- Peter


Re: ClassCastException in tomcat 6

2010-01-04 Thread Peter Crowther
2010/1/5 test123456 sajith...@thinkcoretech.com

 I put the jackrabbit.war file into the webapps.

 I have a new test project which will access the jackrabbit.war through the
 JNDI lookup.

 In server.xml i have a global jndi resource.
 and the tomcat lib directory contain all the required jar files.

 In the test project , i am able to get the JNDI resource and lookup()
 returns a org.apache.jackrabbit.core.jndi.BindableRepository object

 When i try to cat this to org.apache.jackrabbit.api.jsr283.Repository
 object
 , it throws the ClassCastException .

 I suspect you have the same class defined twice: once in jackrabbit.war,
once in Tomcat's lib directory.  The version loaded by JNDI will be from
lib, the version from the webapp will be the one from jackrabbit.war.
Because they are loaded by different classloaders, they are *different*
classes and are not castable even though they have the same name.

If this is the issue: to fix it, ensure no duplicate classes are defined.
This may require removing a number of jars from the war file.

- Peter


Re: How to access files in network drive

2010-01-03 Thread Peter Crowther
2010/1/3 WM C doublecr...@live.com

 In my web app, I need to read files from a network drive folder, which has
 access restriction (my account is permitted).

 During development time, since I am using Eclipse and Tomcat is integrated
 inside, so both were run under my account, everything works fine, but when
 deployed onto a testing server, where Tomcat runs using a system account,
 file access was denied.

 How to resolve this problem? Is there a way when accessing file, I can pass
 in a user identity as parameter, or log on first just like access
 database? Seems java File API does not have this option.

 Java is intended to be portable to different OSs.  Some don't allow what
you want, so the File API doesn't provide it.

You will have to resolve the problem through configuration.  Run Tomcat on
the testing server as a user that has access to the network drive folder.
You could do this either by changing the user ID under which Tomcat runs on
the testing server, or by granting the test Tomcat's user ID access to the
network drive folder.

- Peter


Re: How to access files in network drive

2010-01-03 Thread Peter Crowther
2010/1/3 WM C doublecr...@live.com

 The problem is that now we have two web apps, each needs to access
 different drive, each drive has different user access control list - in this
 case, running Tomcat using one user will only make one app work, while fail
 another (for security reason, we cannot allow one user to access both
 drives).

 So looks like I have to run two Tomcat instances?

 If your security policy insists on that separation, you should run two
Tomcat instances, yes.  Running one Tomcat instance that can access both
drives is *itself* a security risk, as then any user who can control that
Tomcat instance can access both drives, which your security policy forbids.

The alternative is to review your security policy.  Most organisations I've
seen will go for the most fantastic, long-winded and often incredibly
insecure technical solutions rather than review their existing security
policy in the light of new organisational requirements.

- Peter


Re: TomCat multiple ssl support

2009-12-29 Thread Peter Crowther
2009/12/29 DOrlov dor...@redaril.com


 Hello, I have TomCat 6 server and I have 3 SSL sertificates for:

 1. p.domain.com
 2. p1.domain.com
 3. p2.domain.com

 I would like to use all 3 on 1 SSL connector (Don't create 3 SSL
 connectors)
 I'm using keytool app and kestore SSL logic for TomCat SSL configuration.

 As far as I know, the HTTP spec doesn't allow this.  The certificate must
be chosen and sent by the server to encrypt the connection before the host
header is sent by the browser over the encrypted connection.  Therefore, the
server cannot choose the certificate to send.  You'll need different
connectors, either on different IP addresses or different ports.

Happy to be corrected if someone knows better!

- Peter


Re: Can I make my servlet wait/delay for... maybe 500 - 1000 ms

2009-12-17 Thread Peter Crowther
2009/12/17 Ingo Gambin igam...@brilliant.de

 Basically with already existing pdf-files that works fine, but checking
 the whole procedures inserting timing-outputs I realized that, although
 the extraction method is done and the next methods are called, itext (or
 the system) is still writing the file to directory B and therefore when
 the browser tries to embed it (adobe plugin) its not fully written and
 the adobe plugin can not read it because of that.


I'm surprised, as I didn't think itext used background threads in order to
write a document.  Certainly I've never had a problem with this, though I
may just have been lucky!  Is the directory on the same machine, or is it
remote?  If remote, network bandwidth/latency may be causing the issue you
describe.


 now I wonder how to solve that problem. So to my ideas:
a) only continue after extraction when the file is fully written
= Actually I have no idea about how to check that


I'd ask Bruno and co on the itext list how you would know that itext has
finished.


b) have the servlet wait/sleep for maybe up to a second
= from what I found so far, sleeping a servlet is NOT
good and on the other hand what if one pdf-page i want
to extract is so big/has so many graphics in it that the
process lasts longer than a second

 Not good is a generalisation; let's look at the specifics.  First off,
you're not sleeping a servlet; you're sleeping a thread.  Sleeping a
thread means that the request being handled by that thread takes longer to
complete.  Therefore, the thread is returned to the pool later.  Therefore,
more threads are needed to achieve the same throughput.  This is only a
problem if your server can't handle the extra load.

I wouldn't just throw sleep calls around the code like they were confetti,
but I'll confess to having one place in my own code where a HTTP request has
to wait for an external executable to complete its task and write some rows
into a relational database.  Unfortunately the only approach here is to
poll: repeatedly try to retrieve the I'm done row, sleeping a while
between each test.  It works well enough, until we get a better
architectural solution to the problem.

- Peter


Re: Ask about an architecture of High Availability with Tomcat and Apache

2009-12-17 Thread Peter Crowther
Why are you using httpd - what purpose is it serving other than to act as a
load-balancer to Tomcat, which you should be able to do directly from the
Cisco load balancer?

2009/12/17 Peter Chen peter.c...@aicent.com

 Hi,



 I made architecture of High Availability with Tomcat and Apache, here I
 will describe it simply.



 USERS

 |

 INTERNET

 |

 Firewall

   |

  CSS

 /  \

   / \

   Apache  Apache

 HTTP Server HTTP Server

  \/

\  /

 Firewall

 /  \

   / \

   Tomcat  Tomcat

   \/

 \  /

 DataBase(Master)DataBase(Slave)



 The CSS is a product of Cisco, and I put it in front of Apache HTTP
 Server, I use it to implement the function of load balancing for Apache
 HTTP Server.



 There are two firewalls, and I put two Apache HTTP Servers between them
 to implement load balancing and reverse proxy.



 Behind these two firewalls, I put two Tomcat servers as rare-end
 servers.



 I want to know does this architecture widely used?

 Could someone give me some instances of using this architecture? For
 example, the company name, the project name?



 Some people tell me that, it's better to use hardware to implement the
 function of load balancing between Apache HTTP Server and Tomcat instead
 of configuring Apache.

 I am not sure, could someone analyze it for me?



 Thanks








Re: Tomcat gets not enough memory on vServer

2009-12-17 Thread Peter Crowther
2009/12/17 Lars Fischer lfisc...@fast-mail.org

 I have some trouble with a Tomcat running on a vServer Ubuntu 8.04:

 I used an old vServer with 768MB RAM. On this machine I had a Tomcat
 running using -XX:MaxPermSize=128m -Xmx256m settings. Tomcat consumed
 the given memory and was working fine.


Was that a 32-bit or 64-bit machine, and a 32-bit or 64-bit Java VM?


 Now I switched to a new vServer machine with 1024MB RAM.


Is that a 32-bit or 64-bit machine, and a 32-bit or 64-bit Java VM?


 I installed the
 latest JDK6, downloaded latest Tomcat6 and started it. As result the
 htop-
 command shows me a virtual memory consumption of 512MB. Together with
 additional MySql and httpd the new machine needs much more memory than
 on the old machine and sometimes my webapps fail with something like
 java.io.IOException: Cannot run program env: java.io.IOException:
 error=12, Cannot allocate memory

 This is annoying: the new machine with more RAM gets not enough
 memory...

 Where is my mistake? Is it a problem of the vServer?

 I'm guessing slightly, but 64-bit VMs take somewhat more memory as all
pointers (and hence all Java references) are 8-byte rather than 4-byte
quantities.  If you've moved from 32-bit to 64-bit, your memory use will
definitely increase.

Also... what else has changed?  New Tomcat version (what was the old one?),
new Java version? (what are the old and new versions?), new MySQL version,
new OS version?

- Peter


Re: Tomcat 6 and IIS 7

2009-12-16 Thread Peter Crowther
2009/12/15 Tuan Quan tuan_q...@yahoo.com

 However, then Tomcat stop, and IIS start, running netstat -an got below:
 TCP[::]:80[::]:0 LISTENING

 Even though, I set IIS to bind to one IP, run IE on the machine to both IP
 addresses gave me IIS page.

 OK, there's your problem.  I don't know IIS7 very well, but I would expect
a solution to exist for that issue.  It's an IIS issue, so I suspect this
list won't be much more help to you.

If you have more than one site on IIS7, I'd check them all just to make sure
you don't have one bound to all IPs.  However, I suspect you've already done
that!

- Peter


Re: Trying to access a directory outside docBase... is it possible ?

2009-12-15 Thread Peter Crowther
2009/12/15 André Warnier a...@ice-sa.com

 But maybe you could just create a link, inside your deployment directory,
 to the mount ?

 /opt/Tomcat/webapps/myApp/docs -- /opt/document-repository

 If you're going to do this, be Very Very Careful.  Tomcat doesn't follow
symbolic links by default, even on UNIX.  This is for a very good reason: if
you do this, Tomcat *will* follow the symlink and delete your PDFs when you
undeploy your webapp.

You probably don't want this to happen.

This is a common enough use case (it comes up about once a month on the
list) that Someone may have coded a quick serve the content from this
directory servlet, probably based on the root webapp.  Chris?  You're
generally the coder with quick hacks already developed...

- Peter


Re: Limit user sessions in tomcat

2009-12-15 Thread Peter Crowther
2009/12/15 André Warnier a...@ice-sa.com

 On another level, I don't quite understand yet how this squares with the
 fact that most browsers will not establish more than 2 connections with the
 same webserver at the same time.  It seems a bit difficult to imagine that
 one single user can crash a Tomcat just by repeatedly hitting the same
 link.

 As far as the browser's concerned, clicking a link while a request is
pending cancels the previous request (and generally closes the socket) and
opens a new one.  So it only has one connection open at any one time.

As far as Tomcat's concerned - as shown by the recent emails on the topic -
there's no way of detecting that closed socket and stopping its thread from
trying to service it.  So old requests build up, unwanted but impossible to
discard until they complete or try to write something to the (closed)
socket.

- Peter


Re: Limit user sessions in tomcat

2009-12-15 Thread Peter Crowther
2009/12/15 Chetan Chheda chetan_chh...@yahoo.com

 Is there a 3rd party tool available to manage tomcat sessions and kill
 them once they go rogue?

 Can I just check two pieces of terminology?

In Tomcat (and many other web servers), a session is the notion that a
user will make multiple requests to the server from the same browser over
time.  It's also used to refer to any data that the application keeps
between these requests from the same user.  I'm not aware of a way that a
session could go rogue except by getting more and more data stored in it -
in which case, it's time to file a bug report with your external development
house and tell them to fix the leaky code!

A single request to the server is one HTTP request from the browser* to
the server, and the response from server to browser.  This can cause
problems if it takes a long time to service.  Each request uses one thread
while it is being serviced, then that thread is returned to the pool once
the request completes.  I'm not aware of any tool that will allow you to
kill threads in the middle of a request if they go rogue.

Are you having problems with rogue (large) sessions, or with rogue
(long-running) requests?

- Peter

* Yes, to the pedants out there, I know this should more generally be called
a user-agent or even a client, as so many HTTP requests now come from web
services.


Re: Tomcat 6 and IIS 7

2009-12-10 Thread Peter Crowther
Stop both, netstat -an - is there anything active on port 80?  If so, find
it and terminate with extreme prejudice ;-).

Start Tomcat.  netstat -an - what address(es) does it report Tomcat as being
bound to?  Are they what you expect?

Stop Tomcat, start IIS7, netstat -an again - what address(es) does it report
IIS as being bound to?  Are they what you expect?

If all of those are what you expect, please come back to the list and I'll
have another think!

- Peter

2009/12/10 Tuan Quan tuan_q...@yahoo.com

 Hi all,
 I have a problem getting both Tomcat 6 (running on port 80) and IIS 7
 (also, on port 80 - But different IP address)
 The server has two IP addresses.
 and I'd like to dedicate each IP to Tomcat and IIS.
 I'm able to assign Tomcat to only ONE IP address.
 Then went to IIS 7 to bind it to the other IP address - however, once
 Tomcat started, IIS 7 does not work - even though I specifically set it to
 listen to a different IP than the Tomcat.
 Any idea would be very appreciated.

 Thanks.
 Tuan



Re: deployed same TOMCAT 6.0.20 on Windows / Linux

2009-12-09 Thread Peter Crowther
2009/12/9 Karthik Nanjangude karthik.nanjang...@xius-bcgi.com

 We have deployed  same  TOMCAT  6.0.20on Windows /  Linux


Just to check: in both cases, you downloaded the same installation files
from http://tomcat.apache.org and installed them?

Exactly the same JVM revision on both machines?

Exactly the same hardware configuration on both machines?

Exactly the same amount of memory given to Tomcat on both machines?



 1)   In case of Windows the Catalina. out is not generated  in
  /log  folder  while  on Linux the same is generated on every start
 2)   Tomcat on windows is Slow compared to Linux  in request /response


I could crack jokes about Windows 2000 here, but I won't ;-).



 Why is this ?



 Os/  :  Windows 2000 / Linux
 JDK   1.5


Which revision on each machine?


 TOMCAT 6.0.20

 - Peter


Re: db jars in common/lib and shared/lib

2009-12-09 Thread Peter Crowther
2009/12/9 Mohammad, Hammad Kasim Bekur hammadkasimbekur.moham...@misys.com

 I have placed my db jars(ie db2jcc.jar, db2jcc_javax.jar and
 db2jcc_license_cu.jar )  in tomcat/common/lib, and started ant target to
 run the tomcat, server started up properly.

 Now I have removed these jar from common/lib and put under shared/lib,
 server throws an error saying couldnot load the driver.

 Can you please let me know why it is working when it is in common/lib
 and why it is not working when it is in shared/lib directory?

 It would help to have a few more details about your setup:

Operating system?

Tomcat version?  The locations to put files have changed over the years.

Is this Tomcat installed from http://tomcat.apache.org or is it a repackaged
version that came with your operating system?

- Peter


Re: deployed same TOMCAT 6.0.20 on Windows / Linux

2009-12-09 Thread Peter Crowther
2009/12/9 Karthik Nanjangude karthik.nanjang...@xius-bcgi.com

 Same Tomcat 6.0.20 from


 http://opensource.become.com/apache/tomcat/tomcat-6/v6.0.20/bin/apache-tomcat-6.0.20.zip


OK.


 RAM is  2 GB on Linux   on  Windows is 1.5 GB
 No extra applications are running when the same was executed


How much of that RAM is given to Tomcat in each case?


 Machine details

 Windows 2000
 4 CPU 2.66GHz
 Service Pack 4


OK.  I can't compare that to the Linux box, as you don't give the same
details.


 Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-b64)
 Java HotSpot(TM) Client VM (build 1.5.0-b64, mixed mode, sharing)


A couple of differences compared to the Linux box:

- A much older JVM, I think - this looks like the original 1.5 release,
compared to 1.5.0_18 on Linux.
- The client VM rather than the server VM is running.

I would expect both of these to slow down the Windows box.

Linux
 [r...@teleglb bin]# uname -o
 GNU/Linux

 [r...@teleglb bin]# uname -a
 Linux teleglb.xius.ltd 2.6.9-42.ELsmp #1 SMP Wed Jul 12 23:27:17 EDT 2006
 i686 i686 i386 GNU/Linux

 [r...@teleglb bin]# uname -i
 i386

 [r...@teleglb bin]# uname -p
 i686

 [r...@teleglb bin]# java -version
 java version 1.5.0_18
 Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_18-b02)
 Java HotSpot(TM) Server VM (build 1.5.0_18-b02, mixed mode)


None of this gives any information on number of processors, speed of
processors etc.

As Andre points out, you also don't give any information on the tests you're
running, which makes it difficult to know what you're actually comparing.
For example, if your webapp accesses an external database, the version of
the database software will make a massive difference.

What are you testing?


  Also, both Windows 2000 and Java 1.5 are in the no longer supported

 Off the topic - Does this mean Every Hardware /S/w for 6 months needs
 replacement

 No, but it means you're on your own if something goes wrong.  As with all
businesses, yours needs to trade off the expected cost of upgrade (including
the disruption) with the expected cost of supporting the old versions.

I'm not arguing with you - I still see the odd NT 4.0 box, and several
Windows 98s ;-).

- Peter


Re: Tomcat Config Question

2009-12-09 Thread Peter Crowther
2009/12/9 steflik stef...@binghamton.edu


 I'm teaching a Web Programming course and am using Tomcat 6 for the
 servlet/jsp portion of the course. I have created a context for each
 student
 in the server.xml file and it seems to work pretty good but if a student
 modifies the web.xml file in their application I have to restart the sever
 before it takes effect. Is there a way to configure Tomcat so that changes
 in a users web.xml file will be automatically sensed by the server and take
 effect immediately?

 Dick, I think others have commented on creating separate context files and
adding watched resources.  I'll just add the point that if I know student
code, it's going to be buggy.  This could be a bigger problem than in many
web development environments.  All the webapps in a servlet container run in
the same JVM, and they're not defended from each other.  If someone runs the
JVM out of heap, it's gone for everyone; if a request runs forever, that
thread's locked until the server restarts; if someone puts if
(errorCondition) { System.out.println(Oops, I can't carry on from here);
System.exit(1); } then the server will suddenly stop.  Yes, you can fix the
last one of these with a security manager, but there really isn't any way of
defending against buggy student code.

If you're comfortable that you can survive under those circumstances, go for
it!

- Peter


Re: Tomcat performance benchmark

2009-12-07 Thread Peter Crowther
2009/12/7 Neil Aggarwal n...@jammconsulting.com

 Here is one that is somewhat dated:
 http://www.webperformanceinc.com/library/reports/ServletReport/

 Good grief, that's not so much dated as coming back from beyond the
grave!  It's two major versions and a lot of performance optimisations out
of date for Tomcat, and I assume about the same for the other containers
benchmarked.

Benchmarking current performance based on that report is rather like
assuming the current Formula 1 motor racing teams are showing similar
relative performance to their placing in the 1970s.

- Peter


[OT] Application speed (was Re: Tomcat performance benchmark)

2009-12-07 Thread Peter Crowther
2009/12/7 André Warnier a...@ice-sa.com

 On the other hand, it would be really interesting to compare the
 performance of a set of webservers 5 years ago, with the current ones, if
 the comparison is in terms of real-world application requests served.
 Granted, servers have become faster, memory and disk have become cheaper,
 bandwidth has increased, code may have been somewhat improved in the
 meantime.  But on the other hand applications have also gotten bloated in
 the meantime, so I am not quite sure that there would be that much
 difference in the end.

 I suspect you'd find that the application servers used similar numbers of
instructions on the common code paths, OSs varied a little but hadn't
bloated too much, and the cost/benefit trade-off of application developer
time against hardware cost was the same as ever: once the system is fast
enough, no more optimisation is done.  If the system becomes no longer
fast enough, another round of optimisation or hardware acquisition is
performed, depending on the expected costs of the two paths.

If you look at computers and application software as a means to an end,
rather than an end in itself, this is surely the most economically
appropriate way of constructing it?  Even though artisan and craftsman
programmers might like to pretend otherwise.

- Peter


Re: Setting up x planner plus using Tomcat

2009-12-07 Thread Peter Crowther
Given that the samples run fine, this doesn't look like a Tomcat issue.  I
suspect you'd have better luck on a MySQL, Hibernate or x-planner list.

I'm slightly bemused that the username in the error message is in UPPERCASE
when you've specified it in lower case - is something assuming particular
case-sensitivity on MySQL?

- Peter

2009/12/7 joe_sad joesadd...@gmail.com


 Hi,

 I am trying to configure Tomcat so that I can run x-planner plus on it.

 I have been following some tutorials but don't seem to be getting anywhere
 with it.

 Im getting what looks like some database errors when running Tomcat with my
 xplanner plus application in the web apps dir. If the xplanner app is not
 there then I do not getting any errors. Also the example applications seem
 to work fine.

 The errors that I am getting are sql.SQLException: User not found: XPLANNER

 I have created a user using this script in mysql

 GRANT ALL PRIVILEGES ON xplanner.* TO 'xplanner'@'localhost' IDENTIFIED BY
 'xp' WITH GRANT OPTION;

 Also in the xplanner file :
 xplanner.properties 
 xplanner-custom.properties

 I have changed the connection part to this:

 # Hibernate MySQL Configuration
 hibernate.dialect=com.technoetic.xplanner.db.hibernate.XPlannerMySQLDialect
 hibernate.connection.driver_class=com.mysql.jdbc.Driver
 hibernate.connection.dbname=xplanner
 hibernate.connection.url=jdbc:mysql://localhost/
 hibernate.connection.username=xplanner
 hibernate.connection.password=xp
 xplanner.migration.databasetype=mysql

 xplanner.migration.patchpath=patches:com.technoetic.xplanner.upgrade:com.technoetic.xplanner.security.install

 Any advice would be much appreciated

 Thanks in advance
 --
 View this message in context:
 http://old.nabble.com/Setting-up-x-planner-plus-using-Tomcat-tp26680216p26680216.html
 Sent from the Tomcat - User mailing list archive at Nabble.com.


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




Re: Basic and Form Authentication

2009-12-01 Thread Peter Crowther
2009/12/1 Anthony Jay anthony...@fastmail.fm:
 As for cross application communication I will have to revisit our own
 code to see if there are static/singleton services that can be
 re-engineered and decoupled.

This may be one of the few appropriate times where you may want to put
code for the singletons (and all the classes that might be referenced
by your singletons) in common/lib.  It's not an ideal solution, but it
may save you considerable effort as those classes will then be loaded
by a single classloader, rather than the per-webapp classloaders.

- Peter

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



Re: Safe to move tomcat directory while tomcat running?

2009-12-01 Thread Peter Crowther
2009/12/1 Dean Chester dean.g.ches...@googlemail.com:
 Ok thanks what i meant is that the tomcat directory is in
 ~/tomcat6/apache-tomcat-6.0.20/ and i need to move it to my home directory
 ~/. Basically was it safe to do it while tomcat is still running.

No, that is not safe.  Tomcat may access any file in a webapp at any
time, plus files in its work area.

- Peter

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



Re: How to solve the problem java.lang.OutOfMemoryError: unable to create new native thread in Tomcat5.5.26

2009-11-30 Thread Peter Crowther
2009/11/30 Peter Chen peter.c...@aicent.com:
 I meet one problem of OutOfMemoryError when I am running the
 Tomcat5.5.26. The OS is Solaris 10 sparc, and the JVM version is
 1.5.0.12, and following is the detail of stack information.

 SEVERE: Caught exception (java.lang.OutOfMemoryError: unable to create
 new native thread) executing
 org.apache.tomcat.util.net.leaderfollowerworkerthr...@958b36,

 terminating thread

 Exception in thread SIGTERM handler java.lang.OutOfMemoryError: unable
 to create new native thread

       at java.lang.Thread.start0(Native Method)
       at java.lang.Thread.start(Thread.java:574)
       at java.lang.Shutdown.runHooks(Shutdown.java:128)
       at java.lang.Shutdown.sequence(Shutdown.java:173)
       at java.lang.Shutdown.exit(Shutdown.java:218)
       at java.lang.Terminator$1.handle(Terminator.java:35)
       at sun.misc.Signal$1.run(Signal.java:195)
       at java.lang.Thread.run(Thread.java:595)

OK, so this seems to happen at a very particular point: when you're
shutting down your server via SIGTERM (so killing the process).
Something has registered a shutdown hook, and the call to create the
thread to run the hooks is failing.

Does this always happen, or is it intermittent?  If it always happens,
presumably we'll very quickly know if we've found a fix, as you can
start the server, stop it, and see that the problem doesn't happen.

If it always happens, does increasing the amount of heap memory
assigned to the JVM help?  It might do if the JVM's very low on heap
memory.  Does *de*creasing the amount of heap memory help?  It might
do if the JVM's very low on non-heap memory, as creating a new thread
requires space for things like the thread's stack, which are not part
of the heap.

What options are you starting the JVM with, and how much RAM do you
have on the box?  I'm particularly interested in your heap and stack
sizes.

What connector options do you have set in your conf/server.xml?  I'm
particularly interested in the number of threads you have configured,
and hence how much heap and non-heap memory is being used for threads.

Sorry to request so much information, but OOMEs aren't always the
easiest to debug!

- Peter

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



Re: Char Encoding text streams on Tomcat 5.5 and Linux

2009-11-27 Thread Peter Crowther
2009/11/27 Dan Bagley dan.bag...@metadatatechnology.com:
 now when processing the plain text stream the accented characters are being
 corrupted even though the stream is being set to UTF-8.   This is only
 happening on Linux and Tomcat 5.5 with plain text,  on windows it works and
 Linux using Tomcat 6.0 it works.

Dan, exactly which version(s) of 5.5 and 6.0 are you using?  Also,
which JVM are you using on each of these platforms?

I'm not sure I have a solution for the problem, but you're more likely
to get useful answers off the list if we have some reasonably precise
version information ;-).  If you're not testing on the latest 5.5.x
(which is 5.5.28), I've no doubt you'll also get a does it still fail
on the latest 5.5? question.

From your question, I'm assuming you have a need to support older
Tomcat versions rather than just say first install Tomcat 6.0.x.  Is
that due to customers having older versions installed, or QA issues,
or some other reasons?

- Peter

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



Re: Char Encoding text streams on Tomcat 5.5 and Linux

2009-11-27 Thread Peter Crowther
2009/11/27 Dan Bagley dan.bag...@metadatatechnology.com:
 Server version: Apache Tomcat/5.5.20

That's 2.5 years old and has a number of known security
vulnerabilities.  Given that the issue is the client's security review
process, have they reviewed later 5.5.x releases and verified that the
known issues aren't a problem for them?

 OS Name:        Linux
 OS Version:     2.6.9-78.0.13.ELsmp
 Architecture:   amd64
 JVM Version:    1.5.0_16-b02
 JVM Vendor:     Sun Microsystems Inc.

Just to check, does your working Linux / Tomcat 6.0 system have an
identical JVM on it (and are both JVMs 32-bit, or both 64-bit)?  I'm
just trying to eliminate other variables, such as JVM version and
platform.

 And yep this is a customer support issue as the later versions of Tomcat
 have not been approved through there security review process, so they're
 unable to move onto the later versions.

 I'll double check Tomcat 5.5.28, but there still may be issues with the
 client moving onto this release.

Good luck!  You have the misfortune of posting this on a US holiday
weekend, by the way, so you might get fewer responses than usual as
our New World friends are giving thanks for their turkeys and stuffing
;-).

- Peter

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



Re: Tomcat 5.17 crashes too often

2009-11-27 Thread Peter Crowther
2009/11/27 Rocco Scappatura rocco.scappat...@infracom.it:
 I think that I have forgotten to attach the core file above mentioned..
 :-(

This mailing list removes attachments.  Core files are often very
large, and they also don't provide very much information to anyone on
the list as we'd have to be able to reproduce your exact computer,
kernel, Java virtual machine and Tomcat environment - helpfully, you
haven't told us any of these, but even if you did probably nobody
would have an environment that matched yours.

So, given that we can't use the core file, what *can* we use?  Error
messages!  Look in Tomcat's log files for error messages that may be
related to the crash.  And... please tell us your operating system,
Tomcat version, Java version, and whether your Tomcat is running pure
Java connectors and applications, or whether you have any JNI code in
your applications or are running APR connectors.

- Peter

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



Re: Tomcat 5.17 crashes too often

2009-11-27 Thread Peter Crowther
2009/11/27 Rocco Scappatura rocco.scappat...@infracom.it:
 The strange think is that in log file there is no sign of any problem.
 But In $CATALINA_HOME I get the file hs_err_pidpid.log.

OK.  The Java virtual machine itself is crashing, and you've attached
the log file it writes from the crash.  Thanks - that's exactly what
we need!

 The content is:
[...]

 # Java VM: Java HotSpot(TM) Server VM (1.5.0_09-b01 mixed mode)

That is a very old Java virtual machine.

 # Problematic frame:
 [error occurred during error reporting, step 120, id 0xc005]

That looks like a problem!  If I read this correctly - and Chuck would
be able to say more about it - then the Java virtual machine is seeing
an error, is trying to report the error, and is crashing while
reporting the error.

 Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
 j
 net.php.servlet.send(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Stri
 ng;Ljava/lang/String;Ljava/lang/String;ILjava/lang/String;Z)V+0
[...]

The error appears to be occurring in net.php.servlet.send().  Looking
at your native libraries...

 0x10e2 - 0x10e28000         C:\php-5.2.5\php5servlet.dll
 0x10e3 - 0x1130c000         C:\php-5.2.5\php5ts.dll

Hmm.  Those are very odd libraries to have loaded in a Tomcat process.
 What are you trying to do here - serve PHP from within Tomcat?

Anyway.  I think the error is being caused by your application, not by Tomcat.

 OS: Windows 2000 Build 2195 Service Pack 4

Heh :-).

- Peter

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



Re: Tomcat 5.17 crashes too often

2009-11-27 Thread Peter Crowther
2009/11/27 Rocco Scappatura rocco.scappat...@infracom.it:
 So I think that I will update the jave VM soon.. Maybe an opinion of Chuck 
 would be useful?

I would try updating the VM anyway.  You have one of three possible outcomes:

1) It fixes the bug, and we can all go home happy on a Friday;

2) It changes the way the bug appears, and we get some better
information out of the JVM as to what's happening;

3) It changes nothing, and we're almost certain it's a problem in your
application code or the PHP code somewhere.

All of those three give us extra information - or a fix!  So I would
install a new JVM in a different directory to your current one, change
Tomcat's startup to point to that JVM, and see whether it still fails.
 At worst, you can change Tomcat's startup to point back to the
current JVM and you have lost nothing except a little time.

 I'm running some pages from my old web site tha I have imported under my 
 'new' platform (Tomcat).

OK.  It looks like those pages are PHP pages.  I know there are ways
of getting PHP to run under Tomcat, but I've never tried!

 But I there any way to correct this problem? Maybe is the case to ask to PHP 
 developer?

I would be asking on whichever list handles the PHP servlet.  That
code looks to be part of the PHP distribution; it's certainly not part
of Tomcat.  From the comments on various blogs, it also looks like
it's *very* fragile.

This might be one of the very few times I recommend installing Apache
httpd in front of Tomcat on your system, connecting the two, and
getting httpd to serve the PHP pages and Tomcat to serve everything
else!

- Peter

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



Re: How to deploy my first War in Tomcat 6?

2009-11-26 Thread Peter Crowther
2009/11/26 jackm jack.mort...@gmail.com:

 Hi all,

 I'm newbie, I installed Tomcat 6 on Ubuntu Karmic, how should I proceed to
 Deploy my first war ?

Jack, did you install it via download from the Tomcat site
(http://tomcat.apache.org) or via Ubuntu's installation process?

If you installed it via Ubuntu, I'd recommend asking on an Ubuntu
support list.  Many (most!) Linux distributions put files in very
different places from the Tomcat default, and we can spend a lot of
time guessing where they've chosen for each distribution.

If you installed it by unzipping the download from the Tomcat site,
you should be able to deploy your war simply by copying it into
Tomcat's webapps directory.  But it's certainly worth reading the link
that Pid pointed you to, if you haven't already.

- Peter

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



Re: Tomcat Https loadbalancing??

2009-11-25 Thread Peter Crowther
2009/11/25 jkv j.kumara...@gmail.com:
 We are using Tomcat 6.0 and running HTTPS (enabled SSL). The number of
 requests has grown up and we have decided to do go for clustering and
 loadbalancing. We have decided to go for Apache and mod_proxy/mod_jk
 loadbalacing. My certificate resides in Tomcat.

 In order to loadbalance HTTPS request using Apache and mod_proxy/mod_jk,
 should I configure Apache to handle HTTPS and tell it about my certificate
 details?

Yes.  Apache has to terminate the SSL connection when you're load balancing.

 While loadbalancing I understand that http/https request to Apache is
 converted to ajp and tunneled to Tomcat, so is ajp protocol secure? should I
 enable SSL in tomcat to handle this request?

The AJP protocol is not secure.  It is only used between httpd and
Tomcat.  You should perform some suitable threat modelling of your
system.  If you think the threat from an attacker being able to sniff
packets on the path between httpd and Tomcat is sufficiently low,
leave it unencrypted.  If you think the threat is too high, encrypt it
using some kind of secure tunnel between httpd and Tomcat, such as a
VPN connection.

My guess is that if someone's able to sniff packets on the link
between httpd and Tomcat, you already have a big security issue.

 Should I have two copies of my certificate files if Apache and Tomcat reside
 on two different physical machines(Horizontal Clustering)?

In this environment, you only want your public certificate on httpd.
 Tomcat will not be doing anything that uses it, so don't put a copy
on those machines.

Hope this helps,

- Peter

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



Re: Tomcat Https loadbalancing??

2009-11-25 Thread Peter Crowther
2009/11/25 jkv j.kumara...@gmail.com:
 I got one small doubt in the last point that you said.

 In this environment, you only want your public certificate on httpd.
 Tomcat will not be doing anything that uses it, so don't put a copy
 on those machines.

 this means that I will not enable SSL in my tomcat.. I will comment
 !-- Connector port=443 protocol=HTTP/1.1 SSLEnabled=true
                --

 tag totally from server.xml file in tomcat and have just one connetor
 element i.e.,

 Connector port=8009 protocol=AJP/1.3 redirectPort=443 /

Certainly you only need the AJP connector, as Tomcat will never be
handling http or https requests.

 Thanks for the reply, that really helped a lot and we can also conclude we
 cannot have a secure horizontal loadbalancing with Apache and Tomcat!

Depends what you mean by secure, as the level of security is
relative, not absolute.  There are more moving parts to secure, but
it's possible to secure all of them to a reasonable standard.

No system is *ever* 100% secure from attack, even if it's 100 metres
underground, powered by its own generator, no network,
Faraday-shielded, has a division of armed guards protecting its bunker
and has self-destruct systems built in.  It just depends how much the
attacker wants your data, and therefore what resource (s)he is willing
to commit to acquiring them.

- Peter

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



Re: Redirecting a port to a webapp

2009-11-24 Thread Peter Crowther
2009/11/24 Looijmans, Mike mike.looijm...@oce.com
 Because the  is a random word, not a
 constant, nor the name of a servlet. Think wikipedia, the request might
 be for /foo or /bar or whatever, and the servlet uses that word for its
 own purposes (it will look it up in the database and return something
 interesting).

Aha!  New information - thank you!  I don't think you'd previously
mentioned that the  was dynamic, not static.

I'd expect urlrewrite should be able to handle this situation - as
would writing your own Filter if you want to learn about the
technology.  Urlrewrite's manual is remarkably clear; I suspect it
would save time overall.

If you install urlrewrite, I'd expect a urlrewrite rule similar to the
following to work (note: untested!)

rule
  noteRedirect :666/anything to :80/myapp/anything/note
  condition name=port666/condition
  from^\(.*\)$/from
  to/myapp/$1/to
/rule

That plus two connectors for the two ports should do it, I think.

- Peter

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



Re: Tomcat 6 and Apache2 VS Tomcat 6 alone

2009-11-24 Thread Peter Crowther
2009/11/24 TheGrailer ken...@gmail.com

 Im pretty new to this but have 2 friends that help me out. Though one of my
 friends tells me to use Apache2 infront of Tomcat and the other one tells
 me
 it's unnecessary.


Finding out their reasoning - and the evidence each one has supporting their
point of view - would be interesting.

I'll try to explain my situation:
 I've started a virtual Ubuntu 8.04 Longterm server and my goal is to have
 atleast one serious site (made in Grails) and beeing a search engine (think
 youtube). So it's gonna be pretty much dynamic content and less static. But
 I will also start some sites just for fun that probobly won't have that
 much
 visitors but beeing abit more static content.
 Im not saying my primary site will get much visitors but I want to build
 the
 environment as if it has.
 Ps. I will probobly put a Varnish at the front sooner or later (for the
 experience)

 So what do you all think? Is the Apache2 infront of the Tomcat 6 a waste of
 time or worth while?

 As always, it depends on your environment, wishes and skills.

Tomcat has a reputation for being slow to serve static content.  For 5.5+,
that reputation is not deserved - you'll saturate your network connection
long before you run out of CPU.  So the old reason to put Apache httpd
(hereafter just httpd) in front of Tomcat no longer applies.

If you add httpd, you also need to add a connection between httpd and
Tomcat.  More moving parts, more to maintain, higher CPU, use, higher memory
use and higher latency on all requests that go to Tomcat.

If you add httpd and don't configure the connection carefully, it's quite
easy to expose the source of your JSPs and your webapp configuration - which
may expose passwords, for example.  So poor configuration of httpd+Tomcat
can be a security risk.

httpd can act as a very effective load-balancer for Tomcat if you don't want
to use a hardware load-balancer.

httpd has modules that are faster at serving non-Java dynamic content (PHP,
perl etc) than Tomcat's CGI.

httpd has mod_security, which may aid in site security if correctly
configured (and can be a real PITA if not correctly configured).

Pick the points from the above that apply to your site, and decide whether
it's right for you.  There is no Right or Wrong answer.

- Peter


Re: Tomcat 6 and Apache2 VS Tomcat 6 alone

2009-11-24 Thread Peter Crowther
2009/11/24 TheGrailer ken...@gmail.com:
 The most compellig argument from the Apache2 and Tomcat 6-friend was
 indeed the static content part.

http://tomcat.markmail.org/message/il33wqqjb2dok6xz might be
illuminating - along with the discussion around it on that thread.  I
suspect Chris will be making his own comments on this thread, as he
knows his benchmarking results better than anyone!

 But also confing like virtual hosts (hard in
 pure tomcat?)

Easy in pure Tomcat.  Outlined at
http://tomcat.apache.org/tomcat-6.0-doc/virtual-hosting-howto.html
(assuming version 6.0.x).

 and modules.

Which ones might you want?  The commonest would be a mod_rewrite, for
which http://tuckey.org/urlrewrite should work just fine.

- Peter

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



Re: Ethernet or configuration?

2009-11-24 Thread Peter Crowther
2009/11/24 Guifre Bosch Fabregas guifre.bo...@gmail.com:
 Hi people!

 I have an unusual problem.
 I recently installed apache and if I go to server browser and put:
 http://localhost/APP or http://127.0.0.1/app  works fine but if I put into a
 remote server http://192.168.1.6/app i don0t aee nothing!

 Whats happend

Applying my psychic abilities... you're Tomcat running on a computer
with a firewall that's enabled by default, and you've not added an
exception for Tomcat (on port 80).

But since you've not told us about your OS, Tomcat version or anything
else, that's just a guess from being psychic and seeing the same
problem asked on the list about once a week for the last 3 years ;-).

- Peter

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



Re: Redirecting a port to a webapp

2009-11-23 Thread Peter Crowther
2009/11/23 Looijmans, Mike mike.looijm...@oce.com

 Hello,

 After hours of googling and browsing documentation, i came to the
 conclusion that what i want is either so trivial that everybody knows how to
 do it, or so complicated that no one ever tried it...

 I want to accomplish the following in Tomcat 5.5:

 http://myserver:80/xxx just does whatever it always does.
 http://myserver:666/xxx is equivalent to http://myserver:80/myapp/xxx

 So i want all requests targetted at a particular port (666) in this case to
 be forwarded to a particular servlet, which is also served under its own
 subdirectory on the regular HTTP port 80.

 I can set up a connector at port 666 and have all its request go somewhere
 else, but then the application cannot be reached through the normal port
 (80), which is crucial for this thing to work. Installing two copies will
 accomplish that, but then the two copies live in different universes and
 cannot communicate - and setting up some IPC between them is overkill i'd
 say.

 It's not at all obvious :-).  You can sort-of pick the bones out of
http://tomcat.apache.org/tomcat-5.5-doc/index.html , but unfortunately I've
always found the official Tomcat docs to be very short of worked examples.

Because you want different sets of webapps served on your different
connectors, I *think* you'll need two different Services in your server.xml:

Server
  Service for port 80
Connector for port 80
Engine for port 80
  Host for port 80, specifying base directory for your port 80 webapps
/Engine for port 80
  /Service for port 80

  Service for port 666
Connector for port 666
Engine for port 666
  Host for port 666, specifying base directory for your port 666
webapps
/Engine for port 666
  /Service for port 666
/Server

The fastest way to make such a configuration will be to edit your existing
server.xml, copy+paste the Service.../Service section (which is most of
the file) and hack at the copy as necessary.

Note that you'll end up with two independent copies of the servlet in your
two webapp directories, and they won't share things like Sessions between
them.  I can't think of a way of doing that using just Tomcat's features.
You might, however, be able to get what you want using a combination of
http://tuckey.org/urlrewrite/ and two Connectors defined on the same
Service.

Good luck!

- Peter


Re: Redirecting a port to a webapp

2009-11-23 Thread Peter Crowther
2009/11/23 Looijmans, Mike mike.looijm...@oce.com

  No. You want webapps/myapp to be treated as the ROOT context
  for a host.
  appBase=webapps/myapp means look in the webapps/myapp
  directory to find contexts for this host. The ROOT context in
  that case would be webapps/myapp/ROOT
 
  As a general rule any configuration that boils down to docBase==
  (which is the same as appBase==docBase) is not going to
  behave they way you want it to.


 Since I don't understand a bit of this reply, I'll interpret it as
 please go read the manual...


The servlet spec requires a little bit of magic.  Whatever war file you
want to deploy as the top-level one needs to be called ROOT.war, or the
files placed in a directory called ROOT.




   I want http://localhost/myapp/ and http://localhost:666/ to
  mean the
   same, so just moving the webapps root a level deeper seems
  the logical
   thing to do.
 
  That would be logical if the file system mapped directly to
  the web URL space but it doesn't.

 Probably the word apache has lead me into believing that tomcat would
 behave like other webservers: Just point it to some root location and
 then it will follow the filesystem.

 Yeah.  Unfortunately the servlet spec has other ideas, and Tomcat follows
the spec.  Much of the reason Tomcat's own documentation seems to have bits
missing is that it doesn't duplicate the bits from the spec.  If you haven't
at least skim-read the spec, I'd suggest doing so - it makes a lot of
Tomcat's odd behaviour much clearer.

- Peter


Re: Performance Problem

2009-11-20 Thread Peter Crowther
2009/11/20 div.gcet divya.garg...@gmail.com


 Hi all,

I am developing a web application using Tomcat 6.0 and MyEclipse
 IDE. For my requirements i have to store a lot of (100-200)  Lists objects
 in my sessions. And any list may be associated with a lot other objects,
 because of this the performance of my application have become very slow. As
 i run through my application its becoming more slow. Please can anybody
 provide my any suggestion on this issue. Thanks in advance.

 Storing large amounts of data in a session is not a good idea, as it leads
to the kinds of performance problems you're seeing.  I would recommend
finding another way of storing your Lists objects, or review for other ways
of meeting the requirements.  Why are they in the Session rather than
anywhere else?  Why do they exist at all?

- Peter


Re: Howto Socket (TCP / IP ) reading from a war application on Tomcat

2009-11-20 Thread Peter Crowther
2009/11/20 Karthik Nanjangude karthik.nanjang...@xius-bcgi.com

 A 3rd party Client S/w of C++ sends an XML string over socket

 This socket is be defined and read by *Process* of web application

 OK, so you're trying to get Tomcat to do something it's not designed to do:
handle incoming TCP connections that are not HTTP connections.  This will be
a lot of work.  It's like trying to drive a car along a river instead of a
road... sure, you can adapt the car to do that, but it might be cheaper to
get a boat!  In this case, it might be cheaper to get a socket server.

What are the goals for performance and response time to the C++ client?  Can
you use something like Apache MINA (http://mina.apache.org/) to write
yourself a small server that accepts the incoming XML from the C++ client,
then wraps it in a HTTP request and sends that HTTP request to Tomcat?

- Peter


Re: Sending messages via Tomcat to ActiveMQ

2009-11-19 Thread Peter Crowther
2009/11/19 Kumako22 kumak...@gmail.com

 My question  is: how can I send messages to ActiveMQ via Tomcat. Is it
 possible? How can I write it? Any clues?

 1) Write a standalone Java program to send a message to ActiveMQ.  Test
it.  Prove it works.

2) Paste that code into your web application code at the appropriate point.
Tomcat does not provide facilities for sending messages to ActiveMQ, but it
also does not prevent you from using your own code to do so.

- Peter


Re: Newbie, tomcat performance tuning

2009-11-19 Thread Peter Crowther
2009/11/19 Bruce Foster gis.fos...@gmail.com

 do I need to look at the server threads? if yes then where to I set
 that option?

 read somewhere tomcat with 8 thread (8 core processor), how do I
 configure that option?

 If you can find me that somewhere, I'll go and grumble at the author
:-).  It's very poor advice unless your web application is 100% CPU-bound,
doing no I/O (including sending no output over HTTP) and no database
accesses.

For realistic loads, some will be waiting on I/O to database, sending data
to the browser etc..  The actual number of threads you want is therefore
higher, depending on your own web application - and the only way to find out
is to profile.

Setting the number of threads too high costs you a little bit of CPU (so the
scheduler can account for them) and a little bit of RAM (for their stacks
and other data structures).  Setting the number of threads too low costs you
failed requests from your users, up to and including the server appearing to
be down because it's got backed up handling incoming requests, despite
having enough RAM and CPU.  If you're not sure what to do, keep the threads
unchanged; if you *have* to alter it, prefer higher rather than lower unless
you can demonstrate that it will cause RAM or CPU issues to do so.

- Peter


Re: FW: Tomcat 6.0.20 Causes Kernel Crash on Linux

2009-11-18 Thread Peter Crowther
2009/11/18 Amol Wate (awate) aw...@cisco.com

 Are there any known memory issues with tomcat 6.0.20 ? This build causes
 a kernel panic on my linux box with Java 5. I'd been using 6.0.18
 without any issues on the same configuration.

 http://markmail.org/message/mrpgvn4mqvyrq64a reports a memory leak,
 though I don't have enough debugs to say it matches mine. All I have is:

BUG: unable to handle kernel NULL pointer dereference at virtual
 address 
printing eip:
c05d9144
*pdpt = 2db52001
*pde = 
Oops:  [#1]

 This problem is consistently reproducible on 6.0.20, and magically
 disappears upon switching back to 6.0.18. What am I missing ?

 Thanks in advance,
 Timir

 I suspect you're missing either a working Linux kernel, or working hardware
:-).  6.0.20 is stable on a wide variety of OSs and hardware; something
about yours is causing problems.  Tomcat is not an unusual process - it
doesn't expect anything in particular out of the OS or kernel, as it has to
be so portable - so I'd contend that a kernel panic is indicative of
problems outside Tomcat.

1) Are you *certain* the hardware is solid?  Have you run memory testers etc
across it?  What is it, anyway, as you haven't told us?

2) Are you *certain* your Linux kernel is solid?  What is it, anyway, as you
haven't told us?

Also, what JVM and are you using anything other than pure Java code (do you
have tcnative installed, do you make any JNI calls, etc)?

- Peter


Re: FW: Tomcat 6.0.20 Causes Kernel Crash on Linux

2009-11-18 Thread Peter Crowther
2009/11/18 Timir Hazarika (thazarik) thaza...@cisco.com

 Peter, we're talking a custom built linux server that has been in
 production for years.  I'm wondering what's magical with 6.0.20 that
 causes my kernel such trouble, and why the problem doesn't surface with
 any of the earlier builds.

 As you've provided no more information despite requests, we will also be
wondering.

We cannot help you to debug the problem with this little information on your
environment and configuration.

- Peter


Re: The server encountered an internal error () that prevented it from fulfilling this request

2009-11-16 Thread Peter Crowther
2009/11/16 Bala_ji talk2b...@gmail.com:

 The server encountered an internal error () that prevented it from fulfilling
 this request message in IWSS server.  Please help
 http://old.nabble.com/file/p26370991/iwss%2Bapache%2Berror.jpg

You have a null pointer exception, caused by either your application
code or something in com.trend.iwss.gui.  This is not a Tomcat
problem, it is a problem with your application.

- Peter

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



Re: Tomcat DBCP Connection Pooling to MySQL limited number of connection issue in Spring2.5 + Hibernate3 + commons-DBCP1.2

2009-11-16 Thread Peter Crowther
2009/11/16 Pid p...@pidster.com:
 You managed to subscribe to the list, can't you follow the instructions on
 how to unsubscribe?  Clues at the bottom of every email.

We keep saying that, and it keeps being a problem for users.

The email-based unsubscribe appears to be unreliable, I suspect due to
an overzealous spam filter being applied to messages arriving at it.
I don't know whether it's possible to implement an alternative web
form-based approach that mails the user to confirm the unsubscribe,
but allows the user to paste a verify code into the unsubscribe page
so that they never have to email the Apache list server.

- Peter

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



Re: How2 Disable Browser Access to specific port

2009-11-16 Thread Peter Crowther
2009/11/16 joeweder joewe...@gmail.com:
 Question: How can I disable browser access through a specific port but
 continue to allow headless https through?

You *could* write a Filter that sniffed at the User-Agent header in
the https: request, but most browsers have ways of faking that - you
can't rely on *any* data coming in over the https stream to be
original rather than altered or injected by a cracker.  In essence,
there is no secure way of doing what you want.

Security by obscurity is poor security.  Have you thought about
designing the application correctly, so that headless https clients
have to authenticate?

- Peter

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



Re: Tomcat 6.0 requires JRE 5.0 issue

2009-11-16 Thread Peter Crowther
2009/11/16 Elizabeth Gorkic egor...@hotmail.com:
 My company has a policy to deploy only officially supported platforms

... then why are they running open source software such as Tomcat,
which has no official support?

- Peter

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



Re: Problem encounter during setup Virtual Hosting and Tomcat 6.0

2009-11-15 Thread Peter Crowther
2009/11/15 Henry Loke fsl...@yahoo.com:
 Browser: http://ren:8080/

 [IMG]http://i861.photobucket.com/albums/ab175/fsloke/pagenoFound.jpg[/IMG]

 Server not found

Tomcat cannot and does not change your computer's or network's idea of
what names map to what IP addresses.  Have you changed your hosts file
or DNS so that the name ren maps to your computer's IP address?  If
you have not changed it, do so now and see if it works.

- Peter

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



Re: Secure login only, not rest of app

2009-11-10 Thread Peter Crowther
2009/11/10 Robert Denison r...@blim.org:
 I assume that the standard way of dealing with static caching is to have e.g. 
 an images (css etc) directory and have that not secure?

No, as on most browsers that will pop up a dialog box with something
like this page contains both secure and insecure items.  Do you want
to display the insecure items?

All content referenced from a secure page should be secure to prevent
this warning.

- Peter

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



<    1   2   3   4   5   6   7   8   9   10   >