Re: Tomcat 6.0.29 using more and more RAM until it collapses?

2010-11-16 Thread Pid
On 16/11/2010 05:08, Brian wrote:
  I still have to find the reason of the leak.

Tomcat attempts to find  notify you of potential memory leaks.  You
reported messages in your logs at app reload.  Did you tell us what they
are yet?


p


0x62590808.asc
Description: application/pgp-keys


signature.asc
Description: OpenPGP digital signature


Re: Tomcat Going down Frequently

2010-11-16 Thread Pid
On 16/11/2010 07:34, Amol Puglia wrote:
 Hello Pid,
 
 Thanks for the updates.It would be great if you could let us know whether the 
 issue is in application server or application.

Well, the problem class isn't in an org.apache package, it's in a
com.ericsson package.  Is that your code?

LoginBean.java, line 2366.

There's a lot of code in that file, but you could check to see what's
happening at that line.

In the a line above in that, in the stacktrace, there's a call to
StandardSessionFacade.getAttributeNames

which I'm not sure about, I'd expect to see a call to HttpSession rather
than a call to an internal component of Tomcat.

I think your code is attempting to flush the session clean, without
checking that the session is available to do so (which it isn't).


p


 Also we are using apache to load balance tomcat instances using following 
 modules.
 
 LoadModule proxy_module modules/mod_proxy.so
 LoadModule proxy_connect_module modules/mod_proxy_connect.so
 LoadModule proxy_ftp_module modules/mod_proxy_ftp.so
 LoadModule proxy_http_module modules/mod_proxy_http.so
 LoadModule proxy_scgi_module modules/mod_proxy_scgi.so
 LoadModule proxy_ajp_module modules/mod_proxy_ajp.so
 LoadModule proxy_balancer_module modules/mod_proxy_balancer.so
 
 Is there anything we have to tune configuration on apache,tomcat or 
 application,please suggest.
 
 
 
 
 --- On Mon, 11/15/10, Pid p...@pidster.com wrote:
 
 From: Pid p...@pidster.com
 Subject: Re: Tomcat Going down Frequently
 To: Tomcat Users List users@tomcat.apache.org
 Date: Monday, November 15, 2010, 10:04 PM
 
 On 15/11/2010 11:03, Amol Puglia wrote:
  at 
 org.apache.catalina.session.StandardSessionFacade.getAttributeNames(StandardSessionFacade.java:120)
  at com.ericsson.mars.jspbean.LoginBean.logout(LoginBean.java:2366)
  at 
 com.ericsson.mars.jspbean.LoginBean.valueUnbound(LoginBean.java:2450)
 
 The problem is in your HttpSessionBindingListener LoginBean, it appears
 to be operating on the session object after the session has been
 invalidated.
 
 I don't know whether this could take Tomcat down, unless you've
 included* a System.exit call in a catch - which seems to be popular
 again all of a sudden.
 
 
 p
 
 * which is A Really Bad Idea.
 
 
 
   



0x62590808.asc
Description: application/pgp-keys


signature.asc
Description: OpenPGP digital signature


Re: Tomcat Going down Frequently

2010-11-16 Thread André Warnier

Amol Puglia wrote:

Hello Pid,

Thanks for the updates.It would be great if you could let us know whether the 
issue is in application server or application.

Also we are using apache to load balance tomcat instances using following 
modules.


You most probably are /not/ using all of the following modules.
Just having them in your configuration does not mean that you are actually 
using them.
If you have them in your configuration, and are not using them, then you are probably 
wasting quite a bit of memory however.




LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_connect_module modules/mod_proxy_connect.so
LoadModule proxy_ftp_module modules/mod_proxy_ftp.so
LoadModule proxy_http_module modules/mod_proxy_http.so
LoadModule proxy_scgi_module modules/mod_proxy_scgi.so
LoadModule proxy_ajp_module modules/mod_proxy_ajp.so
LoadModule proxy_balancer_module modules/mod_proxy_balancer.so

Is there anything we have to tune configuration on apache,tomcat or 
application,please suggest.

On the face of it, and considering that you are using mod_jk, my first recommendation as 
to tuning would be to comment out all of the above.  You probably are not using any of them.


As others have already commented, your problem seems definitely to be in the tomcat 
application, not in tomcat nor apache httpd.



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



RE: the tomcat encoding

2010-11-16 Thread Rob Gregory
Hi Xu,

Encoding is/can be a real pain. You have to ensure it is consistent
throughout the web application to stand any chance. Start with the
server.xml with the following declaration:-

Connector port=80 redirectPort=443 URIEncoding=UTF-8
useBodyEncodingForURI=true /

I also use a filter to set the following:-

request.setCharacterEncoding(UTF-8);
response.setContentType(text/html; charset=UTF-8); 
response.setCharacterEncoding(UTF-8);

Within the final html output I always include the following meta tag:-
meta http-equiv=Content-Type content=text/xhtml;
charset=utf-8/meta

Not sure all steps are required but they work for me. Of course if you
use a database this also needs to support UTF-8 or your chosen encoding.

Hope this helps
Rob


 -Original Message-
 From: xu cheng [mailto:xcheng@gmail.com]
 Sent: 16 November 2010 05:59
 To: users@tomcat.apache.org
 Subject: the tomcat encoding
 
 hi all:
 I wrote an app and there are some chinese content, and there are some
code
 like this
 
 str = new String(chineseContentString.getBytes(iso-8859-1),
utf-8);
 
 the app runs pretty well in the tomcat of my pc. however ,when it was
 deployed in other machine.
 all the Chinese content becomes messy code.
 
 so ,does anyone know how to got to encoding of the tomcat. or it was
just
 iso-8859-1 and cannot be changed?
 
 thanks
 by the way , the edition is 6.0.20

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



Re: After manager says that there was a leak, how to use a profiler?

2010-11-16 Thread Mark Thomas
On 16/11/2010 04:12, Brian wrote:
 Maybe my question sounded too vague and repetitive.
 What I meant is something like this Is the a class loader (or something
 like that) than I should start analyzing? I mean, is there a route I should
 follow in order to see which objects are stucked? If the Tomcat Manager
 knows that something got stucked in the memory, how does it know that? Is
 there a clue we should start?.

http://markmail.org/message/fcbvwapt6afyndxn

Mark


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



Re: the tomcat encoding

2010-11-16 Thread Mark Thomas
On 16/11/2010 05:59, xu cheng wrote:
 so ,does anyone know how to got to encoding of the tomcat. or it was just
 iso-8859-1 and cannot be changed?

http://wiki.apache.org/tomcat/FAQ/CharacterEncoding

Mark

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



Re: Tomcat Going down Frequently

2010-11-16 Thread Amol Puglia
Hello Andre,

Thanks for the updates. I am not using mod_jk , I am using proxy modules for 
redirecting request from apache to tomcat.

As you said that there is problem in application code, Is there anything we can 
point out where exactly is the problem in the code or configuration?

--- On Tue, 11/16/10, André Warnier a...@ice-sa.com wrote:

From: André Warnier a...@ice-sa.com
Subject: Re: Tomcat Going down Frequently
To: Tomcat Users List users@tomcat.apache.org
Date: Tuesday, November 16, 2010, 2:54 PM

Amol Puglia wrote:
 Hello Pid,
 
 Thanks for the updates.It would be great if you could let us know whether the 
 issue is in application server or application.
 
 Also we are using apache to load balance tomcat instances using following 
 modules.

You most probably are /not/ using all of the following modules.
Just having them in your configuration does not mean that you are actually 
using them.
If you have them in your configuration, and are not using them, then you are 
probably wasting quite a bit of memory however.

 
 LoadModule proxy_module modules/mod_proxy.so
 LoadModule proxy_connect_module modules/mod_proxy_connect.so
 LoadModule proxy_ftp_module modules/mod_proxy_ftp.so
 LoadModule proxy_http_module modules/mod_proxy_http.so
 LoadModule proxy_scgi_module modules/mod_proxy_scgi.so
 LoadModule proxy_ajp_module modules/mod_proxy_ajp.so
 LoadModule proxy_balancer_module modules/mod_proxy_balancer.so
 
 Is there anything we have to tune configuration on apache,tomcat or 
 application,please suggest.
 
On the face of it, and considering that you are using mod_jk, my first 
recommendation as to tuning would be to comment out all of the above.  You 
probably are not using any of them.

As others have already commented, your problem seems definitely to be in the 
tomcat application, not in tomcat nor apache httpd.


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




  

RE: Shutting down one instance of tomcat 6 from a listener

2010-11-16 Thread Patrick Sauts
It works just fine doing it from the ServletContextListener.
Thx a lot.

But I was wondering how to do it outside of the application itself?

Patrick Sauts.

-Original Message-
From: Pid [mailto:p...@pidster.com] 
Sent: lundi 15 novembre 2010 12:44
To: Tomcat Users List
Subject: Re: Shutting down one instance of tomcat 6 from a listener

On 15/11/2010 09:37, Patrick Sauts wrote:
 So, how to shut down properly the current application from a 'listener' 
 leaving the other webapps deployed into Tomcat to continue their business?

It depends on what the problem actually is, and when it occurs.

If you do all of your initialisation in a ServletContextListener and throw an 
exception on fail, then the context won't start up.

This is not the same as shutting it down after a certain period of time and 
after a fault condition occurs.


Where is the code which is going to shut down the application?
Presumably outside of the application itself?


p


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



Re: Tomcat Going down Frequently

2010-11-16 Thread André Warnier

Amol Puglia wrote:

Hello Andre,

Thanks for the updates. I am not using mod_jk , I am using proxy modules for 
redirecting request from apache to tomcat.



Ok, sorry, I confused your post with another one.

But anyway, your configuration shows a whole lot of proxy modules, many of which do not 
seem to have any relation with proxying calls to Tomcat. Such as these :


 LoadModule proxy_connect_module modules/mod_proxy_connect.so
 LoadModule proxy_ftp_module modules/mod_proxy_ftp.so
 LoadModule proxy_scgi_module modules/mod_proxy_scgi.so

The following /may/ have a relation with the proxying to Tomcat, but which one are you 
really using ?


 LoadModule proxy_http_module modules/mod_proxy_http.so
 LoadModule proxy_ajp_module modules/mod_proxy_ajp.so

Usually, people use *either* mod_proxy_http *or* mod_proxy_ajp, so which one is being used 
? Can you provide some information about the apache httpd configuration that shows what is 
being proxied and how ?




As you said that there is problem in application code, Is there anything we can 
point out where exactly is the problem in the code or configuration?



I thought that Pid already pointed that out.




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



Re: Shutting down one instance of tomcat 6 from a listener

2010-11-16 Thread Pid
On 16/11/2010 10:46, Patrick Sauts wrote:
 It works just fine doing it from the ServletContextListener.
 Thx a lot.
 
 But I was wondering how to do it outside of the application itself?

Assuming you can tell if the app is in a fault condition, you can use
JMX to start, stop  reload apps.


p


 Patrick Sauts.
 
 -Original Message-
 From: Pid [mailto:p...@pidster.com] 
 Sent: lundi 15 novembre 2010 12:44
 To: Tomcat Users List
 Subject: Re: Shutting down one instance of tomcat 6 from a listener
 
 On 15/11/2010 09:37, Patrick Sauts wrote:
 So, how to shut down properly the current application from a 'listener' 
 leaving the other webapps deployed into Tomcat to continue their business?
 
 It depends on what the problem actually is, and when it occurs.
 
 If you do all of your initialisation in a ServletContextListener and throw an 
 exception on fail, then the context won't start up.
 
 This is not the same as shutting it down after a certain period of time and 
 after a fault condition occurs.
 
 
 Where is the code which is going to shut down the application?
 Presumably outside of the application itself?
 
 
 p
 
 
 -
 To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
 For additional commands, e-mail: users-h...@tomcat.apache.org
 



0x62590808.asc
Description: application/pgp-keys


signature.asc
Description: OpenPGP digital signature


Re: Client not able with perform client-cert authentication with Tomcat 6.0.29 on APR

2010-11-16 Thread Goo Sam Kong
Hi Mark,

Thank you for the settings. I am not sure what is the APR/native connector
version, I am using the default APR/native connector in 6.0.29 (I do not
set/change APR on my Windows machine).

I am not sure why the client certificate authentication failed when my
client certificate was signed with SHA256 but client certificate
authentication worked perfectly when client certificate was signed with
SHA1.

From http://old.nabble.com/SHA256-digest-windows-0.9.8k--td26123008.html, it
mentioned developer required to include a call to
OpenSSL_add_all_algorithms()
instead calling SSL_library_init() which only adds the more commonly uses
SSL
algorithms. I am not sure where should I include this.

Can you advice how to solve my problem?

My APR connector settings:
Connector port=8443
   protocol=org.apache.coyote.http11.Http11AprProtocol
   SSLEnabled=true
   maxThreads=150
   scheme=https
   secure=true
   SSLCertificateFile=C:\usr\tomcat\tomcat.crt
   SSLCertificateKeyFile=C:\usr\tomcat\tomcat.key
   SSLVerifyClient=optional
   SSLVerifyDepth=1
   SSLCipherSuite=AES128-SHA:DES-CBC3-SHA
   SSLCACertificateFile=C:\usr-files\client-cert-ca.crt /

On 13 November 2010 00:38, Mark Thomas ma...@apache.org wrote:

 On 12/11/2010 16:27, Goo Sam Kong wrote:
  Hi
 
  I am running Tomcat 6.0.29 with JDK 1.6.0_22 on Windows XP.

 APR/native connector version? SSL re-negotiation wasn't supported until
 recently and the CVE-2009-3555 fixes further complicate things.

  Connector SSLCACertificateFile=C:\usr-files\client-cert-ca.crt
 SSLCertificateFile=C:\usr\tomcat\tomcat.crt
 SSLCertificateKeyFile=C:\usr\tomcat\tomcat.key
 SSLCipherSuite=AES128-SHA:DES-CBC3-SHA
 SSLEnabled=true
 SSLEngine=on
 SSLVerifyClient=optional
 maxThreads=150
 port=8443
 protocol=HTTP/1.1
 scheme=https
 secure=true
 sslProtocol=TLS /

 Is SSLEngine a valid attribute here? I don't see it in the Connector docs.
 SSLVerifyClient=optional can (should?) be removed.
 Is that SSLCipherSuite compatible with your client? Try removing that
 setting until everything else is working.

 The following settings are known to work:

 Connector
  port=8443
  protocol=org.apache.coyote.http11.Http11AprProtocol
  SSLEnabled=true
  maxThreads=150
  scheme=https
  secure=true
  SSLCertificateFile=${catalina.base}/conf/tomcathost-cert.pem
  SSLCertificateKeyFile=${catalina.base}/conf/tomcathost-key.pem
  SSLCACertificateFile=${catalina.base}/conf/cacert.pem /

 Mark

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




RE: After manager says that there was a leak, how to use a profiler?

2010-11-16 Thread Brian
Hi Mark,

I read your information, which I will quote here:


1. Find an app that you can't reload without OOME
2. Get a profiler - I like Yourkit
   Full disclosure: they give ASF committers a free copy
3. Reload you app once
4. Use the profiler to look for instances of WebappClassLoader
5. Look for the one with the started attribute == false
6. Trace the GC roots for this instance
7. Fix whatever is hanging on to references to the instance - there
should not be any



Well, I'm using Yourkit as well. I reloaded the app twice, and I found 4
instances of WebappClassLoader. Two of them correspond to my two running
apps, which is correct, and the other two correspond to the leaked apps.
Both of them have an instance that have the started attribute with a
false. Great, so I guess I'm in the right path to find the problem. Now
I'm inspecting one of these objects with the started=false. If I choose
the report of Paths from GC roots from it, I see LOTS of items! And all of
them have the loader of indication. All the items are classes programmed
by me, so I guess I'm guilty, and not the people that programmed Tomcat
;-)  . They are DTOs, facades, Struts actionforms, etc. 
Why are all these classes in the list? What should I check about them? Why
are they still loaded? 
I guess there is something missing in my programming. Maybe I should do
something about all the objects that are still alive that correspond to all
the loaded classes? Maybe I need to do something in the contextDestroyed()
method in the ServletContextListener in my app, in order to destroy all the
objects properly?  
 
Thanks a lot for your help!

Brian 



 -Original Message-
 From: Mark Thomas [mailto:ma...@apache.org]
 Sent: Tuesday, November 16, 2010 04:37 AM
 To: Tomcat Users List
 Subject: Re: After manager says that there was a leak, how to use a
profiler?
 
 On 16/11/2010 04:12, Brian wrote:
  Maybe my question sounded too vague and repetitive.
  What I meant is something like this Is the a class loader (or
  something like that) than I should start analyzing? I mean, is there a
  route I should follow in order to see which objects are stucked? If
  the Tomcat Manager knows that something got stucked in the memory,
 how
  does it know that? Is there a clue we should start?.
 
 http://markmail.org/message/fcbvwapt6afyndxn
 
 Mark
 
 
 -
 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: Shutting down one instance of tomcat 6 from a listener

2010-11-16 Thread Patrick Sauts


-Original Message-
From: Pid [mailto:p...@pidster.com] 
Sent: mardi 16 novembre 2010 13:34
To: Tomcat Users List
Subject: Re: Shutting down one instance of tomcat 6 from a listener

On 16/11/2010 10:46, Patrick Sauts wrote:
 It works just fine doing it from the ServletContextListener.
 Thx a lot.
 
 But I was wondering how to do it outside of the application itself?

Assuming you can tell if the app is in a fault condition, you can use JMX to 
start, stop  reload apps.

Of course, thank you.
p


 Patrick Sauts.
 
 -Original Message-
 From: Pid [mailto:p...@pidster.com]
 Sent: lundi 15 novembre 2010 12:44
 To: Tomcat Users List
 Subject: Re: Shutting down one instance of tomcat 6 from a listener
 
 On 15/11/2010 09:37, Patrick Sauts wrote:
 So, how to shut down properly the current application from a 'listener' 
 leaving the other webapps deployed into Tomcat to continue their business?
 
 It depends on what the problem actually is, and when it occurs.
 
 If you do all of your initialisation in a ServletContextListener and throw an 
 exception on fail, then the context won't start up.
 
 This is not the same as shutting it down after a certain period of time and 
 after a fault condition occurs.
 
 
 Where is the code which is going to shut down the application?
 Presumably outside of the application itself?
 
 
 p
 
 
 -
 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



Tomcat 6.0.29 Cookie.getMaxAge() always returns -1 regardless of actual value of maximum age

2010-11-16 Thread Igor Barkon
I run Tomcat 6.0.29 on Windows XP and IE 8.0.6001.18702.

I noticed that getMaxAge() method of any cookie always returns -1 even for 
persistent cookie with real positive value of maximum age. IE treats this 
cookie 
correctly: cookie persists for amount of seconds specified by setMaxAge method. 
But getMaxAge always return -1. Based on specification getMaxAge must return 
actual value of maximum age of a given cookie, not default value. Is this a bug?

Re: Usage of Tomcat SSL in client-side class

2010-11-16 Thread André Warnier

Moley Harey wrote:

Hello folks,

I have a set of web services installed in Tomcat 6.0.26 that I would like to
access using HTTPs, I have following the instructions in Tomcat web side to
set up JSSE support and now I can access the web services using SSH.

My question is what do I have to do in my Java client-side classes to work
with HTTPs requests from Tomcat? Do I have to accept somehow the certificate
provided by Tomcat in my Java classes? Well, I'm totally newbie in these
security issues :-/



Only because you mention that you are a total newbie, and because I am myself not far 
above that level, some beginning pointers :


It helps to give things their correct name (or acronym), so as to be able to find the 
correct documentation and understand their relationship.

SSL is Secure Socket Layer. (Google : SSL RFC)
SSH is an acronym for Secure Shell (Google : SSH RFC)
HTTP is an acronym for HyperText Transport Protocol. (Google : HTTP RFC)
HTTPS (with a big S) is an acronym for HTTP over SSL. (Google : HTTPS RFC)

So you are not accessing the web services over SSH, you are accessing your web services 
over HTTPS, which itself lives above an SSL connection, which itself lives above a TCP 
connection, which itself lives above an IP link (which itself lives over an Ethernet link 
(probably) etc..).


And on top of it all, you have the application (both at the client side, and at the server 
side).


Schematically :

Client applicationServer application
Client container (?) (e.g. a JVM)   Server container (e.g. JVM + 
Tomcat)
Client O.S.   Server OS
Client SSL layer (optional)   Server SSL layer (optional)
Client OS TCP/IP layerServer OS TCP/IP layer
Client-side Ethernet layerServer-side Ethernet layer
Client-side hardware layer --   Server-side hardware layer

When the client side application sends something to the server-side application, whatever 
data is sent goes through all the layers on the client side, then over the physical 
connection, then through all the layers on the server side up to the server application.

The encryption/decryption, if any, takes place at the SSL layer level, 
automatically.

So basically, to answer our question, you do not /have/ to do something special at the 
application level.  The container and the OS take care of the interface, so that your 
application can just use the standard read and write and open and close and 
request.getParameters() calls, no matter if the connection uses an SSL layer or not.


But you /can/ make use of some of the SSL-specific things, if you want.
For example, the server-side application setup /could/ tell the container that it will 
only accept requests that come over a secure channel, and only if they come from a client 
identified as X or Y.



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



Re: Tomcat Going down Frequently

2010-11-16 Thread André Warnier
Ok, so now we know roughly what your configuration is like, and there is not something 
obviously wrong with it (to me).


Now the question is back as follows :
In

WARNING: Exception processing manager org.apache.catalina.session.standardmana...@a20981 
background process

java.lang.IllegalStateException: getAttributeNames: Session already invalidated
at 
org.apache.catalina.session.StandardSession.getAttributeNames(StandardSession.java:1052)
at 
org.apache.catalina.session.StandardSessionFacade.getAttributeNames(StandardSessionFacade.java:120)

at com.ericsson.mars.jspbean.LoginBean.logout(LoginBean.java:2366)
at com.ericsson.mars.jspbean.LoginBean.valueUnbound(LoginBean.java:2450)
...

The above is a WARNING message, indicating that Tomcat has caught something 
unusual.
The something unusual being a java class (LoginBean.java:2366) asking for a list of 
attributes of a session which is already invalidated (aka, finished).

That's an application problem.

But this should not by itself cause the whole Tomcat to go down.
What follows however :

Nov 12, 2010 1:33:09 PM org.apache.coyote.http11.Http11AprProtocol pause
INFO: Pausing Coyote HTTP/1.1 on http-9083
Nov 12, 2010 1:33:09 PM org.apache.coyote.ajp.AjpAprProtocol pause
INFO: Pausing Coyote AJP/1.3 on ajp-9011
Nov 12, 2010 1:33:10 PM org.apache.catalina.core.StandardService stop
INFO: Stopping service Catalina
Nov 12, 2010 1:33:11 PM org.apache.coyote.http11.Http11AprProtocol destroy
INFO: Stopping Coyote HTTP/1.1 on http-9083
Nov 12, 2010 1:33:11 PM org.apache.coyote.ajp.AjpAprProtocol destroy
INFO: Stopping Coyote AJP/1.3 on ajp-9011

are mere INFO-level messages from Tomcat, showing basically that Tomcat is stopping, 
nicely and quietly, as if it had been asked politely to stop.

It is not going down in flames, it is just cleaning up and stopping nicely, 
as requested.
So what is asking it to stop ?

Note also that as per the logfile, this orderly stop happens at 1:33:11, which is almost 
*4 minutes* later than the original WARNING message dated 1:29:23.

That is quite an eternity, even by Java standards.

So I am not even sure that the two things are related.




Amol Puglia wrote:

Hello Andre,

We are proxying request from apache to tomcat using mod_proxy and mod_proxy_ajp

Following is the load balancer configuration in apache.

kindly let me know in case you need further details.

# Port 80
   Listen server_name:80
   #Listen 153.88.86.250:80
   VirtualHost _default_:80
  ServerName server_name
   


  Timeout 10800
  ProxyTimeout 10800
  ProxyRequests Off


   ProxyPass /eMatrix balancer://cluster 
stickysession=JSESSIONID|jsessionid nofailover=On
   #ProxyPass /eMatrix balancer://cluster stickysession=JSESSIONID 
nofailover=On

   ProxyPreserveHost On


   ProxyPass /eMatrix ajp://server_name:8009/eMatrix

   ProxyPass /eMatrix ajp://server_name:8010/eMatrix

  ProxyPass /eMatrix ajp://server_name:8011/eMatrix

  ProxyPass /eMatrix ajp://server_name:9009/eMatrix

  ProxyPass /eMatrix ajp://server_name:9010/eMatrix

  ProxyPass /eMatrix ajp://server_name:9011/eMatrix

   ProxyPassReverse /eMatrix ajp://server_name:8009/eMatrix

   ProxyPassReverse /eMatrix ajp://server_name:8010/eMatrix

   ProxyPassReverse /eMatrix ajp://server_name:8011/eMatrix

   ProxyPassReverse /eMatrix ajp://server_name:9009/eMatrix

   ProxyPassReverse /eMatrix ajp://server_name:9010/eMatrix

   ProxyPassReverse /eMatrix ajp://server_name:9011/eMatrix

   Proxy balancer://cluster
 BalancerMember ajp://server_name:8009/eMatrix 
route=marsprod_rmiserver_1 loadfactor=33 retry=60
 BalancerMember ajp://server_name:8010/eMatrix 
route=marsprod_rmiserver_2 loadfactor=33 retry=60
 BalancerMember ajp://server_name:8011/eMatrix 
route=marsprod_rmiserver_3 loadfactor=33 retry=60
 BalancerMember ajp://server_name:9009/eMatrix 
route=marsprod_rmiserver_4 loadfactor=33 retry=60
 BalancerMember ajp://server_name:9010/eMatrix 
route=marsprod_rmiserver_5 loadfactor=33 retry=60
 #load balancing performed based on number of user requests
 #ProxySet lbmethod=byrequests
 # Report server is for Report purpose only so balancing is required 
now.
 BalancerMember ajp://server_name:9011/eMatrix 
route=marsprod_rmiserver_6 loadfactor=33 retry=60
 ProxySet lbmethod=byrequests
   /Proxy

   #Status page for balancer

   Location /balancer
   SetHandler balancer-manager
   Order Deny,Allow
   Deny from all
   Allow from all
  /Location

  ProxyStatus On

  Location /status
  SetHandler server-status
  Order Deny,Allow
  Deny from all
  Allow from all
  /Location

  ErrorLog /opt/web/apache/app/mxora/logs/error.log



  
   /VirtualHost

# END port 80

--- On Tue, 11/16/10, André Warnier a...@ice-sa.com wrote:

From: André Warnier 

Buffer Overflow

2010-11-16 Thread Tyson Lowery

I'm running Tomcat 6.0.29

I'm seeing this in my catalina.out log file.  I've been able to narrow 
the problem to a single JSP page, and the problem only happens with a 
single user when that user is using Windows XP/FireFox 3.6.12.   I've 
tested the page with XP/Firefox 3.6.3 and can't reproduce the issue.   
The JSP page reads and writes custom cookies.


Any ideas on what might be happening, or on how to get more information 
(like what is actually in the header)?


Nov 15, 2010 11:48:00 PM org.apache.jk.common.MsgAjp cpBytes
SEVERE: Buffer overflow: buffer.len=8192 pos=8190 data=103
Nov 15, 2010 11:48:00 PM org.apache.jk.common.MsgAjp cpBytes
SEVERE: Overflow
java.lang.Throwable
at org.apache.jk.common.MsgAjp.cpBytes(MsgAjp.java:196)
at org.apache.jk.common.MsgAjp.appendByteChunk(MsgAjp.java:170)
at org.apache.jk.common.MsgAjp.appendBytes(MsgAjp.java:155)
at 
org.apache.jk.common.JkInputStream.appendHead(JkInputStream.java:324)

at org.apache.jk.core.MsgContext.action(MsgContext.java:266)
at org.apache.coyote.Response.action(Response.java:183)
at org.apache.coyote.Response.sendHeaders(Response.java:379)
at 
org.apache.catalina.connector.OutputBuffer.doFlush(OutputBuffer.java:305)
at 
org.apache.catalina.connector.OutputBuffer.close(OutputBuffer.java:273)
at 
org.apache.catalina.connector.Response.finishResponse(Response.java:493)
at 
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:322)
at 
org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:190)
at 
org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:291)
at 
org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:774)
at 
org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:703)
at 
org.apache.jk.common.ChannelSocket$SocketConnection.runIt(ChannelSocket.java:896)
at 
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:690)

at java.lang.Thread.run(Thread.java:619)
Nov 15, 2010 11:48:00 PM org.apache.catalina.connector.CoyoteAdapter 
service
SEVERE: An exception or error occurred in the container during the 
request processing

java.lang.ArrayIndexOutOfBoundsException
Nov 15, 2010 11:48:00 PM org.apache.jk.common.MsgAjp cpBytes
SEVERE: Buffer overflow: buffer.len=8192 pos=8190 data=103
Nov 15, 2010 11:48:00 PM org.apache.jk.common.MsgAjp cpBytes
SEVERE: Overflow
java.lang.Throwable
at org.apache.jk.common.MsgAjp.cpBytes(MsgAjp.java:196)
at org.apache.jk.common.MsgAjp.appendByteChunk(MsgAjp.java:170)
at org.apache.jk.common.MsgAjp.appendBytes(MsgAjp.java:155)
at 
org.apache.jk.common.JkInputStream.appendHead(JkInputStream.java:324)

at org.apache.jk.core.MsgContext.action(MsgContext.java:266)
at org.apache.jk.core.MsgContext.action(MsgContext.java:302)
at org.apache.coyote.Response.action(Response.java:183)
at org.apache.coyote.Response.finish(Response.java:305)
at 
org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:195)
at 
org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:291)
at 
org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:774)
at 
org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:703)
at 
org.apache.jk.common.ChannelSocket$SocketConnection.runIt(ChannelSocket.java:896)
at 
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:690)

at java.lang.Thread.run(Thread.java:619)
Nov 15, 2010 11:48:00 PM org.apache.jk.common.ChannelSocket 
processConnection

SEVERE: Error, processing connection
java.lang.ArrayIndexOutOfBoundsException

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



Re: the tomcat encoding

2010-11-16 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Rob,

On 11/16/2010 4:31 AM, Rob Gregory wrote:
 I also use a filter to set the following:-
 
 request.setCharacterEncoding(UTF-8);
 response.setContentType(text/html; charset=UTF-8); 
 response.setCharacterEncoding(UTF-8);

FWIW, you shouldn't override any character encoding sent by the client.
If there is no encoding, feel free to default to UTF-8.

 Within the final html output I always include the following meta tag:-
 meta http-equiv=Content-Type content=text/xhtml;
 charset=utf-8/meta

This only makes sense if the response is actually in UTF-8. I would
recommend something like this:

meta http-equiv=Content-Type content=text/xhtml;
charset={response.characterEncoding} /

http://wiki.apache.org/tomcat/FAQ/CharacterEncoding

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

iEYEARECAAYFAkzi2RQACgkQ9CaO5/Lv0PBlaQCeOMxcnhPuX4hV/TPHT94+tmaM
oyMAoKR87o0U7voSaQ0OiUg9useP/aGJ
=O2Sy
-END PGP SIGNATURE-

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



Re: After manager says that there was a leak, how to use a profiler?

2010-11-16 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Brian,

On 11/16/2010 10:42 AM, Brian wrote:
 If I choose
 the report of Paths from GC roots from it, I see LOTS of items! And all of
 them have the loader of indication. All the items are classes programmed
 by me, so I guess I'm guilty, and not the people that programmed Tomcat
 ;-)  . They are DTOs, facades, Struts actionforms, etc. 
 Why are all these classes in the list?

If these are java.lang.Class objects, then you are looking at the list
of classes loaded by the WebappClassLoader. These are the objects that
make up the memory block that is unrecoverable. It's not the Class
objects themselves that are holding onto references to the ClassLoader,
it's the other way around.

 What should I check about them? Why are they still loaded?

The real problem is that there is an object that is still live
somewhere whose Class has been loaded by your webapp's WebappClassLoader.

 I guess there is something missing in my programming. Maybe I should do
 something about all the objects that are still alive that correspond to all
 the loaded classes? Maybe I need to do something in the contextDestroyed()
 method in the ServletContextListener in my app, in order to destroy all the
 objects properly?  

A basic rule is that anything you configure in a
ServletContextListener's contextStarted method needs to be destroyed in
the contextDestroyed method. Same thing for any Servlets that have
init() methods -- use the destroy() method to clean-up those resources.

When you undeploy, there may be a leak message in catalina.out. If you
post that, we might be able to help you.

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

iEYEARECAAYFAkzi3KwACgkQ9CaO5/Lv0PC/AwCgg9xb+4vGGrhp1DCVVUDrj5fL
03sAoJ4WjGXllEuymrPPf3BpAXPyMGzI
=VNNp
-END PGP SIGNATURE-

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



Re: Tomcat Going down Frequently

2010-11-16 Thread Pid
On 16/11/2010 14:59, Amol Puglia wrote:
 Hello Andre,
 
 We are proxying request from apache to tomcat using mod_proxy and 
 mod_proxy_ajp
 
 Following is the load balancer configuration in apache.
 
 kindly let me know in case you need further details.
 
 # Port 80
Listen server_name:80
#Listen 153.88.86.250:80
VirtualHost _default_:80
   ServerName server_name

 
   Timeout 10800
   ProxyTimeout 10800
   ProxyRequests Off
 
 

The next line:
ProxyPass /eMatrix balancer://cluster 
 stickysession=JSESSIONID|jsessionid nofailover=On
#ProxyPass /eMatrix balancer://cluster stickysession=JSESSIONID 
 nofailover=On
 
ProxyPreserveHost On
 

Overrides all of these lines, so they're no use:
ProxyPass /eMatrix ajp://server_name:8009/eMatrix
ProxyPass /eMatrix ajp://server_name:8010/eMatrix
   ProxyPass /eMatrix ajp://server_name:8011/eMatrix
   ProxyPass /eMatrix ajp://server_name:9009/eMatrix
   ProxyPass /eMatrix ajp://server_name:9010/eMatrix
   ProxyPass /eMatrix ajp://server_name:9011/eMatrix

I don't think* this applies, if the above is wrong:
ProxyPassReverse /eMatrix ajp://server_name:8009/eMatrix
ProxyPassReverse /eMatrix ajp://server_name:8010/eMatrix
ProxyPassReverse /eMatrix ajp://server_name:8011/eMatrix
ProxyPassReverse /eMatrix ajp://server_name:9009/eMatrix
ProxyPassReverse /eMatrix ajp://server_name:9010/eMatrix
ProxyPassReverse /eMatrix ajp://server_name:9011/eMatrix


p

* Someone will correct me if I'm wrong

Proxy balancer://cluster
  BalancerMember ajp://server_name:8009/eMatrix 
 route=marsprod_rmiserver_1 loadfactor=33 retry=60
  BalancerMember ajp://server_name:8010/eMatrix 
 route=marsprod_rmiserver_2 loadfactor=33 retry=60
  BalancerMember ajp://server_name:8011/eMatrix 
 route=marsprod_rmiserver_3 loadfactor=33 retry=60
  BalancerMember ajp://server_name:9009/eMatrix 
 route=marsprod_rmiserver_4 loadfactor=33 retry=60
  BalancerMember ajp://server_name:9010/eMatrix 
 route=marsprod_rmiserver_5 loadfactor=33 retry=60
  #load balancing performed based on number of user requests
  #ProxySet lbmethod=byrequests
  # Report server is for Report purpose only so balancing is required 
 now.
  BalancerMember ajp://server_name:9011/eMatrix 
 route=marsprod_rmiserver_6 loadfactor=33 retry=60
  ProxySet lbmethod=byrequests
/Proxy
 
#Status page for balancer
 
Location /balancer
SetHandler balancer-manager
Order Deny,Allow
Deny from all
Allow from all
   /Location
 
   ProxyStatus On
 
   Location /status
   SetHandler server-status
   Order Deny,Allow
   Deny from all
   Allow from all
   /Location
 
   ErrorLog /opt/web/apache/app/mxora/logs/error.log
 
 
 
   
/VirtualHost
 # END port 80
 
 --- On Tue, 11/16/10, André Warnier a...@ice-sa.com wrote:
 
 From: André Warnier a...@ice-sa.com
 Subject: Re: Tomcat Going down Frequently
 To: Tomcat Users List users@tomcat.apache.org
 Date: Tuesday, November 16, 2010, 4:55 PM
 
 Amol Puglia wrote:
 Hello Andre,

 Thanks for the updates. I am not using mod_jk , I am using proxy modules for 
 redirecting request from apache to tomcat.

 
 Ok, sorry, I confused your post with another one.
 
 But anyway, your configuration shows a whole lot of proxy modules, many of 
 which do not seem to have any relation with proxying calls to Tomcat. Such as 
 these :
 
 LoadModule proxy_connect_module modules/mod_proxy_connect.so
 LoadModule proxy_ftp_module modules/mod_proxy_ftp.so
 LoadModule proxy_scgi_module modules/mod_proxy_scgi.so
 
 The following /may/ have a relation with the proxying to Tomcat, but which 
 one are you really using ?
 
 LoadModule proxy_http_module modules/mod_proxy_http.so
 LoadModule proxy_ajp_module modules/mod_proxy_ajp.so
 
 Usually, people use *either* mod_proxy_http *or* mod_proxy_ajp, so which one 
 is being used ? Can you provide some information about the apache httpd 
 configuration that shows what is being proxied and how ?
 
 
 As you said that there is problem in application code, Is there anything we 
 can point out where exactly is the problem in the code or configuration?

 
 I thought that Pid already pointed that out.
 
 
 
 
 -
 To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
 For additional commands, e-mail: users-h...@tomcat.apache.org
 
 
 
 
   



0x62590808.asc
Description: application/pgp-keys


signature.asc
Description: OpenPGP digital signature


Re: Tomcat 6.0.29 Cookie.getMaxAge() always returns -1 regardless of actual value of maximum age

2010-11-16 Thread Pid
On 16/11/2010 16:58, Igor Barkon wrote:
 I run Tomcat 6.0.29 on Windows XP and IE 8.0.6001.18702.
 
 I noticed that getMaxAge() method of any cookie always returns -1 even for 
 persistent cookie with real positive value of maximum age. IE treats this 
 cookie 
 correctly: cookie persists for amount of seconds specified by setMaxAge 
 method. 
 But getMaxAge always return -1. Based on specification getMaxAge must return 
 actual value of maximum age of a given cookie, not default value. Is this a 
 bug?

How are you coming to this conclusion?

What code are you using?

What is setting the cookie?

What happens in other browsers?

What are the values of the relevant headers (Set-Cookie:, Cookie:) if
you use a traffic inspection tool (Fiddler, Firebug, Chrome/Safari
Developer)?


p


0x62590808.asc
Description: application/pgp-keys


signature.asc
Description: OpenPGP digital signature


Re: Tomcat 6.0.29 Cookie.getMaxAge() always returns -1 regardless of actual value of maximum age

2010-11-16 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Igor,

On 11/16/2010 11:58 AM, Igor Barkon wrote:
 I run Tomcat 6.0.29 on Windows XP and IE 8.0.6001.18702.
 
 I noticed that getMaxAge() method of any cookie always returns -1 even for 
 persistent cookie with real positive value of maximum age. IE treats this 
 cookie 
 correctly: cookie persists for amount of seconds specified by setMaxAge 
 method. 
 But getMaxAge always return -1. Based on specification getMaxAge must return 
 actual value of maximum age of a given cookie, not default value. Is this a 
 bug?

Are you checking the cookie you are generating on the server-side, or
are you inspecting the cookie sent by the client afterward? Clients
often do not send 100% of the cookie information back to the server with
the request.

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

iEYEARECAAYFAkzi4jgACgkQ9CaO5/Lv0PBpNwCfY1sifVzpczJODgPtBVPOFHj7
vXYAn07z64NXN1UcAUpfAiii2nfLu9ba
=j3LO
-END PGP SIGNATURE-

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



RE: Using mod_jk in cluster environment responds HTTP 500

2010-11-16 Thread Anthony J. Biacco
 
 
  worker.list=loadbal_hub_prod,jkstatus,hub0,hub1
 
 
 This is wrong.  If the workers are already balanced (by the
loadbal_hub_prod
 balancer),
 then they should not be separately listed in worker.list.
 Correct :
 worker.list=loadbal_hub_prod,jkstatus
 

Well, assuming he doesn't have any mounts pointing specifically to hub0
or hub1. In that case, he's fine.

-Tony


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



RE: Tomcat 6.0.29 using more and more RAM until it collapses?

2010-11-16 Thread Brian
Hu Pid,

Now that I looked, I did find something!


Nov 15, 2010 8:37:28 PM org.apache.catalina.loader.WebappClassLoader 
clearReferencesThreads
SEVERE: The web application [] is still processing a request that has yet to 
finish. This is very likely to create a memory leak. You can control the time 
allowed for requests to finish by using the unloadDelay attribute of the 
standard Context implementation.
Nov 15, 2010 8:37:28 PM org.apache.catalina.loader.WebappClassLoader 
clearReferencesThreads
SEVERE: The web application [] is still processing a request that has yet to 
finish. This is very likely to create a memory leak. You can control the time 
allowed for requests to finish by using the unloadDelay attribute of the 
standard Context implementation.
Nov 15, 2010 8:37:28 PM org.apache.catalina.loader.WebappClassLoader 
clearReferencesThreads
SEVERE: The web application [] is still processing a request that has yet to 
finish. This is very likely to create a memory leak. You can control the time 
allowed for requests to finish by using the unloadDelay attribute of the 
standard Context implementation.
Nov 15, 2010 8:37:29 PM org.apache.catalina.loader.WebappClassLoader loadClass
INFO: Illegal access: this web application instance has been stopped already.  
Could not load com.manuals.common.utility.Log.  The eventual following stack 
trace is caused by an error thrown for debugging purposes as well as to attempt 
to terminate the thread which caused the illegal access, and has no functional 
impact.
java.lang.IllegalStateException
at 
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1531)
at 
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1491)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
at 
com.manuals.model.utility.DatabaseObject.getStatement(DatabaseObject.java:434)
at 
com.manuals.model.utility.DatabaseObject.getQueryResultSet(DatabaseObject.java:366)
at 
com.manuals.model.utility.DatabaseObject.getQueryResultSet(DatabaseObject.java:326)


And also this:

ov 15, 2010 8:31:09 PM org.apache.catalina.core.StandardWrapper unload
INFO: Waiting for 1 instance(s) to be deallocated
Nov 15, 2010 8:31:10 PM org.apache.catalina.core.StandardWrapper unload
INFO: Waiting for 1 instance(s) to be deallocated
Nov 15, 2010 8:31:11 PM org.apache.catalina.core.StandardWrapper unload
INFO: Waiting for 1 instance(s) to be deallocated
Nov 15, 2010 8:31:12 PM org.apache.catalina.core.StandardWrapper unload
INFO: Waiting for 1 instance(s) to be deallocated
Nov 15, 2010 8:31:13 PM org.apache.catalina.core.StandardWrapper unload
INFO: Waiting for 1 instance(s) to be deallocated
Nov 15, 2010 8:31:14 PM org.apache.catalina.core.StandardWrapper unload
INFO: Waiting for 1 instance(s) to be deallocated
Nov 15, 2010 8:31:16 PM org.apache.catalina.loader.WebappClassLoader 
clearReferencesThreads
SEVERE: The web application [] appears to have started a thread named [MySQL 
Statement Cancellation Timer] but has failed to stop it. This is very likely to 
create a memory leak.
Nov 15, 2010 8:31:20 PM org.apache.catalina.core.StandardContext stop
INFO: Container 
org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/] has not been 
started
Nov 15, 2010 8:31:21 PM org.apache.catalina.startup.HostConfig checkResources
INFO: Undeploying context []








 -Original Message-
 From: Pid [mailto:p...@pidster.com]
 Sent: Tuesday, November 16, 2010 03:43 AM
 To: Tomcat Users List
 Subject: Re: Tomcat 6.0.29 using more and more RAM until it collapses?
 
 On 16/11/2010 05:08, Brian wrote:
   I still have to find the reason of the leak.
 
 Tomcat attempts to find  notify you of potential memory leaks.  You
 reported messages in your logs at app reload.  Did you tell us what they are
 yet?
 
 
 p


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



Re: Tomcat 6.0.29 Cookie.getMaxAge() always returns -1 regardless of actual value of maximum age

2010-11-16 Thread Igor Barkon
Sorry, may be I use too many words to explain the problem. I just tried to be 
more specific.

I run development. Everything (including Tomcat itself) is located in the same 
computer. Tomcat is configured to port . 

I used example software provided by Tomcat and located in Tomcat webapps 
subdirectory. I just slightly modified it to scrutiny a little bit more on 
cookies. I added max age as input for a new cookie (sent from Tomcat to IE), 
and 
I displayed this field in a list of cookies (sent to Tomcat from IE). 

More specificaly: I created a new cookie with name, value and custom maximum 
age, and sent it to Tomcat as a parameter; I sent this cookie to IE as a 
cookie; 
next time when I created a new cookie the old one was available for me as a 
cookie and I displayed it on a screen to verify my entry. 
I noticed that max age was always displayed as -1 even though it was originally 
set to 60 and was treated by IE as 60 (cookie was disabled by IE in 60 seconds 
after it was created, as it is supposed to be).

Fiddler was usless, it did not see my transactions (probably because Tomcat and 
IE are located on the same computer). I used IE HTTP Analyzer v5.


Sincerely,

Igor

This is my servlet:

import javax.servlet.http.HttpServlet;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.RequestDispatcher;
import java.io.PrintWriter;
import java.util.ResourceBundle;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpSession;

public class CookieExampleIgor extends HttpServlet
{
 ResourceBundle rb = ResourceBundle.getBundle(LocalStrings);
 public void  doGet(
HttpServletRequest request,
HttpServletResponse response

   ) throws IOException, ServletException
 {
  String cookieName;
  String cookieValue;
  int iMaxAge = -1;
  String sMaxAge;
  response.setContentType(text/html);
 
  PrintWriter out = response.getWriter();
     out.println(html);
     out.println(head);
     String title = rb.getString(cookies.title);
     out.println(title + title + /title);
     out.println(/head);
     out.println(body);
  out.println(form action=\CookieExampleIgor\ method=\post\);
    out.println(a href=\../cookies.html\);
    out.println(img src=\../images/code.gif\ height=24  +
    width=24 align=right border=0 alt=\view code\/a);
    out.println(a href=\../index.html\);
    out.println(img src=\../images/return.gif\ height=24  +
    width=24 align=right border=0 alt=\return\/a);
    out.println(h3 + title + /h3);

  out.println(This is Igor\'s job while investigating cookiesbr);

  HttpSession hs = request.getSession(false);
  if ((request.getParameter(sessionreset) != null)  (hs != null))
  {
   hs.invalidate();
   out.println(Session has been invalidatedbr);
  };

  if ((request.getParameter(sessioncreate) != null)  (hs == null))
  {
   hs = request.getSession();
  };

  if(hs != null)
  {
   out.println(Session ID:  + hs.getId() + br);
   out.println(Session Max Inactive Interval:  + hs.getMaxInactiveInterval() 
+ 
br);
  }
  else
  {
   out.println(Session ID: nullbr);
  }

  cookieName = request.getParameter(cookiename);
  cookieValue = request.getParameter(cookievalue);
  sMaxAge = request.getParameter(maxage);

  if (request.getParameter(submitcookie) != null  cookieName != null  
cookieValue != null 

 cookieName !=   cookieValue != 
   )
  {
   if (sMaxAge != null)
   {
try
{
 iMaxAge = Integer.decode(sMaxAge);
}
catch (NumberFormatException e)
{
 sMaxAge += ; NumberFormatException; Default value is used  + iMaxAge;;
}
   }
   else
   {
sMaxAge = Null value specified; Default value is used  + iMaxAge; 
   }
   Cookie newCookie = new Cookie(cookieName, cookieValue); 
   newCookie.setMaxAge(iMaxAge);        // I set it to 60, and it was 60, IE 
disabled it in 60 secs
   response.addCookie(newCookie);
   out.println(p);
   out.println(rb.getString(cookies.set) + /br);
   out.println(Name: + cookieName + /br);
   out.println(Value: + cookieValue + br);
   out.println(Max Age: + sMaxAge);
   out.println(/p);
  }
  Cookie[] cookies = request.getCookies();
  if (cookies != null  cookies.length  0) 
  {
   out.println(br + rb.getString(cookies.cookies));
   for(int i = 0; i  cookies.length; i++)
   {
out.println(brCookie name:  + cookies[i].getName());
out.println(nbsp;Cookie value:  + cookies[i].getValue()); 
out.println(nbsp;Max Age:  + cookies[i].getMaxAge()); // It is 
always 
-1 on display
out.println(nbsp;Path:  + cookies[i].getPath()); 
   }
   
  }
  else
  {
   out.println(br + rb.getString(cookies.no-cookies));
  }

  out.println(p);
  out.println(rb.getString(cookies.make-cookie) + br);
  out.println(Name:input type = \text\ name = \cookiename\br);
  out.println(Value:input type = \text\ name = \cookievalue\br);
  

Re: Tomcat 6.0.29 Cookie.getMaxAge() always returns -1 regardless of actual value of maximum age

2010-11-16 Thread Igor Barkon
I created cookie as a parameter on IE and sent it to Tomcat. On server the 
parameter was transformed to a cookie and sent back to IE. Next time when IE 
sent new request to the server, the old cookie is part of Request (now it is 
cookie, nort parameter), so I can display this information to verify.

I also believe that IE just sent incomplete information to Server, only name 
and 
value.



From: Christopher Schultz ch...@christopherschultz.net
To: Tomcat Users List users@tomcat.apache.org
Sent: Tue, November 16, 2010 1:57:44 PM
Subject: Re: Tomcat 6.0.29 Cookie.getMaxAge() always returns -1 regardless of 
actual value of maximum age

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Igor,

On 11/16/2010 11:58 AM, Igor Barkon wrote:
 I run Tomcat 6.0.29 on Windows XP and IE 8.0.6001.18702.
 
 I noticed that getMaxAge() method of any cookie always returns -1 even for 
 persistent cookie with real positive value of maximum age. IE treats this 
cookie 

 correctly: cookie persists for amount of seconds specified by setMaxAge 
 method. 

 But getMaxAge always return -1. Based on specification getMaxAge must return 
 actual value of maximum age of a given cookie, not default value. Is this a 
bug?

Are you checking the cookie you are generating on the server-side, or
are you inspecting the cookie sent by the client afterward? Clients
often do not send 100% of the cookie information back to the server with
the request.

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

iEYEARECAAYFAkzi4jgACgkQ9CaO5/Lv0PBpNwCfY1sifVzpczJODgPtBVPOFHj7
vXYAn07z64NXN1UcAUpfAiii2nfLu9ba
=j3LO
-END PGP SIGNATURE-

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

Re: Tomcat Going down Frequently

2010-11-16 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

André,

On 11/16/2010 1:21 PM, André Warnier wrote:
 WARNING: Exception processing manager
 org.apache.catalina.session.standardmana...@a20981 background process
 java.lang.IllegalStateException: getAttributeNames: Session already
 invalidated
 at
 org.apache.catalina.session.StandardSession.getAttributeNames(StandardSession.java:1052)
 
 at
 org.apache.catalina.session.StandardSessionFacade.getAttributeNames(StandardSessionFacade.java:120)
 
 at com.ericsson.mars.jspbean.LoginBean.logout(LoginBean.java:2366)
 at
 com.ericsson.mars.jspbean.LoginBean.valueUnbound(LoginBean.java:2450)

Just to add a bit more for reference:

 at 
 org.apache.catalina.session.StandardSession.removeAttributeInternal(StandardSession.java:1654)
 at 
 org.apache.catalina.session.StandardSession.expire(StandardSession.java:756)
 at 
 org.apache.catalina.session.StandardSession.isValid(StandardSession.java:592)
 at 
 org.apache.catalina.session.ManagerBase.processExpires(ManagerBase.java:680)

It looks like LoginBean implements HttpSessionBindingListener and it's
being triggered during the expiration of the session.

I actually don't see any reason why this code should cause an exception:

1. The valueUnbound method must be called after the value is
inaccessible via HttpSession.getAttribute
2. There is no way for a client to check the validity of an HttpSession
object before calling getAttribute (or setAttribute for that matter)

The HttpSession interface javadoc says For session that are invalidated
or expire, notifications are sent after the session has been invalidated
or expired. which means that, at least, the state above is correct.

 The above is a WARNING message, indicating that Tomcat has caught
 something unusual.

The important point there is that it is a WARNING. So, 3 things:

1. This is an exception, not some fatal condition
2. This exception is being caught a logged, so you shouldn't worry too much
3. This is logged as a WARNING, so you shouldn't worry too much


Now, if this exception is actually causing the container to shut itself
down, then it's a serious problem. Here's how you can check:

1. Start Tomcat normally
2. Log into your webapp
3. Log out of your webapp (this should trigger LoginBean.valueUnbound)
4. See if Tomcat shuts down

If Tomcat stays running, then you're okay so far. Now:

1. Change the session timeout from whatever it is (default=30 minutes)
   to 1 minute
2. Start Tomcat normally
3. Log into your webapp
4. Wait 2 minutes (use a stopwatch)
5. Try to do something with your webapp

If Tomcat stays running, then this exception is just a warning and your
stability problems lie elsewhere.

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

iEYEARECAAYFAkzi9HQACgkQ9CaO5/Lv0PAKUQCgtKUMQlT0Zy75blGbOi5K8Hce
lEMAnR43PzXl79cADDCXZBgejk1e1cT7
=CCSL
-END PGP SIGNATURE-

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



RE: After manager says that there was a leak, how to use a profiler?

2010-11-16 Thread Brian
All my JARs are in the shared directory that Tomcat has. I don't upload them
in the WAR everytime I deploye again my app.
Is that a problem? I have just read somewhere do it could actually be a
problem, that when they are shared among the apps, bad things happen.
I have basically two apps running, but are EXACTLY the same WAR, but they
run in different domain names. So they use the same JARs, and do exactly the
same. The other 20 WARs are just full of static HTML pages.



 -Original Message-
 From: Mark Thomas [mailto:ma...@apache.org]
 Sent: Tuesday, November 16, 2010 04:37 AM
 To: Tomcat Users List
 Subject: Re: After manager says that there was a leak, how to use a
profiler?
 
 On 16/11/2010 04:12, Brian wrote:
  Maybe my question sounded too vague and repetitive.
  What I meant is something like this Is the a class loader (or
  something like that) than I should start analyzing? I mean, is there a
  route I should follow in order to see which objects are stucked? If
  the Tomcat Manager knows that something got stucked in the memory,
 how
  does it know that? Is there a clue we should start?.
 
 http://markmail.org/message/fcbvwapt6afyndxn
 
 Mark
 
 
 -
 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: After manager says that there was a leak, how to use a profiler?

2010-11-16 Thread Caldarale, Charles R
 From: Brian [mailto:bbprefix-m...@yahoo.com] 
 Subject: RE: After manager says that there was a leak, how to use a profiler?

 All my JARs are in the shared directory that Tomcat has.
 Is that a problem?

Yes, that's a problem.  You very likely have some references in the shared 
classes that point to objects of one webapp or the other - and that will 
prevent their every being garbage collected.

Put the jars where they belong - in each webapp's WEB-INF/lib directory.  Disk 
is cheap, instability isn't.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY 
MATERIAL and is thus for use only by the intended recipient. If you received 
this in error, please contact the sender and delete the e-mail and its 
attachments from all computers.


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



Re: Using mod_jk in cluster environment responds HTTP 500

2010-11-16 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Rikslovein,

On 11/15/2010 12:47 AM, rikslovein wrote:
 Server.xml
 Connector port=8009 address=localhost 
 enableLookups=false redirectPort=8443 protocol=AJP/1.3 /

Is redirectPort=8443 correct for your environment? This has nothing to
do with your HTTP 500 problems, but it's worth having a clean config.

 workers.properties:
 workers.tomcat_home=/opt/webhost/DWH-Tomcat-Inst/tomcat5.5.23
 workers.java_home=/usr/lib/jvm/java-1.5.0
 ps=/

Remove the previous 3 properties: they have no effect and clutter your
configuration.

 worker.list=loadbal_hub_prod,jkstatus,hub0,hub1

I don't believe you have to mention hub0 and hub1 directly, here, but it
doesn't hurt.

 worker.hub0.port=8009
 worker.hub0.host=localhost
 worker.hub0.type=ajp13
 worker.hub0.lbfactor=1
 worker.hub0.redirect=hub1
 
 worker.hub1.port=9009
 worker.hub1.host=localhost
 worker.hub1.type=ajp13
 worker.hub1.lbfactor=1
 worker.hub1.redirect=hub0

Check out the worker.XXX.reference property: it will save you some
typing and help maintain consistency across lb workers.

What version of mod_jk are you currently using? Actually... what
versions of /everything/ are you using?

 worker.jkstatus.type=status
 
 worker.loadbal_hub_prod.type=lb
 worker.loadbal_hub_prod.balanced_workers=hub0,hub1
 worker.loadbal_hub_prod.sticky_session=false

I notice that you don't have any strategy for determining availability
of workers configured (ping_mode). You might want to look at those
options to determine what is appropriate for your environment.

I see that the sticky_session_force directive can result in a 500 error
being returned to a user who is trying to access a balanced worker in an
error state. I also see that you have sticky_session=false and the
sticky_session_force setting should be irrelevant. Is it possible that
your configuration file isn't actually being used? Try introducing a
syntax error into workers.properties and seeing if mod_jk complains
about it on startup.

Can you show us what the status worker says when you find that 500
responses are being returned?

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

iEYEARECAAYFAkzi948ACgkQ9CaO5/Lv0PAzVACeJ86i2QDwkljprTrSEJ7Axlz9
63MAn2YBHgUfBpEqqi1Tz0dtk73A4n+r
=ORgo
-END PGP SIGNATURE-

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



Re: Using mod_jk in cluster environment responds HTTP 500

2010-11-16 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Rikslovein,

On 11/15/2010 5:33 AM, rikslovein wrote:
 None of my tomcat is configured with HTTP connector. They are configured
 only for AJP. Does the jkmanager requires this HTTP port?

Do you mean the manager webapp that comes with Tomcat? No, it doesn't
require any HTTP connector.

 Any relation between the non-SSL HTTP connector and jkmanager?

There is no relationship between any webapp and any connector that I
know of.

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

iEYEARECAAYFAkzi+AEACgkQ9CaO5/Lv0PAr1gCeI4fY5f0RyBSjGjxprzXlzGul
/0sAn2EOuqT6qNR6lcD4YKNs0d0/mLCC
=IyKY
-END PGP SIGNATURE-

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



Re: Tomcat 6.0.29 using more and more RAM until it collapses?

2010-11-16 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Brian,

On 11/16/2010 3:23 PM, Brian wrote:
 Nov 15, 2010 8:37:28 PM org.apache.catalina.loader.WebappClassLoader 
 clearReferencesThreads
 SEVERE: The web application [] is still processing a request that has yet to 
 finish. This is very likely to create a memory leak. You can control the time 
 allowed for requests to finish by using the unloadDelay attribute of the 
 standard Context implementation.

Looks like you have some (or at least one) long-running request. Maybe
it's generating a ton of buffered output, too :)

 Nov 15, 2010 8:37:28 PM org.apache.catalina.loader.WebappClassLoader 
 clearReferencesThreads
 SEVERE: The web application [] is still processing a request that has yet to 
 finish. This is very likely to create a memory leak. You can control the time 
 allowed for requests to finish by using the unloadDelay attribute of the 
 standard Context implementation.

Again.

 Nov 15, 2010 8:37:28 PM org.apache.catalina.loader.WebappClassLoader 
 clearReferencesThreads
 SEVERE: The web application [] is still processing a request that has yet to 
 finish. This is very likely to create a memory leak. You can control the time 
 allowed for requests to finish by using the unloadDelay attribute of the 
 standard Context implementation.

Interesting that it generated all of these messages at the same time.
I'm not sure if that means you have 3 requests pending or that 3
different problems were found with one thread.

 Nov 15, 2010 8:37:29 PM org.apache.catalina.loader.WebappClassLoader loadClass
 INFO: Illegal access: this web application instance has been stopped already. 
  Could not load com.manuals.common.utility.Log.  The eventual following stack 
 trace is caused by an error thrown for debugging purposes as well as to 
 attempt to terminate the thread which caused the illegal access, and has no 
 functional impact.
 java.lang.IllegalStateException
   at 
 org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1531)
   at 
 org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1491)
   at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
   at 
 com.manuals.model.utility.DatabaseObject.getStatement(DatabaseObject.java:434)
   at 
 com.manuals.model.utility.DatabaseObject.getQueryResultSet(DatabaseObject.java:366)
   at 
 com.manuals.model.utility.DatabaseObject.getQueryResultSet(DatabaseObject.java:326)

So that thread is actually doing something -- it hasn't just blocked
indefinitely: your DatabaseObject class is causing the WebappClassLoader
to attempt to load a new class that hadn't been previously loaded. Since
WebappClassLoader knows it's shutting down (or has already shut down at
that point), it is refusing to fulfill the request.

 And also this:
 
 ov 15, 2010 8:31:09 PM org.apache.catalina.core.StandardWrapper unload
 INFO: Waiting for 1 instance(s) to be deallocated
 Nov 15, 2010 8:31:10 PM org.apache.catalina.core.StandardWrapper unload
 INFO: Waiting for 1 instance(s) to be deallocated
 Nov 15, 2010 8:31:11 PM org.apache.catalina.core.StandardWrapper unload
 INFO: Waiting for 1 instance(s) to be deallocated
 Nov 15, 2010 8:31:12 PM org.apache.catalina.core.StandardWrapper unload
 INFO: Waiting for 1 instance(s) to be deallocated
 Nov 15, 2010 8:31:13 PM org.apache.catalina.core.StandardWrapper unload
 INFO: Waiting for 1 instance(s) to be deallocated
 Nov 15, 2010 8:31:14 PM org.apache.catalina.core.StandardWrapper unload
 INFO: Waiting for 1 instance(s) to be deallocated

Since these messages are from earlier, I assume you were just pasting
them in arbitrary order into your post: it looks like Tomcat waited for
a while for your requests to complete (looping, complaining once per
second) and then finally gave up and issued the messages above
(...still processing a request...) at the end.

 Nov 15, 2010 8:31:16 PM org.apache.catalina.loader.WebappClassLoader 
 clearReferencesThreads
 SEVERE: The web application [] appears to have started a thread named [MySQL 
 Statement Cancellation Timer] but has failed to stop it. This is very likely 
 to create a memory leak.

There is almost nothing you can do about this except to upgrade your
MySQL driver: http://bugs.mysql.com/bug.php?id=36565

 Nov 15, 2010 8:31:20 PM org.apache.catalina.core.StandardContext stop
 INFO: Container 
 org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/] has not 
 been started

This is a different issue. Note that [] (root) is not [/]. Have you
specified your webapp's path somewhere. Don't do that.

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

iEYEARECAAYFAkzi+qwACgkQ9CaO5/Lv0PAK6ACbBl2mBZnnwYFA5aw6GhA3bDxA
kaEAoKhOgsCFMe6N0hgVrmLCMebU4OVw
=sklc
-END PGP SIGNATURE-

-
To unsubscribe, e-mail: 

Re: Tomcat 6.0.29 Cookie.getMaxAge() always returns -1 regardless of actual value of maximum age

2010-11-16 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Igor,

On 11/16/2010 3:40 PM, Igor Barkon wrote:
 I created cookie as a parameter on IE and sent it to Tomcat. On server the 
 parameter was transformed to a cookie and sent back to IE. Next time when IE 
 sent new request to the server, the old cookie is part of Request (now it is 
 cookie, nort parameter), so I can display this information to verify.
 
 I also believe that IE just sent incomplete information to Server, only name 
 and 
 value.

I believe this is all that the HTTP session specification requires.

See http://www.faqs.org/rfcs/rfc2109.html section 4.3.4 or
http://www.faqs.org/rfcs/rfc2965.html section 3.3.4.

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

iEYEARECAAYFAkzi/EUACgkQ9CaO5/Lv0PAGkgCdEvXAF1pDDozFzC6CFt01fgc0
oBkAnj1Jy+Fsgh+yLyyGeh6jK/w212S6
=AKLz
-END PGP SIGNATURE-

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



Re: Usage of Tomcat SSL in client-side class

2010-11-16 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Moley,

On 11/16/2010 9:33 AM, Moley Harey wrote:
 My question is what do I have to do in my Java client-side classes to work
 with HTTPS requests [to] Tomcat? Do I have to accept somehow the certificate
 provided by Tomcat in my Java classes?

Yes. If you are using a certificate signed by a well-known CA (VeriSign,
Thawte, etc.) then you probably don't need to do anything special. If
you are using a self-signed certificate, you'll need to import that
certificate into your certificate store (cacerts) and make sure that
your client-side classes are configured to use it. Presumably, your web
services client library makes this kind of thing easy.

You'll, of course, have to use an https://; URL when trying to connect
as well. Presumably, your web services client library makes this kind of
thing easy.

 Well, I'm totally newbie in these security issues :-/

At least you're asking :)

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

iEYEARECAAYFAkzi/dkACgkQ9CaO5/Lv0PAMsgCfSV2S8E8leRxUlAMZnSnAuFRM
wF8An2wUwuj4a6LnFZ/ZMB27saseiI2V
=sbPz
-END PGP SIGNATURE-

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



Re: Buffer Overflow

2010-11-16 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Tyson,

First, let me say that I know almost nothing about the AJP protocol, but
reading-through the code from the inside out has triggered a memory. See
below.

On 11/16/2010 1:26 PM, Tyson Lowery wrote:
 I'm running Tomcat 6.0.29

Thanks!

 I'm seeing this in my catalina.out log file.  I've been able to narrow
 the problem to a single JSP page, and the problem only happens with a
 single user when that user is using Windows XP/FireFox 3.6.12.   I've
 tested the page with XP/Firefox 3.6.3 and can't reproduce the issue.  
 The JSP page reads and writes custom cookies.

Can you give us some examples? Is it possible that you are generating
very large cookie names and/or values?

 Any ideas on what might be happening, or on how to get more information
 (like what is actually in the header)?

You ought to be able to configure the logger to emit messages for the
org.apache.jk package tree. It looks like the code is generating debug
messages if the logging system is configured to capture them.

 Nov 15, 2010 11:48:00 PM org.apache.jk.common.MsgAjp cpBytes
 SEVERE: Buffer overflow: buffer.len=8192 pos=8190 data=103

8192 is the default packetSize option for the AJP Connector. It
appears that you are trying to shove more data into a single packet than
is possible.

It's not your fault. Well, sort-of, but not really. Your code is
probably fine.

I believe that either the AJP protocol or Tomcat's implementation of it
requires that all of the HTTP headers fit into the first AJP packet sent
back to the web server. So, if you have more than 8192 bytes of headers
to send back to the web server, you'll get this error. That's what I
asked about the large cookie values. It also happens when you use SSL
with proxied certificate chains which can eat up a lot of space, too.

Anyhow, there is good news: you can change the default packetSize like this:

Connector ... packetSize=16384 /

MAKE SURE YOU SET THE max_packet_size IN mod_jk TO BE THE SAME VALUE,
otherwise everything will go to hell. You can go up to 65536 bytes for
the packet size if you really need to. Note that larger packet sizes may
have a performance impact.

Another option would be to limit the total size of cookie information
you allow your custom JSP to emit. It's not foolproof (you can always
use some other header to reach this limit) but it might help if you are
not comfortable increasing the AJP packet size for some reason.

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

iEYEARECAAYFAkzjAYMACgkQ9CaO5/Lv0PAsLACdHmU8yeG26CeiFn8I7pBVXB6R
MBQAn1tUNC/aWasAKHuBhJ9EJAMQKonO
=pjT3
-END PGP SIGNATURE-

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



Re: Tomcat log files

2010-11-16 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Tobias,

On 11/15/2010 10:43 AM, Tobias Crefeld wrote:
 Am Tue, 09 Nov 2010 16:06:14 -0500
 schrieb Christopher Schultz ch...@christopherschultz.net:
 
 Have you correctly replaced lib/tomcat-juli.jar
 and installed lib/tomcat-juli-adapters.jar? If not, you may be falling
 back to the old logger which requires logging.properties.
 
 For whatever-reason and different than tomcat-juli-adapters.jar the
 default location of tomcat-juli.jar is bin/, not lib/. 

Thanks for pointing that out. I had been reading the docs and didn't
notice that they were different tomcat-juli.jar goes into bin/ while
tomcat-juli-adapters.jar goes into lib/).

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

iEYEARECAAYFAkzjAsIACgkQ9CaO5/Lv0PASzgCfVInqw5ASMbCoTGrLgFc2pcgS
5YMAn3S2YhSNRY/+9Rped7kixFOwdnnb
=lPVN
-END PGP SIGNATURE-

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



Re: Tomcat Going down Frequently

2010-11-16 Thread Pid
On 16/11/2010 21:15, Christopher Schultz wrote:
 2. There is no way for a client to check the validity of an HttpSession
 object before calling getAttribute (or setAttribute for that matter)
 
 The HttpSession interface javadoc says For session that are invalidated
 or expire, notifications are sent after the session has been invalidated
 or expired. which means that, at least, the state above is correct.

The class is calling: StandardSessionFacade.getAttributeNames.

Shouldn't we see the HttpSession class in the stacktrace, not the
implementation, if that's what they're calling?  Makes me think the OP
is interacting with Tomcat internal classes.


p


0x62590808.asc
Description: application/pgp-keys


signature.asc
Description: OpenPGP digital signature


RE: After manager says that there was a leak, how to use a profiler?

2010-11-16 Thread Brian
Thanks a lot for the info Konstantin. I will read it asap!

 -Original Message-
 From: Konstantin Kolinko [mailto:knst.koli...@gmail.com]
 Sent: Monday, November 15, 2010 11:08 PM
 To: Tomcat Users List
 Subject: Re: After manager says that there was a leak, how to use a
profiler?
 
 2010/11/16 Brian bbprefix-m...@yahoo.com:
  Hi,
 
  After the Tomcat manager warns that there was a leak with one app what
  was stopped or undeployed, how do I use the profiler to investigate
  that? I mean, that is the starting point to analize that? What should I
look
 for?
 
 
 E.g., using Eclipse MAT,
 [1] http://www.eclipse.org/mat/
 [2] http://dev.eclipse.org/blogs/memoryanalyzer/2008/05/17/the-unknown-
 generation-perm/
 
 Best regards,
 Konstantin Kolinko
 
 -
 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: the tomcat encoding

2010-11-16 Thread xu cheng
hi:
thanks, the problem is that my tomcat interact with other server and the
server use somekind of encoding that is different.
and after the encoding is transfered .it works now
thanks

2010/11/17 Christopher Schultz ch...@christopherschultz.net

 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA1

 Rob,

 On 11/16/2010 4:31 AM, Rob Gregory wrote:
  I also use a filter to set the following:-
 
  request.setCharacterEncoding(UTF-8);
  response.setContentType(text/html; charset=UTF-8);
  response.setCharacterEncoding(UTF-8);

 FWIW, you shouldn't override any character encoding sent by the client.
 If there is no encoding, feel free to default to UTF-8.

  Within the final html output I always include the following meta tag:-
  meta http-equiv=Content-Type content=text/xhtml;
  charset=utf-8/meta

 This only makes sense if the response is actually in UTF-8. I would
 recommend something like this:

 meta http-equiv=Content-Type content=text/xhtml;
 charset={response.characterEncoding} /

 http://wiki.apache.org/tomcat/FAQ/CharacterEncoding

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

 iEYEARECAAYFAkzi2RQACgkQ9CaO5/Lv0PBlaQCeOMxcnhPuX4hV/TPHT94+tmaM
 oyMAoKR87o0U7voSaQ0OiUg9useP/aGJ
 =O2Sy
 -END PGP SIGNATURE-

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




Placing JARs in ..../tomcat/shared/lib causes leaks when stopping apps?

2010-11-16 Thread Brian
Hi,

 

I'm using Tomcat 6.0.29.

 

I have two identical apps running at the same time. I mean, they use exactly
the same WAR, but each one runs in a different web domain. When I
stop/redeploy one of the apps, very often I get the famous leak problem,
because of the webclassloader not being able to get collected by the garbage
collector. etc etc etc.

 

I'm placing all my library JARs in a common directory
(../tomcat/shared/lib), and I set the catalina.properties file so Catalina
knows this directory exists. Why did I do that? For two reasons:

 

1- uploading a WAR without all the support JARs is faster than with them,
and I'm uploading my WARs very often, because I'm changing my app
constantly.

2- I THOUGHT/THINK that placing the JARs in the same shared directory is
better, because it takes less memory, and because after all there must be a
reason why the shared directory option existed by default (at least until
Tomcat 6.0.14 came out). And given that my two apps use exactly the same
WAR, it made sense to me to place the JARs in the shared dir.

 

Now I have read that this issue may be the reason of my problem with leaks.
Something like this for each app, the webapploader pretendes to unload all
the classes, and if they are shared it is not possible and then the leak
happens.

 

Is that true? Should I avoid using the shared lib directory? If so, for what
was this option created for?

 

Thanks,

 

Brian

 

 

 



RE: Placing JARs in ..../tomcat/shared/lib causes leaks when stopping apps?

2010-11-16 Thread Caldarale, Charles R
 From: Brian [mailto:bbprefix-m...@yahoo.com] 
 Subject: Placing JARs in /tomcat/shared/lib causes leaks when stopping 
 apps?

 Something like this for each app, the webapploader pretendes 
 to unload all the classes, and if they are shared it is not 
 possible and then the leak happens.

Well, the wording of the above is rather odd; there's no pretending going on, 
and nothing can unload a class directly - that's done only by GC after the 
class becomes unused.

 Is that true? 

Sort of.

 Should I avoid using the shared lib directory?

In almost all cases, yes.  It's safe to use the shared library when the classes 
placed therein truly are library functions (no persistent objects, no keeping 
of references to their callers), or when an object *must* be shared across 
multiple webapps.

 If so, for what was this option created for?

To allow /objects/ to be shared across webapps, in the rare instance that it's 
necessary.  Webapps are intended to be independent of one another, and any 
mingling of their content limits that independence severely - as you are 
observing.

Keep the webapps separate; it's a lot easier on everyone concerned.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY 
MATERIAL and is thus for use only by the intended recipient. If you received 
this in error, please contact the sender and delete the e-mail and its 
attachments from all computers.


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



RE: Placing JARs in ..../tomcat/shared/lib causes leaks when stopping apps?

2010-11-16 Thread Brian
Thanks chuck, now I understand it. My JARs are the regular type of JAR, that
doesn't have to be shared by all the apps for some reason. I didn't
understand the real pourpose of that directory indeed. I will change it now.


 -Original Message-
 From: Caldarale, Charles R [mailto:chuck.caldar...@unisys.com]
 Sent: Tuesday, November 16, 2010 11:06 PM
 To: Tomcat Users List
 Subject: RE: Placing JARs in /tomcat/shared/lib causes leaks when
 stopping apps?
 
  From: Brian [mailto:bbprefix-m...@yahoo.com]
  Subject: Placing JARs in /tomcat/shared/lib causes leaks when
stopping
 apps?
 
  Something like this for each app, the webapploader pretendes to
  unload all the classes, and if they are shared it is not possible and
  then the leak happens.
 
 Well, the wording of the above is rather odd; there's no pretending going
on,
 and nothing can unload a class directly - that's done only by GC after the
class
 becomes unused.
 
  Is that true?
 
 Sort of.
 
  Should I avoid using the shared lib directory?
 
 In almost all cases, yes.  It's safe to use the shared library when the
classes
 placed therein truly are library functions (no persistent objects, no
keeping of
 references to their callers), or when an object *must* be shared across
 multiple webapps.
 
  If so, for what was this option created for?
 
 To allow /objects/ to be shared across webapps, in the rare instance that
it's
 necessary.  Webapps are intended to be independent of one another, and any
 mingling of their content limits that independence severely - as you are
 observing.
 
 Keep the webapps separate; it's a lot easier on everyone concerned.
 
  - Chuck
 
 
 THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE
 PROPRIETARY MATERIAL and is thus for use only by the intended recipient.
If
 you received this in error, please contact the sender and delete the
e-mail and
 its attachments from all computers.
 
 
 -
 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: Using mod_jk in cluster environment responds HTTP 500

2010-11-16 Thread rikslovein

Chris  all,

Thanks for your help and your responses once again. I now solved the
problem. The problem was with the jkmanager URL I was using in the code. 

I think there is a change in URL attributes from older version. The current
version uses vwa, vwr and vwf (which was coded as wa, wr  wf respectively).
I'm not sure on this but i saw them working on Unix where we have quite
older version of Apache and Tomcat installed. Please confirm on this if you
have any info.

The jkmanager URL i was using previously and the changed URL is given below:

Older URL (Works in Unix): -
http://localhost/jkmanager/?cmd=updatew=loadbal_hub_prodsw=hub1wf=1wr=hub0wa=2mime=txt

Changed URL (Working fine now on Linux): -
http://localhost/jkmanager/?cmd=updatew=loadbal_hub_prodsw=hub1vwf=1vwr=hub0vwa=2mime=txt

Thanks a lot again.

Regards.

Christopher Schultz-2 wrote:
 
 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA1
 
 Rikslovein,
 
 On 11/15/2010 5:33 AM, rikslovein wrote:
 None of my tomcat is configured with HTTP connector. They are configured
 only for AJP. Does the jkmanager requires this HTTP port?
 
 Do you mean the manager webapp that comes with Tomcat? No, it doesn't
 require any HTTP connector.
 
 Any relation between the non-SSL HTTP connector and jkmanager?
 
 There is no relationship between any webapp and any connector that I
 know of.
 
 - -chris
 -BEGIN PGP SIGNATURE-
 Version: GnuPG v1.4.10 (MingW32)
 Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
 
 iEYEARECAAYFAkzi+AEACgkQ9CaO5/Lv0PAr1gCeI4fY5f0RyBSjGjxprzXlzGul
 /0sAn2EOuqT6qNR6lcD4YKNs0d0/mLCC
 =IyKY
 -END PGP SIGNATURE-
 
 -
 To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
 For additional commands, e-mail: users-h...@tomcat.apache.org
 
 
 

-- 
View this message in context: 
http://old.nabble.com/Using-mod_jk-in-cluster-environment-responds-HTTP-500-tp30198809p30235421.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



Request count increases drastically in tomcat 6.0.29

2010-11-16 Thread rujin raj
Hi,

I am using an application in tomcat 6.0.29 and the java version is 1.6
 64 bit. I am facing the problem in my application when the request
count is more(this i am watching through Lambda probe).

Please give me some idea why this request count is keeps increasing
and how to destroy the idle requests.Herewith i attached the
screenshot of that application

--rujin


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

Re: Placing JARs in ..../tomcat/shared/lib causes leaks when stopping apps?

2010-11-16 Thread Mikolaj Rydzewski


On Tue, 16 Nov 2010 22:55:10 -0500, Brian bbprefix-m...@yahoo.com 
wrote:


I have two identical apps running at the same time. I mean, they use 
exactly

the same WAR, but each one runs in a different web domain.

[...]

You should rather change your application to be aware of domain it runs 
in.
Done that, there would be only one webapp deployed - no matter how many 
domains you need to handle.


--
Mikolaj Rydzewski m...@ceti.pl

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