Re: Tomcat memory allocation

2011-12-09 Thread Ronald Klop (Mailing List)




Op vrijdag, 9 december 2011 16:11 schreef Pid p...@pidster.com:




On 09/12/2011 14:52, Martin O'Shea wrote:

 -Original Message-
 From: Caldarale, Charles R [mailto:chuck.caldar...@unisys.com]
 Sent: 09 Dec 2011 14 46
 To: Tomcat Users List
 Subject: RE: Tomcat memory allocation

 From: Martin O'Shea [mailto:app...@dsl.pipex.com]
 Subject: Tomcat memory allocation

 Following advice found elsewhere on the internet

 Always to be taken with large chunks of salt.

 set JAVA_OPTS=%JAVA_OPTS% -Xms128m -Xmx512m -XX:MaxPermSize=128m

 You would be better off using CATALINA_OPTS, since setting JAVA_OPTS
 pointlessly affects the shutdown script as well as the startup one.

 I know that settings:
 Xms128m -Xmx512m

 Control the initial heap size and what it can expand to.

 In a server environment, you normally want Xms and Xmx set to the same value
 to avoid heap thrashing.  The exact size is completely dependent on what
 your webapps need.

 But what exactly is:
 -XX:MaxPermSize=128m

 It's the amount of space to which the so-called permanent generation can
 expand.  PermGen holds primarily instances of java.lang.Class, so it only
 needs to be specified if you have a large number of classes in your
 environment.

 Should it be set to an addition of the other settings, or the other
 settings to an addition of it?

 What does that question mean?  PermGen size is completely independent of the
 heap size.

 Make sure you have enough RAM available on the system to support the Xmx +
 PermGen + a_lot_of_other_stuff.  Monitor the system to make sure you're not
 getting into paging.

  
 Thanks for this Chuck. I realise now what is happening. I thought the

 PermGen space was used in the heap when now I see it as just storing class
 definitions. So I could reduce it below 128Mb if I choose. Is there a
 default value?

 As to setting Xms and Xmx to the same, I will do that. A job hung earlier
 and I wonder if memory was to blame although there is nothing in the
system
 or server logs to say so.

Connect VisualVM to your Tomcat instance and use the monitor tab to
observe the actual PermGen usage.  It should be pretty stable, unless
you're doing something funky like generating classes or using RMI.

You'll then know how much you need to allocate.


p




--

[key:62590808]
 









Don't forget jstat also:
$ jstat -gc -h 10 -t 84762 3s
TimestampS0CS1CS0US1U  EC   EUOC OU   PC PUYGC YGCTFGCFGCT GCT  
  700819.2 1792.0 1792.0 288.0   0.0640.0289.280320.061284.6   95296.0 95013.75163.182  20064.692   67.874

  700822.2 1792.0 1792.0 288.0   0.0640.0289.280320.0
61284.6   95296.0 95013.75163.182  20064.692   67.874
  700825.2 1792.0 1792.0 288.0   0.0640.0289.280320.0
61284.6   95296.0 95013.75163.182  20064.692   67.874
  700828.2 1792.0 1792.0 288.0   0.0640.0289.280320.0
61284.6   95296.0 95013.75163.182  20064.692   67.874
  700831.1 1792.0 1792.0 288.0   0.0640.0315.580320.0
61284.6   95296.0 95013.75163.182  20064.692   67.874
  700834.2 1792.0 1792.0 288.0   0.0640.0323.080320.0
61284.6   95296.0 95013.75163.182  20064.692   67.874
  700837.2 1792.0 1792.0 288.0   0.0640.0323.080320.0
61284.6   95296.0 95013.75163.182  20064.692   67.874
Ronald.

Re: [OT]RE: Maximum memory that can be assigned to Tomcat on windows platform

2011-12-01 Thread Ronald Klop (Mailing List)




Op donderdag, 1 december 2011 09:39 schreef Casper Wandahl Schmidt 
kalle.pri...@gmail.com:


  
 See below. I hope MS Outlook does some decent indend so my response is clear -.-
 
 -Original Message-

 From: Christopher Schultz [mailto:ch...@christopherschultz.net]
 Sent: 30. november 2011 18:51
 To: Tomcat Users List
 Subject: Re: Maximum memory that can be assigned to Tomcat on windows platform
 
 -BEGIN PGP SIGNED MESSAGE-

 Hash: SHA1
 
 Casper,
 
 On 11/30/11 3:37 AM, Casper Wandahl Schmidt wrote:

  Another question to ask is, why do you have 8GB memory when running
  32bit? That is just stupid since 32bit cannot address more than 4GB of
  memory no matter what you do. Any sysadmin should know that right?
 
 That's per process. All reasonably recent 32-bit OSs can address way more than 4GiB internally.
 
 For example:

 
http://msdn.microsoft.com/en-us/library/windows/desktop/aa366778%28v=vs.85%29.aspx#memory_limits
 
 This is generally done through PAE

 (http://en.wikipedia.org/wiki/Physical_Address_Extension) which allows 32-bit 
OSs to access more than 4GiB at the kernel level, though each process is still 
limited to 4GiB.
 
 Aha so I learned something new today :) I'm still puzzled as to how a 32 bit CPU can compute and fetch a memory cell with address above 4GB since it cannot hold this large value. Anyway that is just too much low-level computer science for me, all I ever had was a seven week course on architecture and networking (a single week out of the seven) :)
 
 -Casper
 
 Running a machine with more than 4GiB in 32-bit mode isn't stupid at all IMO. If you have relatively small processes, there's no need for the overhead of 64-bit even if you have 16GiB or more.
 
 - -chris
  
 



  

I have an analogy for you.
If you look out of your window you only see a small part of the world. If you 
move your window you wil see another part of the world.
This is what the OS does with PAE. It moves the window on your RAM frequently. 
That is why a 32 bits application only sees max. 4GB. That is the size of its 
window.

Ronald.

timeout exception is ignored?

2011-12-01 Thread Ronald Klop (Mailing List)

Hi,

The method org.apache.catalina.connector.Request.parseParameters() contains 
this code.

   try {
if (readPostBody(formData, len) != len) {
return;
}
} catch (IOException e) {
// Client disconnect
if (context.getLogger().isDebugEnabled()) {
context.getLogger().debug(
sm.getString(coyoteRequest.parseParameters), 
e);
}
return;
}

When there is a timeout exception during reading of the postbody it is ignored 
and my servlet runs without parameters. Why is this? Why don't I get the 
exception in my code, so I can handle it?

Ronald.

RE: Tomcat clustering session attribute is changed without request

2011-10-25 Thread Ronald Klop (Mailing List)

Hi,

Replication of the attributes is done by the cluster valve.
http://tomcat.apache.org/tomcat-6.0-doc/config/cluster-valve.html

If you manage to call that code from your own application, than you can do what 
you want. But that is not default functionality of Tomcat. You have to make it 
yourself.

Ronald.

Op dinsdag, 25 oktober 2011 09:44 schreef Hodchenkov, Paul 
paul.hodchen...@oxagile.com:


  
 Hi All,

 I have used http://code.google.com/p/psi-probe/ to debug session replication.
 So HttpSession attribute is NOT replicated when it is changed without http 
request. It's value is changed only on the local tomcat.
 However, when attribute is changed with http request - everything works fine.
 So, is there any way to force the replication of HttpSession?
 -Original Message-
 From: Pid [mailto:p...@pidster.com]
 Sent: Monday, October 24, 2011 4:08 PM
 To: Tomcat Users List
 Subject: Re: Tomcat clustering session attribute is changed without request
 
 On 24/10/2011 14:05, Hodchenkov, Paul wrote:

  Hi,
  Thanks for the reply!
  - What does 'stores session map in memory' actually mean?
  It's ConcurrentMapString, HttpSession map which is filled by HttpListener. 
I can access session attributes of any user using this approach.
  Does changes to attributes in HttpSession cause a replication in this case?
 
 Don't know, probably.
 
  What is the benefit of using JMX connection to access the session instead of HttpListener in this case?
 
 It means you don't have to jump through hoops to access something that is already accessible elsewhere.
 
 
 p
 
  -Original Message-

  From: Pid [mailto:p...@pidster.com]
  Sent: Monday, October 24, 2011 3:59 PM
  To: Tomcat Users List
  Subject: Re: Tomcat clustering session attribute is changed without
  request
 
  On 24/10/2011 11:55, Hodchenkov, Paul wrote:
  Hi all,
  I have configured tomcat 7 cluster by using [1] with DeltaManager and it 
works fine.
  However I have the following 2 questions:
 
  1)  My application stores session map in memory(admin can force logout 
of any user and change some session attribute). Will this session attribute be 
replicated if it is changed without tomcat http request (changed by backend task for 
example)?
 
  What does 'stores session map in memory' actually mean?
 
  Instead of copying session objects around the place, why not just use the 
JMX API and the operations on the Manager MBean?
 
   Catalina:type=Manager,context=/myapp,host=localhost
 
 
  p
 
  2)  It's seems that expireSessionsOnShutdown=false in DeltaManager can 
solve the problem with 
http://old.nabble.com/sessionListener.sessionDestroyed-is-called-on-shutdown-of-a-node-in-the-cluster-td16178701.html?
  [1] http://tomcat.apache.org/tomcat-7.0-doc/cluster-howto.html
 
  Best Regards,
  Paul Hodchenkov
  Senior Java developer, Oxagile
  Skype: paul.hodchenkov
  Email: mailto:paul.hodchen...@oxagile.com
 
 
 
 
 
  -
  To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
  For additional commands, e-mail: users-h...@tomcat.apache.org
 
 
 
 
 -

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





Re: HOW TO detect what app server you're running in

2011-10-25 Thread Ronald Klop (Mailing List)

Does this help?

public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
System.out.println(serverinfo:  + 
getServletContext().getServerInfo());
}

Ronald.

Op dinsdag, 25 oktober 2011 13:33 schreef Bob DeRemer 
bob.dere...@thingworx.com:


  
 
 I may need to use some Tomcat-specific code in my web app.  As a result, I would like to detect [if possible] when I'm running in Tomcat, so I can invoke the logic.   If anyone knows how best to do this, ideally with some sample java code, that'd be great.
 
 Thanks,

 Bob
 



 


Re: Tomcat clustering session attribute is changed without request

2011-10-24 Thread Ronald Klop (Mailing List)




Op maandag, 24 oktober 2011 12:55 schreef Hodchenkov, Paul 
paul.hodchen...@oxagile.com:


  
 
 Hi all,

 I have configured tomcat 7 cluster by using [1] with DeltaManager and it works 
fine.
 However I have the following 2 questions:
 
 1)  My application stores session map in memory(admin can force logout of any user and change some session attribute). Will this session attribute be replicated if it is changed without tomcat http request (changed by backend task for example)?
 
 2)  It's seems that expireSessionsOnShutdown=false in DeltaManager can solve the problem with http://old.nabble.com/sessionListener.sessionDestroyed-is-called-on-shutdown-of-a-node-in-the-cluster-td16178701.html?

 [1] http://tomcat.apache.org/tomcat-7.0-doc/cluster-howto.html
 
 Best Regards,

 Paul Hodchenkov
 Senior Java developer, Oxagile
 Skype: paul.hodchenkov
 Email: mailto:paul.hodchen...@oxagile.com
  
 



 
  

Hi,

1. Changes in the session are only replicated at the end of a request. BTW: My 
experience with holding references to Sessions in your own map is that it is 
harder than you think. It is more easy to create a map with blocked userids and 
block those users with a filter.

2. I don't understand your question.

Ronald.

Re: URL simplification

2011-10-10 Thread Ronald Klop (Mailing List)

Simplified explanation:
Apache httpd starts as user root. Binds port 80 and than drops privileges by 
setuid(apache) or setuid(nobody).
In java you can't easily drop privileges. So if you start as root in Java you 
can't easily change user. Of course you can call native code to do this. And 
that is called jsvc.
http://commons.apache.org/daemon/jsvc.html

BTW: if you are not root on a server, you cannot bind port 80 with httpd also.
BTW2: there are all kinds of new ways of assigning privileges in unix since a 
few years which will make it more easy to say 'user x may bind to port 80'. But 
I have never seen anybody using it.

Ronald.


Op maandag, 10 oktober 2011 13:50 schreef Darryl Lewis 
darryl.le...@unsw.edu.au:


  
 Something I've always wondered about, but never figured out, is how does

 apache run as 'apache user' or 'nobody' and work on a port below 1024, but
 Tomcat can't?
 Anyone got a simple explanation?
 
 On 10/10/11 9:53 PM, Mark Thomas ma...@apache.org wrote:
 
 On 10/10/2011 09:56, Léa Massiot wrote:

 
  Hello,
 
  Thank you for reading my post. Here is my question:
 
  - Presently, to access my WebApp first page, I have to type in the
 following
  URL in a browser:
  http://hostname-or-ip:8080/my-webapp/
  - Instead, I wish I could type in a URL such as:
  http://my-webapp/
  Is it possible?
  How?
 
  And by the way, I don't know what's the name of such an operation. I
 used
  the expression URL simplification...
 
  Thank you for pointing me in the right direction!
 
 There are three parts to this.
 
 1. Removing /my-webapp/ from the end of the URL
- Deploy your web application as the ROOT web application
  Read the docs or search the list archives for the various
  ways of doing this.
 
 2. Removing the port (8080) from the URL
- Configure your HTTP connector to use port 80 rather than 8080
  Port 80 is privileged so you'll need to run as root (bad) or use
  a service wrapper (such as jsvc from Commons Daemon) that binds to
  port 80 as root and then drops privileges
- Use iptables (or equivalent) to map port 8080 to 80
 
 3. Replace hostname-or-ip with my-webapp
- This will require a DNS entry that resolves my-webapp to the IP
  address of the machine where Tomcat is running. This is probably
  already set up for the machines host name. If you don't want to use
  that, you can:
  - edit the hosts file on the client (fine for testing)
  - talk to your network administrator about adding an appropriate
DNS entry
 
 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: Preferred configuration with Hardware Loadbalancer

2011-10-06 Thread Ronald Klop (Mailing List)

What do you mean by Apache Webserver? Do you mean Apache Tomcat or Apache httpd?

And do you want Failover (active-passive) or Loadbalancing (active-active)?

Ronald.


Op donderdag, 6 oktober 2011 10:36 schreef Alexander Diedler 
adied...@tecracer.de:


  
 
 
 
Hello,  
 
I am just planning a Application cluster for Tomcat. We have a big hardware loadbalancer (Cisco) and three virtual servers. We talked about several configurations, but it is not clear for us, how to build a Tomcat cluster, with Failover and Session-Replication, but without Loadbalancing?  
 
E.g. the LB redirect the request to node 1. The Apache Webserver redirects the request to node2. So we have a double load-balancing, what ne would avoid.  
 
   
 
Best regards  
 
Alexander  
 
   
 
 
 
 
 
 


Re: AW: Preferred configuration with Hardware Loadbalancer

2011-10-06 Thread Ronald Klop (Mailing List)

I don't have a crystal ball to look into your setup, but I would remove httpd 
and set up the LB and Tomcat. Less moving parts, so it is easier to think about.

And read this: http://tomcat.apache.org/tomcat-7.0-doc/cluster-howto.html

Ronald.


Op donderdag, 6 oktober 2011 12:43 schreef Alexander Diedler 
adied...@tecracer.de:


  
 
 Hello,

 I mean a frontend Apache httpd and backend Tomcat server.
 Loadbalancing would be done by a hardware load balancer fronted to the
 Apache Webserver, so we should not balance the request two times. It should
 be only a Failovercluster.
 
 
 
 Best regards

 Alexander
 
 
 -Ursprüngliche Nachricht-

 Von: Ronald Klop (Mailing List) [mailto:ronald-mailingl...@base.nl]
 Gesendet: Donnerstag, 6. Oktober 2011 10:44
 An: Tomcat Users List
 Betreff: Re: Preferred configuration with Hardware Loadbalancer
 
 What do you mean by Apache Webserver? Do you mean Apache Tomcat or Apache

 httpd?
 
  And do you want Failover (active-passive) or Loadbalancing (active-active)?
 
  Ronald.
 
 
 Op donderdag, 6 oktober 2011 10:36 schreef Alexander Diedler

 adied...@tecracer.de:
 

   
   
   
  Hello,  
   
  I am just planning a Application cluster for Tomcat. We have a big

 hardware loadbalancer (Cisco) and three virtual servers. We talked about
 several configurations, but it is not clear for us, how to build a Tomcat
 cluster, with Failover and Session-Replication, but without Loadbalancing?  
   
  E.g. the LB redirect the request to node 1. The Apache Webserver redirects

 the request to node2. So we have a double load-balancing, what ne would
 avoid.  
   
 
   
  Best regards  
   
  Alexander  
   
 
   
   
   
   
   
   
 
 



 
 
 


Re: AW: Securing Tomcat cluster communication

2011-10-06 Thread Ronald Klop (Mailing List)

A 'connector' is used between for example Apache httpd and Tomcat. It is not 
used between Tomcat nodes in a cluster.

Ronald.


Op donderdag, 6 oktober 2011 16:22 schreef Alexander Diedler 
adied...@tecracer.de:


  
 
 Hello,

 Please search for secret in
 http://tomcat.apache.org/connectors-doc/reference/workers.html  
 Only requests from members with the same secret word will be acceped.
 
 Greetings

 Alexander
 
 
 -Ursprüngliche Nachricht-

 Von: Afkham Azeez [mailto:afk...@gmail.com]
 Gesendet: Donnerstag, 6. Oktober 2011 16:18
 An: Tomcat Users List
 Betreff: Securing Tomcat cluster communication
 
 Hi folks,

 Is there a way to do authentication in Tribes when new members try to join a
 cluster so that unauthorized nodes cannot join in? Also, when clustering
 messages are sent back  forth, how do we ensure security?
 
 Thanks

 Azeez
 



 
 
 


wiki: tomcat 7 changelog has old link

2011-08-18 Thread Ronald Klop

Hi,

Since the branch of tomcat 7 the link on 
https://wiki.apache.org/tomcat/FAQ/KnownIssues is incorrect.
I don't have an account to fix it.

Cheers,

Ronald.

Re: wiki: tomcat 7 changelog has old link

2011-08-18 Thread Ronald Klop

Aha, thanks. Fixed it.


Op donderdag, 18 augustus 2011 14:00 schreef Mark Thomas ma...@apache.org:


  
 On 18/08/2011 11:13, Ronald Klop wrote:

  Hi,
 
  Since the branch of tomcat 7 the link on
  https://wiki.apache.org/tomcat/FAQ/KnownIssues is incorrect.
  I don't have an account to fix it.
 
 Anyone can create an account and once you have an account anyone can

 edit the wiki contents.
 
 Mark
 
 -

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





Re: IllegalStateException: The response object has been recycled and is no longer associated with this facade

2011-08-18 Thread Ronald Klop




Op woensdag, 17 augustus 2011 13:41 schreef Mark Thomas ma...@apache.org:


  
 On 17/08/2011 12:36, Ronald Klop wrote:

  Hi,
 
  I did some experiments past days on my live servers and have more
  information.
 
  The problem occurs with 7.0.19 and 7.0.20 with the NIO connector, but
  not with the BIO connector. In 7.0.16 it doesn't happen with the NIO
  connector.
  My code is not more than something like this (pseudocode):
  doGet(...) {
 File image = getFile(request.getParameter(...));
 File resized = getFile(request.getParameter(...));
 if (image.newerThan(resized)) {
resize(image, resized, size);
 }
 response.getOutputStream().write(resized.getContent());
  }
 
  So very straight forward and no fancy tricks with Response objects. This
  worked for years since Tomcat 5 or 6.
 
 Are you using javax.imageio?
 
 Mark
 
 -

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



  


Is this imageio thing only with NIO+sendfile? If I disable sendfile in 
server.xml I don't see the error anymore.

Ronald.


Re: IllegalStateException: The response object has been recycled and is no longer associated with this facade

2011-08-17 Thread Ronald Klop




Op zondag, 14 augustus 2011 23:46 schreef Konstantin Kolinko 
knst.koli...@gmail.com:


  
 2011/8/14 Ronald Klop ronald-mailingl...@base.nl:

 
  I'm running Tomcat 7.0.19 to scale and serve images for use on a lot of
  websites. Since the upgrade from 7.0.16 to 7.0.19 I get the following stacks
  now and than.
  java.lang.IllegalStateException: The response object has been recycled and
  is no longer associated with this facade
 (...)
 
  Is this known? I didn't change code recently and I read it again and we are
  not doing unusual things with the Reponse object. Any hints? Should I file a
  bugreport?
 
 It is more likely that a problem is in your code, not in Tomcat.
 
 It looks like you accessed a Response that has already been recycled.

 Usually it happens when response object is stored in a field that is
 shared by several threads
 (e.g. in a field in a Servlet, because a single Servlet instance is
 shared by several threads).
 
 
 In case if there really is a bug, can you reproduce this issue with

 some sample code?
 
 There were refactorings in connectors, so some subtle changes in

 behaviour are possible, but thus far all such IllegalStateException
 issues that I remember were application errors.
 
 Recycling of facades can be turned on with a system property,  and it

 is always on when running with a security manager. Were you running
 7.0.16 with security manager as well?
 
  I'm going to upgrade to 7.0.20 this afternoon, but the release notes don't

  mention this problem as solved.
 
 Best regards,

 Konstantin Kolinko
 
 -

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



  



Hi,

I did some experiments past days on my live servers and have more information.

The problem occurs with 7.0.19 and 7.0.20 with the NIO connector, but not with 
the BIO connector. In 7.0.16 it doesn't happen with the NIO connector.
My code is not more than something like this (pseudocode):
doGet(...) {
   File image = getFile(request.getParameter(...));
   File resized = getFile(request.getParameter(...));
   if (image.newerThan(resized)) {
  resize(image, resized, size);
   }
   response.getOutputStream().write(resized.getContent());
}

So very straight forward and no fancy tricks with Response objects. This worked 
for years since Tomcat 5 or 6.

Ronald.

Re: IllegalStateException: The response object has been recycled and is no longer associated with this facade

2011-08-17 Thread Ronald Klop




Op woensdag, 17 augustus 2011 13:41 schreef Mark Thomas ma...@apache.org:


  
 On 17/08/2011 12:36, Ronald Klop wrote:

  Hi,
 
  I did some experiments past days on my live servers and have more
  information.
 
  The problem occurs with 7.0.19 and 7.0.20 with the NIO connector, but
  not with the BIO connector. In 7.0.16 it doesn't happen with the NIO
  connector.
  My code is not more than something like this (pseudocode):
  doGet(...) {
 File image = getFile(request.getParameter(...));
 File resized = getFile(request.getParameter(...));
 if (image.newerThan(resized)) {
resize(image, resized, size);
 }
 response.getOutputStream().write(resized.getContent());
  }
 
  So very straight forward and no fancy tricks with Response objects. This
  worked for years since Tomcat 5 or 6.
 
 Are you using javax.imageio?
 
 Mark
 
 -

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



  



Sometimes. Mostly I run ImageMagick in a separate process. But sometimes it 
does things with javax.imagio.
I'm curious about the link between them. And what happened in 7.0.19 that 
triggers something new.

Ronald.

Re: IllegalStateException: The response object has been recycled and is no longer associated with this facade

2011-08-17 Thread Ronald Klop




Op woensdag, 17 augustus 2011 14:28 schreef Mark Thomas ma...@apache.org:


  
 On 17/08/2011 13:20, Ronald Klop wrote:

  Sometimes. Mostly I run ImageMagick in a separate process. But sometimes
  it does things with javax.imagio.
  I'm curious about the link between them. And what happened in 7.0.19
  that triggers something new.
 
 Details in the archives.
 
 If you have a simple test case that demonstrates the problem that

 doesn't use imageio then I'd be interested.
 
 Mark
 
 -

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



  



Ok. I read the FAQ mentioned by Konstantin and I understand it.
My ImageIO always writes to a File and never directly to the 
ServletOutputStream..
The communication between my servlet and the image resize module is a File. 
(Which I cache on the Tomcat node, so I only have to resize ones.)
And I read some more archives, but they are about problems after reloading a 
Context, but I always restart my Tomcat nodes as I'm deploying new code and 
have only one Context.
But I understand ImageIO can be troublesome.

And I'm also interested in a simple test case. :-) I'm trying to figure out how 
to reproduce this.

Ronald.

Re: IllegalStateException: The response object has been recycled and is no longer associated with this facade

2011-08-17 Thread Ronald Klop




Op woensdag, 17 augustus 2011 15:02 schreef Ronald Klop 
ronald-mailingl...@base.nl:


  
 
 
 
 
 Op woensdag, 17 augustus 2011 14:28 schreef Mark Thomas ma...@apache.org:

 

   On 17/08/2011 13:20, Ronald Klop wrote:

Sometimes. Mostly I run ImageMagick in a separate process. But sometimes
it does things with javax.imagio.
I'm curious about the link between them. And what happened in 7.0.19
that triggers something new.
   
   Details in the archives.
   
   If you have a simple test case that demonstrates the problem that

   doesn't use imageio then I'd be interested.
   
   Mark
   
   -

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

   
 

 

 
  
  Ok. I read the FAQ mentioned by Konstantin and I understand it.

  My ImageIO always writes to a File and never directly to the 
ServletOutputStream..
  The communication between my servlet and the image resize module is a File. 
(Which I cache on the Tomcat node, so I only have to resize ones.)
  And I read some more archives, but they are about problems after reloading a 
Context, but I always restart my Tomcat nodes as I'm deploying new code and 
have only one Context.
  But I understand ImageIO can be troublesome.
 
  And I'm also interested in a simple test case. :-) I'm trying to figure out how to reproduce this.
 
  Ronald.
 



 
  

Maybe this is of any interest from catalina.out on 7.0.19 with NIO.

Long before the first exception about a recylced response facade I get this:
Aug 15, 2011 10:55:07 AM org.apache.tomcat.util.net.NioEndpoint processSocket
SEVERE: Error allocating socket processor
java.lang.NullPointerException
at 
org.apache.tomcat.util.net.NioEndpoint.processSocket(NioEndpoint.java:710)
at 
org.apache.tomcat.util.net.NioEndpoint$Poller.processKey(NioEndpoint.java:1194)
at org.apache.tomcat.util.net.NioEndpoint$Poller.run(NioEndpoint.java:1130)
at java.lang.Thread.run(Thread.java:662)

And some similar NPE's and a day later I get this:
Aug 16, 2011 9:00:29 AM 
org.apache.coyote.AbstractProtocol$AbstractConnectionHandler process
SEVERE: null
java.lang.NullPointerException
at 
org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.release(Http11NioProtocol.java:231)
at 
org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.release(Http11NioProtocol.java:150)
at 
org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:531)
at 
org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1544)
at 
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)
Aug 16, 2011 9:00:42 AM org.apache.catalina.connector.CoyoteAdapter service
SEVERE: An exception or error occurred in the container during the request 
processing
java.lang.NullPointerException
at 
org.apache.coyote.http11.InternalNioOutputBuffer.addToBB(InternalNioOutputBuffer.java:227)
at 
org.apache.coyote.http11.InternalNioOutputBuffer.commit(InternalNioOutputBuffer.java:218)
at 
org.apache.coyote.http11.AbstractHttp11Processor.action(AbstractHttp11Processor.java:698)
at org.apache.coyote.Response.action(Response.java:170)
at org.apache.coyote.Response.sendHeaders(Response.java:350)
at org.apache.catalina.connector.OutputBuffer.doFlush(OutputBuffer.java:317)
at org.apache.catalina.connector.OutputBuffer.close(OutputBuffer.java:276)
at org.apache.catalina.connector.Response.finishResponse(Response.java:501)
at 
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:432)
at 
org.apache.coyote.http11.Http11NioProcessor.process(Http11NioProcessor.java:313)
at 
org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:515)
at 
org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1544)
at 
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)
Aug 16, 2011 9:00:42 AM org.apache.coyote.http11.AbstractHttp11Processor 
endRequest
SEVERE: Error finishing response
java.lang.NullPointerException
at 
org.apache.coyote.http11.InternalNioOutputBuffer.flushBuffer(InternalNioOutputBuffer.java:252)
at 
org.apache.coyote.http11.InternalNioOutputBuffer.endRequest(InternalNioOutputBuffer.java:144)
at 
org.apache.coyote.http11.AbstractHttp11Processor.endRequest(AbstractHttp11Processor.java:1282)
at 
org.apache.coyote.http11.Http11NioProcessor.process(Http11NioProcessor.java:356)
at 
org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process

IllegalStateException: The response object has been recycled and is no longer associated with this facade

2011-08-14 Thread Ronald Klop

Hi,

I'm running Tomcat 7.0.19 to scale and serve images for use on a lot of websites. Since the upgrade from 7.0.16 to 7.0.19 I get the following stacks now and than. 


java.lang.IllegalStateException: The response object has been recycled and is 
no longer associated with this facade
at 
org.apache.catalina.connector.ResponseFacade.isCommitted(ResponseFacade.java:325)
 ~[catalina.jar:7.0.19]
at 
org.apache.catalina.connector.ResponseFacade.setContentType(ResponseFacade.java:237)
 ~[catalina.jar:7.0.19]
at 
javax.servlet.ServletResponseWrapper.setContentType(ServletResponseWrapper.java:123)
 ~[servlet-api.jar:3.0.FR]
at nl.base.io.HttpUtils.sendBaseFileToBrowser(HttpUtils.java:366) 
~[HttpUtils.class:na]
at nl.base.servlets.objects.MediaServlet.process(MediaServlet.java:272) 
[MediaServlet.class:na]
at nl.base.servlets.objects.MediaServlet.doPost(MediaServlet.java:66) 
[MediaServlet.class:na]
at nl.base.servlets.objects.MediaServlet.doGet(MediaServlet.java:59) 
[MediaServlet.class:na]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:629) 
[servlet-api.jar:na]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:722) 
[servlet-api.jar:na]
I'm running with the security manager on, because I use RMI. And it runs on 
Debian 5 with Sun java 1.6.0_22 from the Debian pkg.

Is this known? I didn't change code recently and I read it again and we are not 
doing unusual things with the Reponse object. Any hints? Should I file a 
bugreport?
I'm going to upgrade to 7.0.20 this afternoon, but the release notes don't 
mention this problem as solved.

Ronald.


Re: getAllClusterSessions gives OptionalDataException

2011-07-14 Thread Ronald Klop




Op vrijdag, 8 juli 2011 21:55 schreef Christopher Schultz 
ch...@christopherschultz.net:


  
 -BEGIN PGP SIGNED MESSAGE-

 Hash: SHA1
 
 Ronald,
 
 On 7/8/2011 5:33 AM, Ronald Klop wrote:

  After some fun with debugging Tomcat on my live server (because I
  couldn't reproduce it in test) it looks like a concurrency bug in my
  own code.
 
 D'oh.
 
  I think I modify a HashMap which is serialized in the session. For

  some reason I don't get a ConcurrentModificationException, but in the
  byte[] in DeltaManager.handleALL_SESSION_DATA I had a HashMap with
  size 5, but I only saw 4 elements which gave the
  OptionalDataException. I now use a synchronized map and don't see
  the exception anymore (after 1 day of testing, so I don't cheer too
  loud yet).
 
 Definitely get back to us with an update. It would be nice to know that

 this problem turned out to be caused by the webapp and not Tomcat in
 some way.
 
 - -chris
  
 



  

Hi,

Today we had to do an update during work hours and all sessions were ok. So I 
consider this OptionalDataException solved for me.
It was a not synchronized Map in the session which is updated more frequently 
now than in the past and triggered a race condition now.

Greetings and thanks for responses and tips,

Ronald.

Re: getAllClusterSessions gives OptionalDataException

2011-07-08 Thread Ronald Klop




Op donderdag, 7 juli 2011 18:03 schreef Filip Hanik - Dev Lists 
devli...@hanik.com:


  
 On 6/28/2011 2:31 AM, Konstantin Kolinko wrote:

  2011/6/23 Ronald Klopronald-mailingl...@base.nl:
  Hi,
 
  I have an exception when one on my Tomcat nodes restarts. The session are
  not synced and user complain about being logged out. I was running 6.0.32
  and had the problem. Now I'm running a custom build of 6.0.33 from
  yesterday. I added a little code which prints ' SEVERE: name=user'. The key
  on which the sync fails while reading the value.
 
  I looked into the java code in ObjectInputStream and it looks like some
  inconsistency in the ObjectStream.
 
  I have 4 nodes on Debian 5, sun-java6-jdk 6-22-0lenny1, seen the problem on
  Tomcat 6.0.29, 6.0.32 and a custom build 6.0.33. I can't reproduce this
  (yet) on my test environment, so debugging it is difficult without upset
  customers.
 
  Engine name=Catalina defaultHost=xxx.xxx.xxx
Realm className=org.apache.catalina.realm.UserDatabaseRealm
   resourceName=UserDatabase /
  Cluster
  className=org.apache.catalina.ha.tcp.SimpleTcpCluster
  Channel
  className=org.apache.catalina.tribes.group.GroupChannel
  Membership
  className=org.apache.catalina.tribes.membership.McastService port=47727
  /
  /Channel
  /Cluster
  Host name=xxx.xxx.xxx
  appBase=/data/webapps/crm-LIVE/deployed
  unpackWARs=true autoDeploy=false
  xmlValidation=false xmlNamespaceAware=true
  /Host
  /Engine
 
  Can I provide more information? Where should I look.
 
  NB: In some previous mails about another problem I thought that might be the
  reason for my logout problem, that is why I tried 6.0.33-dev.
 
  Ronald.
 
  Jun 23, 2011 5:49:47 PM org.apache.catalina.ha.session.DeltaManager
  getAllClusterSessions
  WARNING: Manager [crm.realworks.nl#], requesting session state from
  org.apache.catalina.tribes.membership.MemberImpl[tcp://{10, 0, 10,
  110}:4000,{10, 0, 10, 110},4000, alive=45370885,id={-34 112 102 -93 -87 -88
  77 18 -113 -30 62 8 62 -65 -112 -13 }, payload={}, command={}, domain={}, ].
  This operation will timeout if no session state has been received within 60
  seconds.
  Jun 23, 2011 5:49:47 PM org.apache.catalina.ha.session.DeltaManager
  waitForSendAllSessions
  INFO: Manager [crm.realworks.nl#]; session state send at 6/23/11 5:49 PM
  received in 304 ms.
  Jun 23, 2011 5:49:47 PM org.apache.catalina.ha.session.DeltaManager
  getAllClusterSessions
  WARNING: Manager [crm.realworks.nl#]: Drop message SESSION-ACCESSED inside
  GET_ALL_SESSIONS sync phase start date 6/23/11 5:49 PM message date 6/23/11
  5:49 PM
  Jun 23, 2011 5:49:47 PM org.apache.catalina.ha.session.DeltaSession
  readObject
  SEVERE: name=user.
  Jun 23, 2011 5:49:47 PM org.apache.catalina.ha.session.DeltaManager
  deserializeSessions
  SEVERE: IOException while loading persisted sessions:
  java.io.OptionalDataException
  java.io.OptionalDataException
  at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1348)
  at java.io.ObjectInputStream.readObject(ObjectInputStream.java:350)
  at java.util.HashMap.readObject(HashMap.java:1029)
  (...)
 
  Looking at ObjectInputStream sourced, the OptionalDataException is
  thrown when the source stream is truncated.
 
  It might be related to the following issue, fixed in Tomcat 7, but
  never proposed for backport yet:
  https://issues.apache.org/bugzilla/show_bug.cgi?id=50646
  Tribes ByteMessage will get corrupted if message size exceeds the
  underlying buffer size
 that's what I thought, but the SessionMessage doesn't use ByteMessage
 
  Best regards,

  Konstantin Kolinko
  
 



  

Hi Konstantin,

The 'Tribes ByteMessage' issue didn't solve my problem.
But. After some fun with debugging Tomcat on my live server (because I couldn't 
reproduce it in test) it looks like a concurrency bug in my own code. I think I 
modify a HashMap which is serialized in the session. For some reason I don't 
get a ConcurrentModificationException, but in the byte[] in 
DeltaManager.handleALL_SESSION_DATA I had a HashMap with size 5, but I only saw 
4 elements which gave the OptionalDataException.
I now use a synchronized map and don't see the exception anymore (after 1 day 
of testing, so I don't cheer too loud yet).

Ronald.

Re: getAllClusterSessions gives OptionalDataException

2011-06-24 Thread Ronald Klop

I double checked. The version of Tomcat and the versions of Java are all the 
same.

Ronald.


Op vrijdag, 24 juni 2011 03:25 schreef Filip Hanik - Dev Lists 
devli...@hanik.com:


  
 are there other versions of Apache Tomcat running in the same cluster?

 Check the logs for what members are joining the cluster, then check what 
version they are
 
 best

 Filip
 
 On 6/23/2011 10:14 AM, Ronald Klop wrote:

  Hi,
 
  I have an exception when one on my Tomcat nodes restarts. The session are not 
synced and user complain about being logged out. I was  running 6.0.32 and had the 
problem. Now I'm running a custom build of 6.0.33 from yesterday. I added a little code 
which prints ' SEVERE:  name=user'. The key on which the sync fails while reading 
the value.
 
  I looked into the java code in ObjectInputStream and it looks like some 
inconsistency in the ObjectStream.
 
  I have 4 nodes on Debian 5, sun-java6-jdk 6-22-0lenny1, seen the problem on 
Tomcat 6.0.29, 6.0.32 and a custom build 6.0.33. I can't  reproduce this (yet) on 
my test environment, so debugging it is difficult without upset customers.
 
  Engine name=Catalina defaultHost=xxx.xxx.xxx
  Realm className=org.apache.catalina.realm.UserDatabaseRealm
   resourceName=UserDatabase /
  Cluster className=org.apache.catalina.ha.tcp.SimpleTcpCluster
  Channel className=org.apache.catalina.tribes.group.GroupChannel
  Membership className=org.apache.catalina.tribes.membership.McastService 
port=47727 /
  /Channel
  /Cluster
  Host name=xxx.xxx.xxx
  appBase=/data/webapps/crm-LIVE/deployed
  unpackWARs=true autoDeploy=false
  xmlValidation=false xmlNamespaceAware=true
  /Host
  /Engine
 
  Can I provide more information? Where should I look.
 
  NB: In some previous mails about another problem I thought that might be the 
reason for my logout problem, that is why I tried 6.0.33-dev.
 
  Ronald.
 
  Jun 23, 2011 5:49:47 PM org.apache.catalina.ha.session.DeltaManager 
getAllClusterSessions
  WARNING: Manager [crm.realworks.nl#], requesting session state from 
org.apache.catalina.tribes.membership.MemberImpl[tcp://{10, 0, 10,  110}:4000,{10, 
0, 10, 110},4000, alive=45370885,id={-34 112 102 -93 -87 -88 77 18 -113 -30 62 8 62 -65 
-112 -13 }, payload={}, command={},  domain={}, ]. This operation will timeout if no 
session state has been received within 60 seconds.
  Jun 23, 2011 5:49:47 PM org.apache.catalina.ha.session.DeltaManager 
waitForSendAllSessions
  INFO: Manager [crm.realworks.nl#]; session state send at 6/23/11 5:49 PM 
received in 304 ms.
  Jun 23, 2011 5:49:47 PM org.apache.catalina.ha.session.DeltaManager 
getAllClusterSessions
  WARNING: Manager [crm.realworks.nl#]: Drop message SESSION-ACCESSED inside 
GET_ALL_SESSIONS sync phase start date 6/23/11 5:49 PM message  date 6/23/11 5:49 
PM
  Jun 23, 2011 5:49:47 PM org.apache.catalina.ha.session.DeltaSession 
readObject
  SEVERE: name=user.
  Jun 23, 2011 5:49:47 PM org.apache.catalina.ha.session.DeltaManager 
deserializeSessions
  SEVERE: IOException while loading persisted sessions: 
java.io.OptionalDataException
  java.io.OptionalDataException
  at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1348)
  at java.io.ObjectInputStream.readObject(ObjectInputStream.java:350)
  at java.util.HashMap.readObject(HashMap.java:1029)
  at sun.reflect.GeneratedMethodAccessor23.invoke(Unknown Source)
  at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
  at java.lang.reflect.Method.invoke(Method.java:597)
  at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:974)
  at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1848)
  at 
java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1752)
  at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1328)
  at 
java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1946)
  at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1870)
  at 
java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1752)
  at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1328)
  at java.io.ObjectInputStream.readObject(ObjectInputStream.java:350)
  at 
org.apache.catalina.ha.session.DeltaSession.readObject(DeltaSession.java:655)
  at 
org.apache.catalina.ha.session.DeltaSession.readObjectData(DeltaSession.java:481)
  at 
org.apache.catalina.ha.session.DeltaManager.deserializeSessions(DeltaManager.java:745)
  at 
org.apache.catalina.ha.session.DeltaManager.handleALL_SESSION_DATA(DeltaManager.java:1583)
  at 
org.apache.catalina.ha.session.DeltaManager.messageReceived(DeltaManager.java:1440)
  at 
org.apache.catalina.ha.session.DeltaManager.messageDataReceived(DeltaManager.java:1173)
  at 
org.apache.catalina.ha.session.ClusterSessionListener.messageReceived(ClusterSessionListener.java

getAllClusterSessions gives OptionalDataException

2011-06-23 Thread Ronald Klop

Hi,

I have an exception when one on my Tomcat nodes restarts. The session are not 
synced and user complain about being logged out. I was running 6.0.32 and had 
the problem. Now I'm running a custom build of 6.0.33 from yesterday. I added a 
little code which prints ' SEVERE: name=user'. The key on which the sync fails 
while reading the value.

I looked into the java code in ObjectInputStream and it looks like some 
inconsistency in the ObjectStream.

I have 4 nodes on Debian 5, sun-java6-jdk 6-22-0lenny1, seen the problem on 
Tomcat 6.0.29, 6.0.32 and a custom build 6.0.33. I can't reproduce this (yet) 
on my test environment, so debugging it is difficult without upset customers.

Engine name=Catalina defaultHost=xxx.xxx.xxx
  Realm className=org.apache.catalina.realm.UserDatabaseRealm
 resourceName=UserDatabase /
Cluster 
className=org.apache.catalina.ha.tcp.SimpleTcpCluster
Channel 
className=org.apache.catalina.tribes.group.GroupChannel
Membership 
className=org.apache.catalina.tribes.membership.McastService port=47727 /
/Channel
/Cluster
Host name=xxx.xxx.xxx
appBase=/data/webapps/crm-LIVE/deployed
unpackWARs=true autoDeploy=false
xmlValidation=false xmlNamespaceAware=true
/Host
/Engine

Can I provide more information? Where should I look.

NB: In some previous mails about another problem I thought that might be the 
reason for my logout problem, that is why I tried 6.0.33-dev.

Ronald.

Jun 23, 2011 5:49:47 PM org.apache.catalina.ha.session.DeltaManager 
getAllClusterSessions
WARNING: Manager [crm.realworks.nl#], requesting session state from 
org.apache.catalina.tribes.membership.MemberImpl[tcp://{10, 0, 10, 
110}:4000,{10, 0, 10, 110},4000, alive=45370885,id={-34 112 102 -93 -87 -88 77 
18 -113 -30 62 8 62 -65 -112 -13 }, payload={}, command={}, domain={}, ]. This 
operation will timeout if no session state has been received within 60 seconds.
Jun 23, 2011 5:49:47 PM org.apache.catalina.ha.session.DeltaManager 
waitForSendAllSessions
INFO: Manager [crm.realworks.nl#]; session state send at 6/23/11 5:49 PM 
received in 304 ms.
Jun 23, 2011 5:49:47 PM org.apache.catalina.ha.session.DeltaManager 
getAllClusterSessions
WARNING: Manager [crm.realworks.nl#]: Drop message SESSION-ACCESSED inside 
GET_ALL_SESSIONS sync phase start date 6/23/11 5:49 PM message date 6/23/11 
5:49 PM
Jun 23, 2011 5:49:47 PM org.apache.catalina.ha.session.DeltaSession readObject
SEVERE: name=user.
Jun 23, 2011 5:49:47 PM org.apache.catalina.ha.session.DeltaManager 
deserializeSessions
SEVERE: IOException while loading persisted sessions: 
java.io.OptionalDataException
java.io.OptionalDataException
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1348)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:350)
at java.util.HashMap.readObject(HashMap.java:1029)
at sun.reflect.GeneratedMethodAccessor23.invoke(Unknown Source)
at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:974)
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1848)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1752)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1328)
at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1946)
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1870)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1752)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1328)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:350)
at 
org.apache.catalina.ha.session.DeltaSession.readObject(DeltaSession.java:655)
at 
org.apache.catalina.ha.session.DeltaSession.readObjectData(DeltaSession.java:481)
at 
org.apache.catalina.ha.session.DeltaManager.deserializeSessions(DeltaManager.java:745)
at 
org.apache.catalina.ha.session.DeltaManager.handleALL_SESSION_DATA(DeltaManager.java:1583)
at 
org.apache.catalina.ha.session.DeltaManager.messageReceived(DeltaManager.java:1440)
at 
org.apache.catalina.ha.session.DeltaManager.messageDataReceived(DeltaManager.java:1173)
at 
org.apache.catalina.ha.session.ClusterSessionListener.messageReceived(ClusterSessionListener.java:92)
at 
org.apache.catalina.ha.tcp.SimpleTcpCluster.messageReceived(SimpleTcpCluster.java:901)
at 
org.apache.catalina.ha.tcp.SimpleTcpCluster.messageReceived(SimpleTcpCluster.java:882)
at 
org.apache.catalina.tribes.group.GroupChannel.messageReceived(GroupChannel.java:269)
at 

Re: error in clustering: NullPointerException at java.io.ObjectOutputStream$BlockDataOutputStream.getUTFLength

2011-06-17 Thread Ronald Klop




Op donderdag, 16 juni 2011 18:55 schreef Christopher Schultz 
ch...@christopherschultz.net:


  
 -BEGIN PGP SIGNED MESSAGE-

 Hash: SHA1
 
 Ronald,
 
 On 6/16/2011 11:40 AM, Ronald Klop wrote:

  I created a release package. First had to find a computer with Windows,
  because it needs wine (I didn't want to learn wine on FreeBSD today),
  but ok it builds now.
 
 Wait, what? Why do you need Wine?
 
  Now I'll wait for my precious bug fix to get committed to 6. :-)
 
 I've voted for the fix. ;)
 
 - -chris

 -BEGIN PGP SIGNATURE-
 Version: GnuPG v1.4.10 (MingW32)
 Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
 
 iEYEARECAAYFAk36NZ0ACgkQ9CaO5/Lv0PAZ/ACeMUI4mDW6Y7t0Xu3+2OMPJmSH

 BgAAn359rasGTifpr81xlrnzfdDtOzZg
 =jBjN
 -END PGP SIGNATURE-
 
 -

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



  



Chris, thanks for the vote.

Regarding 'wine'. I followed all steps from BUILDING.txt. The last one is 
below. Maybe I don't need the 'release' step, but it makes deployment in my 
network easy, because we arranged things around the .tar.gz files from the 
Tomcat site.
Darn, I look closer now and see the 'unless=skip.installer' in dist.xml. 
Thanks, I'm very close to debugging Tomcat myself. Is it easy to edit Tomcat in a Eclipse 
project? Or what do you guys use?

Ronald.

$ ant -f dist.xml release
Buildfile: /data/software/tomcat/tc6.0.x/trunk/dist.xml

clean:
   [delete] Deleting directory 
/data/software/tomcat/tc6.0.x/trunk/output/deployer
   [delete] Deleting directory /data/software/tomcat/tc6.0.x/trunk/output/dist

dist-prepare:
[mkdir] Created dir: /data/software/tomcat/tc6.0.x/trunk/output/dist
[mkdir] Created dir: /data/software/tomcat/tc6.0.x/trunk/output/dist/bin
[mkdir] Created dir: /data/software/tomcat/tc6.0.x/trunk/output/dist/conf
[mkdir] Created dir: /data/software/tomcat/tc6.0.x/trunk/output/dist/lib
[mkdir] Created dir: /data/software/tomcat/tc6.0.x/trunk/output/dist/logs
[mkdir] Created dir: /data/software/tomcat/tc6.0.x/trunk/output/dist/temp
[mkdir] Created dir: /data/software/tomcat/tc6.0.x/trunk/output/dist/webapps
[mkdir] Created dir: /data/software/tomcat/tc6.0.x/trunk/output/dist/work

dist-static:
 [copy] Copying 4 files to /data/software/tomcat/tc6.0.x/trunk/output/dist
 [copy] Copying 22 files to 
/data/software/tomcat/tc6.0.x/trunk/output/dist/bin
 [copy] Copying 15 files to 
/data/software/tomcat/tc6.0.x/trunk/output/dist/lib
 [copy] Copying 7 files to 
/data/software/tomcat/tc6.0.x/trunk/output/dist/conf
 [copy] Copying 442 files to 
/data/software/tomcat/tc6.0.x/trunk/output/dist/webapps
[touch] Creating 
/data/software/tomcat/tc6.0.x/trunk/output/dist/temp/safeToDelete.tmp
 [copy] Copying 1 file to 
/data/software/tomcat/tc6.0.x/trunk/output/dist/bin
 [copy] Copying 1 file to 
/data/software/tomcat/tc6.0.x/trunk/output/dist/bin
 [copy] Copying 1 file to 
/data/software/tomcat/tc6.0.x/trunk/output/dist/bin/x64
 [copy] Copying 1 file to 
/data/software/tomcat/tc6.0.x/trunk/output/dist/bin/i64
 [copy] Copying 1 file to 
/data/software/tomcat/tc6.0.x/trunk/output/dist/bin
 [copy] Copying 1 file to 
/data/software/tomcat/tc6.0.x/trunk/output/dist/bin/x64
 [copy] Copying 1 file to 
/data/software/tomcat/tc6.0.x/trunk/output/dist/bin/i64

dist-deployer:
 [copy] Copying 7 files to 
/data/software/tomcat/tc6.0.x/trunk/output/deployer/lib
  [jar] Building jar: 
/data/software/tomcat/tc6.0.x/trunk/output/deployer/lib/catalina-deployer.jar
 [copy] Copying 1 file to 
/data/software/tomcat/tc6.0.x/trunk/output/deployer
 [copy] Copying 2 files to 
/data/software/tomcat/tc6.0.x/trunk/output/deployer
 [copy] Copying 1 file to 
/data/software/tomcat/tc6.0.x/trunk/output/deployer

installer:
 [echo] Builds a Windows installer based on Nullsoft Installer
 [copy] Copying 41 files to /data/software/tomcat/tc6.0.x/trunk/output/dist
 [copy] Copying 1 file to /data/software/tomcat/tc6.0.x/trunk/output/dist
 [copy] Copying 1 file to /data/software/tomcat/tc6.0.x/trunk/output/dist
 [copy] Copying 1 file to /data/software/tomcat/tc6.0.x/trunk/output/dist
 [copy] Copying 1 file to /data/software/tomcat/tc6.0.x/trunk/output/dist

BUILD FAILED
/data/software/tomcat/tc6.0.x/trunk/dist.xml:330: Execute failed: java.io.IOException: Cannot run 
program wine (in directory 
/data/software/tomcat/tc6.0.x/trunk/output/dist): java.io.IOException: error=2, No such 
file or directory
at java.lang.ProcessBuilder.start(ProcessBuilder.java:475)
at java.lang.Runtime.exec(Runtime.java:610)
at 
org.apache.tools.ant.taskdefs.Execute$Java13CommandLauncher.exec(Execute.java:862)
at org.apache.tools.ant.taskdefs.Execute.launch(Execute.java:481

Re: error in clustering: NullPointerException at java.io.ObjectOutputStream$BlockDataOutputStream.getUTFLength

2011-06-16 Thread Ronald Klop

A little lobby is started:
http://marc.info/?l=tomcat-devm=130805807619349w=2

Thanks, but no reply yet from jfclere. He must be busy.
I'm not familiar with the inner workings of the Tomcat organization, but 
shouldn't releases be less dependent on one person?

Ronald.

Op dinsdag, 14 juni 2011 23:59 schreef Christopher Schultz 
ch...@christopherschultz.net:


  
 -BEGIN PGP SIGNED MESSAGE-

 Hash: SHA1
 
 Ronald,
 
 On 6/14/2011 6:23 AM, Ronald Klop wrote:

  I see the issue if solved in an upcoming version of Tomcat. Thank you
  very much for that. But can I expect an upcoming version of Tomcat 6.0
  in the not too distant future?
  At the tomcat-dev list I only see recent votings for 7.0.x.
  Who normally is the initiator of the 6.x release cycle?
 
 I guess anyone can request a new version... whether anyone will roll it

 is up to them :)
 
 I believe Jean-Frederic Clere is the one who usually does TC 6.x releases:

 http://tomcat.apache.org/tomcat-6.0-doc/changelog.html
 
 - -chris

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

 RB4AniwAT6RTwBYNLG5H0nYQmv3hOzG3
 =DmoN
 -END PGP SIGNATURE-
 
 -

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





Re: error in clustering: NullPointerException at java.io.ObjectOutputStream$BlockDataOutputStream.getUTFLength

2011-06-16 Thread Ronald Klop

Good tip.
I created a release package. First had to find a computer with Windows, because 
it needs wine (I didn't want to learn wine on FreeBSD today), but ok it builds 
now.
Now I'll wait for my precious bug fix to get committed to 6. :-)

Ronald.


Op donderdag, 16 juni 2011 16:54 schreef Christopher Schultz 
ch...@christopherschultz.net:


  
 -BEGIN PGP SIGNED MESSAGE-

 Hash: SHA1
 
 Ronald,
 
 On 6/16/2011 6:39 AM, Ronald Klop wrote:

  A little lobby is started:
  http://marc.info/?l=tomcat-devm=130805807619349w=2
 
  Thanks, but no reply yet from jfclere. He must be busy.
  I'm not familiar with the inner workings of the Tomcat organization, but
  shouldn't releases be less dependent on one person?
 
 They aren't dependent on one person, it's just that one person usually

 gets into the groove of tagging the code, rolling the release, calling
 for the vote, doing their own personal testing, uploading the packages,
 updating the website, making announcements, etc.
 
 Anyone can do all that, honestly, but the generally speaking the torch

 of release manager seems to pass from one committer to another every
 few months or so.
 
 Looks like jfclere was doing them from around the end of 2009 until now,

 and before that it was Remmy.
 
 If you're dying to try 6.0.33, feel free to just check out the 6.0 trunk

 - -- it gets very little activity other than reviewed bug fixes, etc. so
 if you build it yourself you should be good-to-go. When the official
 package is released, you can upgrade but it will likely be the exact
 same code.
 
 - -chris

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

 1jAAnjqRKdMjkWdQ1ME8z/3lHCohjxkY
 =4S34
 -END PGP SIGNATURE-
 
 -

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





Re: error in clustering: NullPointerException at java.io.ObjectOutputStream$BlockDataOutputStream.getUTFLength

2011-06-14 Thread Ronald Klop

Hi,

I see the issue if solved in an upcoming version of Tomcat. Thank you very much 
for that. But can I expect an upcoming version of Tomcat 6.0 in the not too 
distant future?
At the tomcat-dev list I only see recent votings for 7.0.x.
Who normally is the initiator of the 6.x release cycle?

Ronald.


Op vrijdag, 10 juni 2011 13:03 schreef Ronald Klop ronald-mailingl...@base.nl:


  
 
 Hi,
 
   I'm running a 4 node cluster and seeing the same exception as described in this issue.

   https://issues.apache.org/bugzilla/show_bug.cgi?id=51306
 
   What can I do to workaround it or what can I information can I provide to help?
 
   I'm running 6.0.32 with a securitymanager on Debian 5. Java version 1.6.0_22 from debian sun-java pkgs.
 
   My clusterconfig is this:

   Engine name=Catalina defaultHost=..
 Realm className=org.apache.catalina.realm.UserDatabaseRealm
resourceName=UserDatabase /
   Cluster 
className=org.apache.catalina.ha.tcp.SimpleTcpCluster
   Channel 
className=org.apache.catalina.tribes.group.GroupChannel
   Membership 
className=org.apache.catalina.tribes.membership.McastService port=47727 /
   /Channel
   /Cluster
 
   !-- Zorg dat de appBase regel direct na de 'Host name' regel staat --

   Host name=..
   appBase=/data/webapps/xxx-xxx/deployed
   unpackWARs=true autoDeploy=false
   xmlValidation=false xmlNamespaceAware=true
   /Host
   /Engine
 
   
 
   The exception from my catalina.out.
 
   Jun 10, 2011 11:08:52 AM org.apache.catalina.ha.session.DeltaManager messageReceived

   SEVERE: Manager [crm.realworks.nl#]: Unable to receive message through TCP 
channel
   java.lang.NullPointerException
   at 
java.io.ObjectOutputStream$BlockDataOutputStream.getUTFLength(ObjectOutputStream.java:2106)
   at 
java.io.ObjectOutputStream$BlockDataOutputStream.writeUTF(ObjectOutputStream.java:1977)
   at java.io.ObjectOutputStream.writeUTF(ObjectOutputStream.java:849)
   at 
org.apache.catalina.ha.session.DeltaRequest.writeExternal(DeltaRequest.java:267)
   at 
org.apache.catalina.ha.session.DeltaRequest.serialize(DeltaRequest.java:287)
   at 
org.apache.catalina.ha.session.DeltaManager.serializeDeltaRequest(DeltaManager.java:716)
   at 
org.apache.catalina.ha.session.DeltaManager.requestCompleted(DeltaManager.java:1224)
   at 
org.apache.catalina.ha.session.DeltaSession.expire(DeltaSession.java:403)
   at 
org.apache.catalina.ha.session.DeltaManager.handleSESSION_EXPIRED(DeltaManager.java:1546)
   at 
org.apache.catalina.ha.session.DeltaManager.messageReceived(DeltaManager.java:1452)
   at 
org.apache.catalina.ha.session.DeltaManager.messageDataReceived(DeltaManager.java:1173)
   at 
org.apache.catalina.ha.session.ClusterSessionListener.messageReceived(ClusterSessionListener.java:92)
   at 
org.apache.catalina.ha.tcp.SimpleTcpCluster.messageReceived(SimpleTcpCluster.java:901)
   at 
org.apache.catalina.ha.tcp.SimpleTcpCluster.messageReceived(SimpleTcpCluster.java:882)
   at 
org.apache.catalina.tribes.group.GroupChannel.messageReceived(GroupChannel.java:269)
   at 
org.apache.catalina.tribes.group.ChannelInterceptorBase.messageReceived(ChannelInterceptorBase.java:79)
   at 
org.apache.catalina.tribes.group.ChannelInterceptorBase.messageReceived(ChannelInterceptorBase.java:79)
   at 
org.apache.catalina.tribes.group.interceptors.TcpFailureDetector.messageReceived(TcpFailureDetector.java:110)
   at 
org.apache.catalina.tribes.group.ChannelInterceptorBase.messageReceived(ChannelInterceptorBase.java:79)
   at 
org.apache.catalina.tribes.group.ChannelCoordinator.messageReceived(ChannelCoordinator.java:241)
   at 
org.apache.catalina.tribes.transport.ReceiverBase.messageDataReceived(ReceiverBase.java:225)
   at 
org.apache.catalina.tribes.transport.nio.NioReplicationTask.drainChannel(NioReplicationTask.java:188)
   at 
org.apache.catalina.tribes.transport.nio.NioReplicationTask.run(NioReplicationTask.java:91)
   at 
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
   at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
   at java.lang.Thread.run(Thread.java:662)
 
   
   Ronald.
 



 


error in clustering: NullPointerException at java.io.ObjectOutputStream$BlockDataOutputStream.getUTFLength

2011-06-10 Thread Ronald Klop

Hi,

 I'm running a 4 node cluster and seeing the same exception as described in 
this issue.
 https://issues.apache.org/bugzilla/show_bug.cgi?id=51306

 What can I do to workaround it or what can I information can I provide to help?

 I'm running 6.0.32 with a securitymanager on Debian 5. Java version 1.6.0_22 
from debian sun-java pkgs.

 My clusterconfig is this:
 Engine name=Catalina defaultHost=..
   Realm className=org.apache.catalina.realm.UserDatabaseRealm
  resourceName=UserDatabase /
 Cluster 
className=org.apache.catalina.ha.tcp.SimpleTcpCluster
 Channel 
className=org.apache.catalina.tribes.group.GroupChannel
 Membership 
className=org.apache.catalina.tribes.membership.McastService port=47727 /
 /Channel
 /Cluster

 !-- Zorg dat de appBase regel direct na de 'Host name' regel staat --
 Host name=..
 appBase=/data/webapps/xxx-xxx/deployed
 unpackWARs=true autoDeploy=false
 xmlValidation=false xmlNamespaceAware=true
 /Host
 /Engine

 


 The exception from my catalina.out.

 Jun 10, 2011 11:08:52 AM org.apache.catalina.ha.session.DeltaManager 
messageReceived
 SEVERE: Manager [crm.realworks.nl#]: Unable to receive message through TCP 
channel
 java.lang.NullPointerException
 at 
java.io.ObjectOutputStream$BlockDataOutputStream.getUTFLength(ObjectOutputStream.java:2106)
 at 
java.io.ObjectOutputStream$BlockDataOutputStream.writeUTF(ObjectOutputStream.java:1977)
 at java.io.ObjectOutputStream.writeUTF(ObjectOutputStream.java:849)
 at 
org.apache.catalina.ha.session.DeltaRequest.writeExternal(DeltaRequest.java:267)
 at 
org.apache.catalina.ha.session.DeltaRequest.serialize(DeltaRequest.java:287)
 at 
org.apache.catalina.ha.session.DeltaManager.serializeDeltaRequest(DeltaManager.java:716)
 at 
org.apache.catalina.ha.session.DeltaManager.requestCompleted(DeltaManager.java:1224)
 at 
org.apache.catalina.ha.session.DeltaSession.expire(DeltaSession.java:403)
 at 
org.apache.catalina.ha.session.DeltaManager.handleSESSION_EXPIRED(DeltaManager.java:1546)
 at 
org.apache.catalina.ha.session.DeltaManager.messageReceived(DeltaManager.java:1452)
 at 
org.apache.catalina.ha.session.DeltaManager.messageDataReceived(DeltaManager.java:1173)
 at 
org.apache.catalina.ha.session.ClusterSessionListener.messageReceived(ClusterSessionListener.java:92)
 at 
org.apache.catalina.ha.tcp.SimpleTcpCluster.messageReceived(SimpleTcpCluster.java:901)
 at 
org.apache.catalina.ha.tcp.SimpleTcpCluster.messageReceived(SimpleTcpCluster.java:882)
 at 
org.apache.catalina.tribes.group.GroupChannel.messageReceived(GroupChannel.java:269)
 at 
org.apache.catalina.tribes.group.ChannelInterceptorBase.messageReceived(ChannelInterceptorBase.java:79)
 at 
org.apache.catalina.tribes.group.ChannelInterceptorBase.messageReceived(ChannelInterceptorBase.java:79)
 at 
org.apache.catalina.tribes.group.interceptors.TcpFailureDetector.messageReceived(TcpFailureDetector.java:110)
 at 
org.apache.catalina.tribes.group.ChannelInterceptorBase.messageReceived(ChannelInterceptorBase.java:79)
 at 
org.apache.catalina.tribes.group.ChannelCoordinator.messageReceived(ChannelCoordinator.java:241)
 at 
org.apache.catalina.tribes.transport.ReceiverBase.messageDataReceived(ReceiverBase.java:225)
 at 
org.apache.catalina.tribes.transport.nio.NioReplicationTask.drainChannel(NioReplicationTask.java:188)
 at 
org.apache.catalina.tribes.transport.nio.NioReplicationTask.run(NioReplicationTask.java:91)
 at 
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
 at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
 at java.lang.Thread.run(Thread.java:662)

 
 Ronald.

tomcat 6.0.33?

2011-05-30 Thread Ronald Klop

Hi,

while (true) {
sleep(some weeks);
askForTomcat(version + 1);
}
I know, I know. This question returns, now and then.

But is there a possibility for the Tomcat developers to start a vote about 
6.0.33? I would like to use it, because there are some bugs fixed, which I'm 
seeing.
I read the archives of tomcat-dev, and didn't see any showstoppers for 6 yet. 
Or is there another reason not to make a release?

Thanks in advance, if this is possible.

Ronald.


Re: [OT] Protecting against HTTP response splitting

2011-03-31 Thread Ronald Klop




Op woensdag, 30 maart 2011 22:12 schreef Christopher Schultz 
ch...@christopherschultz.net:


  
 -BEGIN PGP SIGNED MESSAGE-

 Hash: SHA1
 
 All,
 
 I was playing around with findbugs today and saw a security warning I've

 never seen before: HTTP parameter directly written to HTTP header
 output in [somefile.java].
 
 I read a bit more into it and the warning was correct, I was doing

 something akin to the following:
 
 response.sendRedirect(request.getParameter(returnURL));
 
 Aside from not running the redirect through response.encodeRedirectURL,

 there's another potential problem, there: the user can specify a return
 URL that breaks the HTTP response and can do some evil things. I
 verified that I can break my own response in this way by adding %0d%0a
 and then more stuff to my returnURL parameter and I magically escaped
 the Location header of the response.
 
 The suggested mitigation is to URL-encode the value before putting it

 into the header.
 
 I was wondering if anyone was doing anything like this and has a

 suggestion for allowing the UI to control it's own return to URLs in a
 safe way. We'd like to use returnURL values that allow for query
 parameters to be passed-back to the target URL so we can't just blindly
 URL-encode the URL otherwise those parameters will become part of the
 URL and not the query string.
 
 I suppose I could also just look for and replace whitespace, which is

 not legal in a URL anyway.
 
 Any other thoughts of suggestions?
 
 - -chris

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

 FGEAnjA8ZbobU/8s90lE2huLx/+B2smV
 =vJ6w
 -END PGP SIGNATURE-
 
 -

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



  

I would say that some proper input validation solves your problem.
Does new URL(redirectURL).toString() give an exception on invalid url's?

Ronald.

Re: The Maximum limit of an http header size

2011-03-18 Thread Ronald Klop

It is limited by the amount of memory in your JVM.

Ronald.


Op vrijdag, 18 maart 2011 05:26 schreef rajini maski rajinima...@gmail.com:


  
 
   Any idea about what might be the maximum limit of a maxHttpHeadSize.

 The maximum size of the request and response HTTP header, specified in
 bytes. If not specified, this attribute is set to 4096 (4 KB). What is the
 maximum limit?
 
 If you try to submit too long a GET query to Solr, then Tomcat will

 reject your HTTP request on the grounds that the HTTP header is too large;
 symptoms may include an HTTP 400 Bad Request error or (if you execute the
 query in a web browser) a blank browser window.If you need to enable longer
 queries, you can set the maxHttpHeaderSize attribute on the HTTP Connector
 element in your server.xml file. The default value is 4K.  I have this case
 where in my request query has size upto 9-15kb... What is the maximum limit
 ?
 
 Rajani Maski
 



 


Re: The Maximum limit of an http header size

2011-03-18 Thread Ronald Klop

Ai. Touche.


Op vrijdag, 18 maart 2011 11:43 schreef Mark Thomas ma...@apache.org:


  
 On 18/03/2011 09:51, Ronald Klop wrote:

  It is limited by the amount of memory in your JVM.
 
 Interesting guess but wrong.
 
 The maximum size for the http headers for any one request is

 Integer.MAX_VALUE, 2^31-1.
 
 I would remind folks that since this is open source you can just look at

 the source code to answer this and many other questions. If you want
 some pointers on where to look for a particular piece of info or for how
 a particular feature is implemented, please just ask on this list.
 
 Mark
 
 

  Ronald.
 
 
  Op vrijdag, 18 maart 2011 05:26 schreef rajini maski
  rajinima...@gmail.com:
 
 
 Any idea about what might be the maximum limit of a

  maxHttpHeadSize.
   The maximum size of the request and response HTTP header, specified in
   bytes. If not specified, this attribute is set to 4096 (4 KB). What
  is the
   maximum limit?
   
   If you try to submit too long a GET query to Solr, then Tomcat will

   reject your HTTP request on the grounds that the HTTP header is too
  large;
   symptoms may include an HTTP 400 Bad Request error or (if you execute
  the
   query in a web browser) a blank browser window.If you need to enable
  longer
   queries, you can set the maxHttpHeaderSize attribute on the HTTP
  Connector
   element in your server.xml file. The default value is 4K.  I have
  this case
   where in my request query has size upto 9-15kb... What is the maximum
  limit
   ?
   
   Rajani Maski
   
 

 
   
 
 
 
 -

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





Re: java.io.NotSerializableException: org.apache.catalina.realm.GenericPrincipal

2011-03-14 Thread Ronald Klop



Op vrijdag, 11 maart 2011 13:32 schreef Ronald Klop 
ronald-mailingl...@base.nl:


  
 
 Hi,
 
  https://issues.apache.org/bugzilla/show_bug.cgi?id=47502
 
  Because this issue is fixed I re-enabled using the security-constraint in web.xml to protect some pages in stead of using my own workaround. But now I get a somewhat similar exception.
 
  This is running Tomcat 6.0.32 (directly from your tar.gz) on Debian 5 in a cluster of 3 nodes.

  I access my password protected pages over https.
 
  Mar 11, 2011 1:20:48 PM org.apache.catalina.ha.session.DeltaManager requestCompleted

  SEVERE: Unable to serialize delta request for sessionid 
[7D6D6A80C080C132F7EDCDAA3DFCEFB7]
  java.io.NotSerializableException: org.apache.catalina.realm.GenericPrincipal
  at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1164)
  at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:330)
  at java.util.LinkedList.writeObject(LinkedList.java:943)
  at sun.reflect.GeneratedMethodAccessor65.invoke(Unknown Source)
  at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
  at java.lang.reflect.Method.invoke(Method.java:597)
  at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:945)
  at 
java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1469)
  at 
java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1400)
  at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1158)
  at java.io.ObjectOutputStream.access$300(ObjectOutputStream.java:143)
  at 
java.io.ObjectOutputStream$PutFieldImpl.writeFields(ObjectOutputStream.java:1677)
  at java.io.ObjectOutputStream.writeFields(ObjectOutputStream.java:462)
  at javax.security.auth.Subject$SecureSet.writeObject(Subject.java:1281)
  at sun.reflect.GeneratedMethodAccessor64.invoke(Unknown Source)
  at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
  at java.lang.reflect.Method.invoke(Method.java:597)
  at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:945)
  at 
java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1469)
  at 
java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1400)
  at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1158)
  at 
java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1518)
  at 
java.io.ObjectOutputStream.defaultWriteObject(ObjectOutputStream.java:422)
  at 
java.util.Collections$SynchronizedCollection.writeObject(Collections.java:1602)
  at sun.reflect.GeneratedMethodAccessor63.invoke(Unknown Source)
  at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
  at java.lang.reflect.Method.invoke(Method.java:597)
  at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:945)
  at 
java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1469)
 
  Should I file an issue? Is this already known?
 
  Ronald.
 



 
  

Am I the only person with this? It is very easy reproducable and it looks like 
a bug in Tomcat code.

Ronald.

java.io.NotSerializableException: org.apache.catalina.realm.GenericPrincipal

2011-03-11 Thread Ronald Klop

Hi,

https://issues.apache.org/bugzilla/show_bug.cgi?id=47502

Because this issue is fixed I re-enabled using the security-constraint in 
web.xml to protect some pages in stead of using my own workaround. But now I 
get a somewhat similar exception.

This is running Tomcat 6.0.32 (directly from your tar.gz) on Debian 5 in a 
cluster of 3 nodes.
I access my password protected pages over https.

Mar 11, 2011 1:20:48 PM org.apache.catalina.ha.session.DeltaManager 
requestCompleted
SEVERE: Unable to serialize delta request for sessionid 
[7D6D6A80C080C132F7EDCDAA3DFCEFB7]
java.io.NotSerializableException: org.apache.catalina.realm.GenericPrincipal
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1164)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:330)
at java.util.LinkedList.writeObject(LinkedList.java:943)
at sun.reflect.GeneratedMethodAccessor65.invoke(Unknown Source)
at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:945)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1469)
at 
java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1400)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1158)
at java.io.ObjectOutputStream.access$300(ObjectOutputStream.java:143)
at 
java.io.ObjectOutputStream$PutFieldImpl.writeFields(ObjectOutputStream.java:1677)
at java.io.ObjectOutputStream.writeFields(ObjectOutputStream.java:462)
at javax.security.auth.Subject$SecureSet.writeObject(Subject.java:1281)
at sun.reflect.GeneratedMethodAccessor64.invoke(Unknown Source)
at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:945)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1469)
at 
java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1400)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1158)
at 
java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1518)
at 
java.io.ObjectOutputStream.defaultWriteObject(ObjectOutputStream.java:422)
at 
java.util.Collections$SynchronizedCollection.writeObject(Collections.java:1602)
at sun.reflect.GeneratedMethodAccessor63.invoke(Unknown Source)
at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:945)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1469)

Should I file an issue? Is this already known?

Ronald.

Re: [OT] OutOfMemoryError: GC overhead limit exceeded

2011-02-16 Thread Ronald Klop



Op woensdag, 16 februari 2011 18:17 schreef Christopher Schultz 
ch...@christopherschultz.net:


 


Chuck,

On 2/16/2011 11:37 AM, Caldarale, Charles R wrote:
 From: Christopher Schultz [mailto:ch...@christopherschultz.net]
 Subject: Re: [OT] OutOfMemoryError: GC overhead limit exceeded

 Here's what jmap reports this morning:

 PS Old Generation
capacity = 134217728 (128.0MB)
used = 61911720 (59.043617248535156MB)
free = 72306008 (68.95638275146484MB)
46.12782597541809% used

 Interesting.  Something must have broken loose overnight.

Definitely. It may have broken loose much earlier... I just didn't
observe it again after my initial post last night.

 Does this look healthy enough to continue, or should I
 schedule a restart ASAP?

 I'd let it run, and see what happens.

:)

Should I be concerned that neither jstack not jmap will run against the
JVM unless I specify the -F switch?

Thanks,
- -chris
 






I see the same problem with jstack and friends if a process is gc'ing a lot.

Ronald.

Re: [OT] OutOfMemoryError: GC overhead limit exceeded

2011-02-16 Thread Ronald Klop



Op woensdag, 16 februari 2011 19:18 schreef Christopher Schultz 
ch...@christopherschultz.net:


 


Ronald,

On 2/16/2011 12:48 PM, Ronald Klop wrote:
 I see the same problem with jstack and friends if a process is gc'ing a
 lot.

Interesting.

I don't have verbose GC enabled (can you enable that after JVM launch
using JConsole or something like that?), but the process doesn't seem to
be using a ton of CPU time which I would expect from a very active GC.

Do you observe this only when GC is /currently/ active or after there
has been a lot of GC activity. I'm wondering if the JVM is in a state
where everything is working properly except that one small things has
broken and prevents these tools from working without sprinkling the
force magic onto them.

Thanks,
- -chris
 






Where it is /currently/ active. I don't do much jstack/jmap if there is no 
problem, so can't really say something about it.

Ronald.

Re: mail.jar, activation.jar and classloading

2011-01-26 Thread Ronald Klop

For the record: JAF (activation.jar) is already in Java 6 (and that sucks :-)).


Op woensdag, 26 januari 2011 11:52 schreef Michael Ludwig mil...@gmx.de:


 
What is special about mail.jar (and activation.jar) that requires

putting them into the common.loader?

Quote from the Tomcat docs:

  Unpackage the distribution(s) and place mail.jar (and activation.jar
  if required) into $CATALINA_HOME/lib so the JAR(s) is(are) available
  to Tomcat during the initialization of the mail Session Resource.

http://tomcat.apache.org/tomcat-6.0-doc/jndi-resources-howto.html

This question is spawned by a recent thread on the Ant mailing list,
where the same question was raised in the context of classloading
issues, but not answered.

Mail task with mail.jar  activation.jar out of lib folder
http://ant.markmail.org/thread/ojjm7g5otejua33i

Thanks.
--
Michael Ludwig

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

 






Re: Is memleak in tomcat 7.0.5 also in tomcat 6.0.30?

2011-01-20 Thread Ronald Klop




Op donderdag, 20 januari 2011 17:03 schreef Mark Thomas ma...@apache.org:


 
On 20/01/2011 15:45, Mark Thomas wrote:

 On 20/01/2011 15:29, Mark Thomas wrote:
 On 20/01/2011 11:50, Ronald Klop wrote:
 Hi,

 In this mail thread there is mention of a memory leak which is fixed in
 Tomcat 7.0.6.
 http://marc.info/?l=tomcat-userm=129487211630075w=2

 Is it possible that this leak also exists in 6.0.30 (and not in 6.0.29)?
 We are seeing problems since 6.0.30 with the Nio connector. Just a quick
 question to rule this option out.

 Not a chance. I introduced the bug in 7.0.x with some Servlet 3
 re-factoring. That re-factoring was not back-ported to 6.0.x.

 It is easy to confirm. With the leak, you would see one
 Http11NioProcessor object on the heap for every HTTP request made. An
 OOME soon followed.
 
 Given that there have been two reports of this, I may need to take that

 back. Let me do some tests.

/me swears loudly and eats words re the Not a chance comment.

The re-factoring wasn't back-ported but a few lines of code were [1] as
a follow up to a fix in a similar area. Those few lines introduced this bug.

This makes the NIO connector in 6.0.30 pretty much useless.

I'll get the process started to fix this on the dev list.

Mark

[1] http://svn.apache.org/viewvc?view=revisionrevision=1033341
 






Thanks a lot for looking into this! I was just planning to put some time and 
effort in making a test case when I saw your last mail. I will visit a Tomcat 
conference some day and offer you a beer or two. :-)

Ronald.

Re: servlets under tomcat5 consume huge CPU usage

2011-01-19 Thread Ronald Klop

Su to the user running tomcat.
Run 'jps'. Find the pid of the process running 'Bootstrap'.
Run 'jstack pid'. This gives you the thread dump.

The id's of the threads (in hex) correspond to the pid's (in decimal) of the 
threads in ps -H or top with threads on.

You can also find the pid with ps like you are likely used to.

Ronald.


Op woensdag, 19 januari 2011 11:05 schreef Petr Hracek phrac...@gmail.com:


 
Dear users,


I do not understand correctly.
I am linux administrator but the command like 'thread dump' is not existing.
Do you have any example?

Thank you in advance

Petr

2011/1/19 Mark Thomas ma...@apache.org:
 On 19/01/2011 08:29, Petr Hracek wrote:
 Dear tomcat users,

 I would like to ask you on the some thing regarding servlets running
 under tomcat 5 linux OS.
 How could I detect if servlet is running or not?
 Output of command ps -ef | grep java does not help me enought. I could
 not catch what java process is used by servlets
 Are there any special setting in tomcat5 which could show me more 
information?

 Use a thread dump. You can match thread IDs with ps output if you need to.

 Mark

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





--
Best Regards / S pozdravem
Petr Hracek

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


 








7.0.6 NPE in cluster syncing

2011-01-14 Thread Ronald Klop

Hi,

Today I upgraded Tomcat from 7.0.5 to 7.0.6. Now I have these errors in de logs.
Jan 14, 2011 4:24:50 PM org.apache.catalina.ha.tcp.ReplicationValve 
sendReplicationMessage
SEVERE: Unable to perform replication request.
java.lang.NullPointerException
   at 
org.apache.catalina.ha.tcp.ReplicationValve.isRequestWithoutSessionChange(ReplicationValve.java:554)
   at 
org.apache.catalina.ha.tcp.ReplicationValve.sendSessionReplicationMessage(ReplicationValve.java:488)
   at 
org.apache.catalina.ha.tcp.ReplicationValve.sendReplicationMessage(ReplicationValve.java:404)
   at 
org.apache.catalina.ha.tcp.ReplicationValve.invoke(ReplicationValve.java:349)
   at 
org.apache.catalina.ha.session.JvmRouteBinderValve.invoke(JvmRouteBinderValve.java:218)
   at 
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:380)
   at 
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:243)
   at 
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:188)
   at 
org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:288)
   at 
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
   at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
   at java.lang.Thread.run(Thread.java:662)

And I loose my session when the loadbalancer sends me to another server.

Can these happen because I have migrated sessions from 7.0.5 to 7.0.6 while 
upgrading one node at a time? Or is this a bug in 7.0.6?

Ronald.



Re: How to configure Tomcat/Coyote to deliver a P3P Header on Every Request

2011-01-14 Thread Ronald Klop

We do this with a filter mapped to /*.

Ronald.


Op vrijdag, 14 januari 2011 21:32 schreef Joseph Morgan 
joseph.mor...@ignitesales.com:


Using Tomcat 6.0.13, how do we configure the Coyote server to deliver a
P3P header on every request, even if for a JavaScript, Image, CSS, etc?

 




Joseph M. Morgan

Ignite Sales, Inc.

Director of Technology and Operations

Office  972-789-5523

Email: joseph.mor...@ignitesales.com

Web: www.ignitesales.com

 


Guaranteed Increase in Core Revenue for Banks

 

 








Re: Need help in understanding tomcat thread dump

2011-01-11 Thread Ronald Klop
Op dinsdag, 11 januari 2011 12:11 schreef Amol Puglia amolcpug...@yahoo.com: 
 


Hello Team,

I have taken thread dump for tomcat. I have analyzed it using Thread dump 
analyzer.

After reading thread dump i am unable to point which thread is exactly causing 
the issue.

kindly guide me to read thread dumps.

Following is the one of the thread from the thread dump output.

TP-Processor50 daemon prio=5 tid=0x00449ea8 nid=0x56 waiting on condition 
[9427e000..9427fc30]
at java.lang.Thread.sleep(Native Method)
at com.ericsson.eai.b2b.MUXServlet.doPost(MUXServlet.java:506)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at 
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at 
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
at 
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
at 
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
at 
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
at 
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
at org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:307)
at org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:385)
at org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:748)
at 
org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:678)
at org.apache.jk.common.SocketConnection.runIt(ChannelSocket.java:871)
at 
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
at java.lang.Thread.run(Thread.java:534)









What is the issue? (Was there another mail that I missed?)

Ronald.




Re: Apache Process going high even after restart of backend server tomcat

2011-01-11 Thread Ronald Klop

In 'the other thread' there is still the question open of why there is 
Thread.sleep() in the MuxServlet. Can be a reason for a lot of open connections 
in the httpd server.

But until there is more information about the problem I don't have anything to 
add to this discussion anymore.

Ronald.


Op dinsdag, 11 januari 2011 14:23 schreef André Warnier a...@ice-sa.com:


 
Amol Puglia wrote:

 Hello Andre Warnier,
 
 Thanks for the response. I am talking about apache web server whose process count is increasiing to 259 and not coming down. I would like to know why process count is increasing and not coming down. Please help me to toublleshoot this issue.Let em know in case you need further information.
 


I am extremely tempted to answer that if the problem is at the Apache httpd 
server level, then it is not our problem on this list.  We deal only with 
Tomcat.

But someone else already answered that apparently.
So I'll make another effort.

To answer your question : we don't know.  There can be a million reasons.
Some of these reasons can have to do with the back-end Tomcat, but that is only 
a possibility. It may have nothing to do with Tomcat at all.

One possibility is that there are just many user requests coming in to your 
Apache httpd server, and it is not fast enough to handle the load.
So, in order to stay on this list, what makes you think that the problem has 
anything to do with the back-end Tomcat ?



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









RE: How to disable chunked encoding for the Http11NioProtocol connector.

2011-01-05 Thread Ronald Klop

What is the overhead of ending a tcp connection and creating a new one? Because 
you are removing the benefits of keep-alive here.
Compare that with sending 6 extra bytes in a IP-packet that you are sending 
anyway.

Ronald.


Op woensdag, 5 januari 2011 16:29 schreef ilya goberman gober...@msn.com:


 



Mark, overhead of chunked encoding can be significant. My typical message is 
about 50 bytes and chunked encoding takes 6 bytes per message: about 12%. I use 
JSON protocol that is already compressed (the way JSON can be compressed).

Using  Connection: close with Content-Length header omitted is perfectly valid from HTTP perspective. The end of response is detected by terminating connection on the server side. 


In fact some browsers have problems detecting connection termination (and host 
of other issues) related to the chunked encoding.
While I understand it is not a Tomcat issue, it will score some points for 
Tomcat if this is addressed by adding a configuration option.
Thanks

 Date: Wed, 5 Jan 2011 06:14:18 +
 From: ma...@apache.org
 To: users@tomcat.apache.org
 Subject: Re: How to disable chunked encoding for the Http11NioProtocol 
connector.
 
 On 05/01/2011 05:04, ilya goberman wrote:
  
  Hi,

  I use NIO HTTP Tomcat connector org.apache.coyote.Http11NioProtocol to 
implement Comet streaming to browsers and mobile devices.
  
  I would like to disable HTTP response chunked encoding to reduce bandwidth.
 
 How significant is the overhead with chunking in your case? I'd expect

 it to be pretty small unless only a few bytes are sent at a time (and
 even then there is the overhead for the packet).
 
 Is there any mileage in using compression to reduce bandwidth instead?

 Issues with flushing compressed output streams [1] were fixed last year.
 
  The response will have header Connection: close with Content-Length header omitted.

  Is there a way to do it besides having client send HTTP 1.0 request (that 
is not possible in the majority of cases)?
 
 Having looked at the relevant source code the only two ways I can see are:

 - sending an HTTP 1.0 request
 - declaring a content length
 
 It used to be possible to control this by disabling keep-alive but that

 was changed back in April last year [2],[3] as a result a discussion on
 the dev list [4]. If your Tomcat version is old enough, you may still be
 able to use the disable keep-alive trick.
 
 My own view was then, and is now, that the extra bytes with chunking are

 a price worth paying for the client to be able to determine if the
 request is complete. That said, an option on the connector to revert to
 non-chunked responses when keep-alive is disabled for use cases where
 reducing bandwidth is more important than knowing if the response is
 complete seems reasonable to me.
 
 Mark
 
 [1] http://issues.apache.org/bugzilla/show_bug.cgi?id=48738

 [2] http://svn.apache.org/viewvc?rev=931709view=rev
 [3] http://svn.apache.org/viewvc?rev=932913view=rev
 [4] http://markmail.org/message/pim62zhlw4cii7ve
 
 -

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









Re: Setting max file upload size

2010-12-29 Thread Ronald Klop

Set Connector maxPostSize=very large number / in server.xml.
3 GB might be very large. I don't know if the value is a long or an int in the 
internals of Tomcat.

This is from my live server.

   Connector port=8080 maxHttpHeaderSize=8192
  maxThreads=300 minSpareThreads=25 maxSpareThreads=75
  enableLookups=false redirectPort=8443 acceptCount=1024
  connectionTimeout=2 disableUploadTimeout=true
  compression=on
  maxPostSize=104857600 /

Ronald.

Op woensdag, 29 december 2010 17:03 schreef Anjib Mulepati 
anji...@hotmail.com:


 
I am trying to upload the larger file through my app developed using Struts 1.3.8. I did change the config in struts to upload file upto 3GB but that doesn't work.

So now I am trying to find the configuration in Tomcat where I can set the max 
size for file upload.
Is there any?

Anjib



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









+1 for 6.0.30 (was: Re: Http11NioProtocol error 505 (or 400))

2010-12-28 Thread Ronald Klop

Hi,

May I vote +1 for a 6.0.30 in relation to this bug.

Ronald.


Op dinsdag, 28 december 2010 10:19 schreef Olaf Tomczak 
olaf.tomc...@gmail.com:


 



Ok,
 
I used   Mark Thomas' patch that Roland suggested - created a clean instance of Tomcat with and without the patch and tested it with my request. Indeed the patched instance handles the requests correctly. Just FYI this is my request:
 
GET /0123456789012345678901234567890123456.htm HTTP/1.1

Accept: 
application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
Accept-Charset: ISO-8859-2,utf-8;q=0.7,*;q=0.3
Accept-Encoding: gzip,deflate,sdch
Accept-Language: pl-PL,pl;q=0.8,en-US;q=0.6,en;q=0.4
Authorization: Basic 012345678901234567890123
Cache-Control: max-age=0
Cookie: 
test_cookie=0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
Referer: http://example.org/012345678912345678901234567890123456789012345678901
User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US) AppleWebKit/534.10 
(KHTML, like Gecko) Sabayon Chrome/8.0.552.210 Safari/534.10
Host: olaftomczak.com:6060
Connection: keep-alive
 
I also attached it as a JMeter test configuration.

Here're the results:
- patched instance:
sampleResult responseMessage=Not Found responseCode=404 dataType=text time=245 
timeStamp=1293527375642 threadName=Thread Group1-1 label=HTTP Request success=false/
- instance with no patch:
sampleResult responseMessage=HTTP Version Not Supported responseCode=505 dataType= time=444 
timeStamp=1293527344000 threadName=Thread Group1-1 label=HTTP Request success=false/
 
Thanks for your help guys!
 
Cheers, Olaf
 
 
2010/12/28 Christopher Schultz ch...@christopherschultz.net


-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Olaf,

On 12/27/2010 5:24 PM, Olaf Tomczak wrote:
 2010/12/27 Christopher Schultz ch...@christopherschultz.net
 Non-blocking just means that your request processor threads don't block
 waiting for data to arrive. The requirements of reading the request --
 including all the headers -- do not change with the connector. Tomcat
 needs to read the entire set of headers in order to route the request to
 the right host and webapp. Also, Tomcat must have all headers in order
 to perform some operations -- such as responding to getHeaders calls
 which sometimes require that multiple separate HTTP header lines be
 merged into a single method return value.

 I understand that the whole request must be read to start request
 processing - I was just suggesting that from what I understand the
 connector does not wait for the buffer to be completely filled before
 starting to parse request line and headers. Isn't that right?

I don't believe the difference you describe would be detectable at any
level. The choice of connector does not change the logic for request
processing: only that of gathering the bytes from the request.


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

iEYEARECAAYFAk0ZGxMACgkQ9CaO5/Lv0PCygACgv66l6yc6Wubf/szFbfgOm90B
nEgAoI/MAXqpieNtwKr3p389EV6lyQy5
=MsJZ

 
-END PGP SIGNATURE-


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






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








Re: Http11NioProtocol error 505 (or 400)

2010-12-27 Thread Ronald Klop


I see similar errors. If it is the same there should be a fix in Tomcat 7.0.4 
and 6.0.30 (not released yet)

Something like this?
https://issues.apache.org/bugzilla/show_bug.cgi?id=50072

Ronald.


Op maandag, 27 december 2010 18:59 schreef Olaf Tomczak 
olaf.tomc...@gmail.com:


Hi,

I'm using Http11NioProtocol connector on my Tomcat 6.0.29 instance and I
noticed that sometimes I experience strange responses:
- 400 - Bad Request,
- 505 - HTTP Version Not Supported

My first conclusion was that it's somewhat related to the size of the
request (e.g. clearing session cookies always fixed the problem). I then
recompiled Tomcat from sources adding some additional logs
to Http11NioProcessor and InternalNioInputBuffer classes. I also isolated a
test request that always fails on my test server instace and used it as a
JMeter test configuration.

I'm using the following connector configuration:

Executor name=tomcatThreadPool namePrefix=catalina-exec-
maxThreads=256 minSpareThreads=32/
Connector executor=tomcatThreadPool
acceptorThreadCount=4
useComet=false
address=0.0.0.0
port=4080
protocol=org.apache.coyote.http11.Http11NioProtocol
connectionTimeout=3
redirectPort=4443
enableLookups=false
/

Looking at my logs I found out that the request fails with the following
scenario:

InternalNioInputBuffer.parseRequestLine - successfully parses the first
request line
InternalNioInputBuffer.parseHeader - parses some headers but then fails to
read more data and returns with HeaderParseStatus.NEED_MORE_DATA status
InternalNioInputBuffer.parseRequestLine - is called again and then tries to
parse the remaining headers and fails with 505 since it takes a part of
'User-Agent' header value as a protocol name.

Can someone familiar with the Http11NioProtocol connector help me with this
problem?

I also noticed that when a use a local instance of Tomcat (on the same host
as my jmeter) with the same configuration the requests work (I suppose it's
because the connection is faster and more data is available in the buffer
without delay).

Thanks a lot,
Olaf Tomczak
 








Re: Tomcat dying on its own

2010-12-07 Thread Ronald Klop




Op dinsdag, 7 december 2010 09:52 schreef Rainer Jung rainer.j...@kippdata.de:


 
On 06.12.2010 23:36, Guillaume Carbonneau wrote:

 On Mon, Dec 6, 2010 at 2:25 PM, Konstantin Kolinko
 knst.koli...@gmail.com  wrote:
 2010/12/6 Guillaume Carbonneauguillaume.carbonn...@gmail.com:
 Hi everyone,
 My tomcat server seems to die on its own without leaving any backtrace...

 The  last info I get in the logs are :
 Dec 3, 2010 6:11:35 PM org.apache.coyote.http11.Http11Protocol pause
 INFO: Pausing Coyote HTTP/1.1 on http-8077
 Dec 3, 2010 6:11:36 PM org.apache.catalina.core.StandardService stop
 INFO: Stopping service Catalina
 Dec 3, 2010 6:11:36 PM org.apache.coyote.http11.Http11Protocol destroy
 INFO: Stopping Coyote HTTP/1.1 on http-8077

 Running The Apache Tomcat 6.0 (6.0.29)
 Linux Oracle Red hat : 2.6.18-194.el5
 java version 1.6.0_21

 This has happened more than once and will occur even if there is no
 traffic. restarting brings it back up but it has proven to be
 unreliable...


 At least, it is not a sudden death.

 Tomcat can be shut down by sending a certain string to port 8005 on
 localhost (see the first lines of server.xml),  -  normal shutdown
 or by sending a system signal that causes JVM to exit, or by calling
 System.exit().
 -  shutdown hook perform the shutdown

 You can install a Listener and print a stacktrace when the stop event
 happens.  The stack traces for the normal shutdown sequence and for
 the shutdown hook will be different.

 The Linux out-of-memory killer was already mentioned.

 BTW, you are not alone: such a thread happens here every 4-6 months.

 Best regards,
 Konstantin Kolinko

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



 I seem to have solved the problem at least temporarily through this solution :
 I installed the latest JDK on the deployed machine and ran tomcat
 through catalina.sh debug, then run
 No crash so far so good.

When starting Tomcat interactively you should be aware that some shells kill all child 
processes when you log out (or get logged out automatically). There's nohup 
though.

I'm not sure what kind of signal is used then, so I can't tell whether the 
orderly shutdown messages in your logs contradict that theory or not.

Regards,

Rainer






Nohup stands for 'no hup', so the signal is HUP and that means HANG-UP as in 
disconnect your modem. Only the modem is replaced with ssh nowadays.

Ronald.



Re: migrating to Tomcat 7, when

2010-12-03 Thread Ronald Klop




Op vrijdag, 3 december 2010 10:09 schreef Justin Case 
send_lotsa_spam_h...@yahoo.com:


 
Hi all,


I see discussions about migration to Tomcat 7. Do you think it is the right 
moment to count your production apps on it? My thought is no way Jose but 
maybe I'm missing something...


Thank you,
JC






The answer probably depends on how depended you are on the corner cases of how 
Servlets work. Start running your development and testing servers on it, so you 
can see what it does for you. And post your findings here.

Ronald.



Comet while migrating to Tomcat 7

2010-12-02 Thread Ronald Klop

Hello,

I'm trying Tomcat 7. The Comet classes have been moved from the 
org.apache.catalina package to the org.apache.catalina.comet package. That is 
fine by me. But for deployment reasons it would be easy if I can deploy the 
same war on Tomcat 6 and Tomcat 7. In that way I don't need a turn-key upgrade 
of my Tomcat servers.

Is there a way to make it dynamic which package is used? Something like a Proxy 
or some other trick I don't know yet.
How do others do this?

Ronald.



Re: Comet while migrating to Tomcat 7

2010-12-02 Thread Ronald Klop
Op donderdag, 2 december 2010 20:37 schreef Pid p...@pidster.com: 
 



On 12/2/10 3:28 PM, Ronald Klop wrote:
 Hello,
 
 I'm trying Tomcat 7. The Comet classes have been moved from the

 org.apache.catalina package to the org.apache.catalina.comet package.
 That is fine by me. But for deployment reasons it would be easy if I can
 deploy the same war on Tomcat 6 and Tomcat 7. In that way I don't need a
 turn-key upgrade of my Tomcat servers.
 
 Is there a way to make it dynamic which package is used? Something like

 a Proxy or some other trick I don't know yet.

This wouldn't require code changes?

 How do others do this?

Recompile, or produce two versions of the app.  :s


p












Hi,

My problem is not changing the code, but I now have to maintain two versions of 
the code. One with import org.apache.catalina.CometProcessor and one with 
org.apache.catalina.comet.CometProcessor. And Eclipse has to resolve both of 
them.

Look. I can now choose to develop against Tomcat 7, but when I have a problem 
with it in production in a couple of weeks I would like to have the ability to 
switch back to Tomcat 6 easily.

Somehow we wil manage this, but I was wondering how other people are doing this 
migration. Maybe I'm missing something clever.

In the end I'm expected to switch to ServletRequest.doAsync(), or am I not?

Ronald.



Re: [OT] How to obtain the id of the current process

2010-11-18 Thread Ronald Klop

That is why my Tomcats spawn a pool of sh scripts to have them run a unix 
command (ImageMagick, etc.)
Forking of a threaded process is very expensive on a loaded server. Unix has to 
suspend all threads, than fork, do a lot of housekeeping and than resume all 
threads. After making a pool of running sh instances which listen on stdin for 
commands my system %cpu went down so it has more time for user %cpu. Throughput 
doubled in my scenario's.

Ronald.


Op woensdag, 17 november 2010 22:30 schreef Leon Rosenberg 
rosenberg.l...@gmail.com:


 
Hi,


I have a ugly issue I'm sure many people on this list already solved.
For multiple purposes I need pid's of processes, to stop/start them or
ensure they are running. So far nothing spectacular.
To obtain the pid I have following util:

String[] cmd = { /bin/bash, -c, echo $PPID };
p = Runtime.getRuntime().exec(cmd);

and afterwards read the ppid from the output stream of my process. So
far - so good.

The problem now occurs if a process has a lot of memory configured.
Like 25Gb on a 32Gb machine. In such a configuration the above command
fails with an OS'es out of memory, because fork
fails to create another process with THAT amount of memory:

1598388 2010-11-17 02:54:47,061 ERROR net.anotheria.util.PidTools -
Could not determine PID: java.io.IOException: Cannot run program
/bin/bash: java.io.IOException: error=12, Cannot allocate memory

Is there another method to obtain the process id from within the process?

regards
Leon

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









Re: Malicious host is crashing my server

2010-11-08 Thread Ronald Klop

Use ngrep, tcpdump or wireshark to look at what he/she is requesting. If it is 
SQL injection you should rewrite your query's to use PreparedStatements.

Ronald.


Op zondag, 7 november 2010 18:31 schreef Assaf ass...@yahoo.com:


 
Hi,


It might be. But I am not sure how to find out more. Any suggestions?

Assaf


- Original Message 
From: Marc Boorshtein mboorsht...@gmail.com
To: Tomcat Users List users@tomcat.apache.org
Sent: Sun, November 7, 2010 6:29:09 PM
Subject: Re: Malicious host is crashing my server

JDBC?  Are you sure its not an attempted SQL Injection attack?

On Sun, Nov 7, 2010 at 12:23 PM, Assaf ass...@yahoo.com wrote:
 Hello,

 I have a recurring visitor (from a fixed IP
 address: bzq-79-177-23-102.red.bezeqint.net) who is constantly visiting my 
site

 and EACH time causes the server to crash. My server actually gets a JDBC begin
 failed error for the next http calls.

 Analyzing the logs, I cannot find out what is wrong. I can see it is a script 
as

 he is visiting the same pages in the same order (never downloading
 images/css/js). The only thing that I have noticed that is different with this
 user are the http headers he uses:

 Expand HTTP read ahead 1.0

 I could not google anything about those. I am running tomcat 6.0.20 on linux
 with mysql.

 Anyone has an idea what this can be? How to find out? Also, what can I do to
 better protect?

 Thanks,

 Assaf




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



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


  


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









Re: JSP Precompilation and Servlet 3.0

2010-11-08 Thread Ronald Klop

+1 Precompiled jsp's with annotations in a jar.


Op vrijdag, 5 november 2010 21:07 schreef Pid p...@pidster.com:


 



On 05/11/2010 15:06, Christopher Schultz wrote:
 Chuck,
 
 On 11/5/2010 10:57 AM, Caldarale, Charles R wrote:
 From: Christopher Schultz [mailto:ch...@christopherschultz.net] 
 Subject: JSP Precompilation and Servlet 3.0
 
 Hopefully, this will make JSP precompilation less onerous for

 users.
 
 I don't think the current mechanism is particularly onerous, since

 Tomcat supplies an ant script to do all the dirty work, including the
 update of web.xml.
 
 My understanding is that the ant script needs some help to get

 started: you can't simply run the JSP precompiler against an existing
 webapp without seeding web.xml, at least a bit.

I suggested generating annotated java a little while back and didn't get
an overly enthusiastic reception, but I like the general idea of the
JSPs being in their own jar.

I think it would be good if Tomcat 7.0 featured and used Servlet 3.0
functions, the source is available and it'll help users get to know the
spec.


p













servlet-mapping order?

2010-11-08 Thread Ronald Klop

Hi,

I have a couple of servlets and the mapping in web.xml is like this:

   servlet-mapping
   servlet-nameEntityServlet/servlet-name
   url-pattern/servlets/*/url-pattern
   /servlet-mapping

   servlet-mapping
   servlet-nameRRDStatsServlet/servlet-name
   url-pattern/servlets/rrdstats/url-pattern
   /servlet-mapping

On startup EntityServlet sometimes complains that is does not know anything 
about path /servlets/rrdstats. This is an error I throw myself.
This is between:
Nov 08 15:35:32 rwlinux54 INFO: Starting Coyote HTTP/1.1 on http-8080
errors here
Nov 08 15:35:32 rwlinux54 Nov 8, 2010 3:35:32 PM 
org.apache.coyote.http11.Http11Protocol start
Nov 08 15:35:32 rwlinux54 INFO: Starting Coyote HTTP/1.1 on http-8443
Nov 08 15:35:32 rwlinux54 Nov 8, 2010 3:35:32 PM 
org.apache.coyote.http11.Http11Protocol start
Nov 08 15:35:32 rwlinux54 INFO: Starting Coyote HTTP/1.1 on http-8444
Nov 08 15:35:32 rwlinux54 Nov 8, 2010 3:35:32 PM 
org.apache.catalina.startup.Catalina start
Nov 08 15:35:32 rwlinux54 INFO: Server startup in 75504 ms

After 'Server startup' everything works as expected. So the order of 
servlet-mapping in web.xml doesn't look important to me.
What is happening? Are servlets available to early? Before all the mappings are 
ready.

And what is the best thing to do for me to fix this?

Using Tomcat 6.0.29 on Debian Lenny with java 6.0.20 from Debian pkgs.

Ronald.



Re: how can i turn off This is very likely to create a memory leak.

2010-10-29 Thread Ronald Klop

grep -v memory leak


Op donderdag, 28 oktober 2010 15:44 schreef Leon Rosenberg 
rosenberg.l...@gmail.com:


 
Hello,


I investigated an issue (another thread) with new error messages after
tomcat update:

SEVERE: The web application [/moskitodemo] appears to have started a
thread named [MoskitoMemoryPoolReader] but has failed to stop it. This
is very likely to create a memory leak.


After some research and discussions with colleagues we came to the
conclusion that this message is ... well not helping us. Is there a
possibility to turn it off? Its annoying to have such messages in the
logs
after a server shutdown. For explanation: I'm not planing to use
webapp reload in my environment, hence, this message is actually just
spam.

regards
Leon

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









Re: RV: Session Context variables architecture problem

2010-10-29 Thread Ronald Klop

Just query the database. Enable query caching in mysql. And only optimize in 
java if you see a bottleneck.
My mysql does 15000 queries/sec.

What is your expectation of number of queries?

Ronald.


Op donderdag, 28 oktober 2010 19:31 schreef falva...@geocom.com.uy:


 


Dear All,

I'm currently using Tomcat 6.0.28 and having some doubt on
how to solve and implement this problem:

 


   My webapp has a MySQL Database with a table
named parameters, in which we have just two columns (property and
value). This table is acceded many times but doesn't change often.

 


   For performance purposes I want to save this
parameters in the user's tomcat session, so they are read from memory and
not database. So far so good.

 


   Now the problem: how can I tell this sessions
that an attribute has changed?

 


I had suggestions of using context variables instead of
session variables, but that didn't solve the problem.

 


Any help in this matter is more than welcome. I have no problem in changing
the approach, and may be not use sessions at all.

 


Thanks in advance.

 


Best regards,

Federico Alvarez.

 


Info:

Tomcat 6.0.28

Java 1.6

MySQL 5.5

NOT USING HIBERNATE, so 2nd Level cache is not an option









Re: running tomcat6 under a different user than root (debian)

2010-10-29 Thread Ronald Klop

If you have a webapp where users log in you can use there login/password to 
login on the database. A little bit inconvenient for the DBA but you don't have 
passwords on your servers.

Ronald.


Op vrijdag, 29 oktober 2010 15:42 schreef Rainer Frey rainer.f...@inxmail.de:


 
On Friday 29 October 2010 15:34:29 Mark Thomas wrote:

 If Tomcat has access to a database and the attacker has access to a
 shell prompt (or similar) with the same privileges as Tomcat then the
 attacker has access to the database and there is absolutely nothing you
 can do to prevent that.

In theory, there is a way Tomcat could implement. You could interactively ask 
for all needed passwords when starting Tomcat and keep them only in memory. 
httpd does that by default for encrypted SSL primary keys. But in practice the 
userbase that would accept the inconvenience and the impossibility to 
automatically start tomcat would be too small to spend time for that. And the 
practical security gain is small.


 Mark

Rainer

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









Re: How to start a daemon without getting the warning?

2010-10-28 Thread Ronald Klop

You should call timer.cancel() on context stop. You can do this from a 
ServletContextListener.

Ronald.


Op woensdag, 27 oktober 2010 22:10 schreef Leon Rosenberg 
rosenberg.l...@gmail.com:


 
Hello,


I'm getting following warning with 6.0.29,

after shutdown:
SEVERE: The web application [/moskitodemo] appears to have started a
thread named [MoskitoMemoryPoolReader] but has failed to stop it. This
is very likely to create a memory leak.

here's the snapshot of the code that starts the thread:


public class BuiltInMemoryPoolProducer implements IStatsProducer{

/**
 * Timer instance for this producer type.
 */
private static final Timer timer = new Timer(MoskitoMemoryPoolReader, 
true);

...

public BuiltInMemoryPoolProducer(MemoryPoolMXBean aPool){

timer.scheduleAtFixedRate(new TimerTask() {
@Override
public void run() {
readMemory();
}
}, 0, 1000L*60);
...}

to my knowledge this thread is a daemon. This knowledge is also shared
by jstack:


MoskitoMemoryPoolReader daemon prio=5 tid=10883f800 nid=0x11a9b2000
in Object.wait() [11a9b1000]
   java.lang.Thread.State: TIMED_WAITING (on object monitor)
at java.lang.Object.wait(Native Method)
- waiting on 10a1120d0 (a java.util.TaskQueue)
at java.util.TimerThread.mainLoop(Timer.java:509)
- locked 10a1120d0 (a java.util.TaskQueue)
at java.util.TimerThread.run(Timer.java:462)

So, how can I avoid this warning and where's the bug.

regards
Leon

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









Re: lock session in distributed environment

2010-10-15 Thread Ronald Klop

Op vrijdag, 15 oktober 2010 10:02 schreef Roman Makurin dro...@gmail.com:


 


Hi All!

I have an app which rely on session locking and its key
point here. Everything work on single tomcat instance,
but its completly broken in distributed env. So i want to
know is there any way to get my app working without
complete redesing? I need lock all incoming requests 
untill business logic will be done, this lock must be

available on all nodes in cluster.

any advise?

Thanks

--
If you think of MS-DOS as mono, and Windows as stereo,
 then Linux is Dolby Digital and all the music is free...









This is something a database can do very well. There are also things like a 
distributed HashMap which you might use to do locking in your setup.  But that 
probably is what you see as complete redesign (and it is :-) ).

Ronald.


Re: lock session in distributed environment

2010-10-15 Thread Ronald Klop

Op vrijdag, 15 oktober 2010 13:00 schreef Roman Makurin dro...@gmail.com:


 


On Fri, Oct 15, 2010 at 12:34:10PM +0200, Ronald Klop wrote:
 Op vrijdag, 15 oktober 2010 10:02 schreef Roman Makurin dro...@gmail.com:
 
 
 Hi All!
 
 I have an app which rely on session locking and its key
 point here. Everything work on single tomcat instance,
 but its completly broken in distributed env. So i want to
 know is there any way to get my app working without
 complete redesing? I need lock all incoming requests untill
 business logic will be done, this lock must be
 available on all nodes in cluster.
 
 any advise?
 
 Thanks
 
 -- 
 If you think of MS-DOS as mono, and Windows as stereo,

  then Linux is Dolby Digital and all the music is free...
 
 
 
 
 
 
 
 
 This is something a database can do very well. There are also things like a distributed HashMap which you might use to do locking in your setup.  But that probably is what you see as complete redesign (and it is :-) ).
 
 Ronald.


Looks like HashMap is like distributed HttpSession object,
but does it support locking? Eg. I lock session at first
node and all other nodes r aware of this lock. 
 









If you are locking with synchronized or something like that than it doesn't 
work between different JVM's.

Ronald.


Re: Deploy Dynamic Contexts

2010-10-07 Thread Ronald Klop




Op donderdag, 7 oktober 2010 11:49 schreef Rob Gregory 
rob.greg...@ibsolutions.com:


 


Hi Tomcat Community,

 


Does anyone know if it is possible to dynamically create contexts on
demand. I have a requirement to be able to ship a single application.war
file and create multiple contexts from this without manually using the
manager application etc.  Tomcat is the latest version 6.0.29.

 


Dare I ask if it is possible to extend the manager servlet to achieve
this deployment task?

 


Thanks in advance

Rob

 








You can de a lot with JMX. But I have never used it myself for deploying 
context, so can't give you any advise about that.
http://tomcat.apache.org/tomcat-6.0-doc/monitoring.html

Ronald.



RE: Tabbed browsers sharing session - work around.

2010-10-05 Thread Ronald Klop

Rob,

IE 6 is even more confusing. If you open a new window with ctrl-N you have the 
same session sharing as with tabs. Only if you click the IE6-icon to start a 
new instance of the process it will not share them. Opening a new tab in IE7 is 
like using ctrl-n to open a new window in IE6.

Ronald.


Op dinsdag, 5 oktober 2010 10:26 schreef Rob Gregory 
rob.greg...@ibsolutions.com:


 
Hi Chris,


Is there any way to dynamically create these contexts or do they require a live.xml, test.xml, etc within conf/Catalina/localhost. The multiple contexts would be my preferred approach although I would like to achieve this with a single code base if this is possible. The multiple environments are driven purely by the backend database connection, i.e. the code is the same with the only difference being where the data is being saved to. Hence the requirement to stop the browser sharing the same session when in different database connections. 

I'm surprised that other people are not having the same issues since the browser manufacturers decided to make this crazy change to session management between tabs/instances and suddenly share the same session. In I.E.6 two browser instances would be two separate sessions. I.E.7 they are the same session! 


Thanks for your input.
Kind Regards,
Rob.


-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Ronald,

On 10/4/2010 6:11 AM, Ronald Klop wrote:
 You can run your test environment on another hostname.
 
 live.example.com

 test.example.com
 train.example.com

Or under another context:

http://www.example.com/live
http://www.example.com/test
http://www.example.com/train

The real question is why there's any confusion: your hostnames and/or
URLs ought to be unique enough already. Otherwise, this sort of
foolishness can affect your real users and you'll leak data all over
the place.

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

iEYEARECAAYFAkyqDDQACgkQ9CaO5/Lv0PDWRACgrlgU+jY+n8nMCZ2WTO63UHDh
10UAoJdyNWqu0nlRGcWbJ6Mcc7zbsGy+
=JP4k
-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 bottleneck

2010-10-05 Thread Ronald Klop




Op dinsdag, 5 oktober 2010 15:27 schreef mamalacation 
mamalacat...@hotmail.com:


 


n828cl,


n828cl wrote:
 
 
 Pretty much guaranteed that it's not Tomcat but your webapp that is
 locking itself out of access to some resource (such as the database). 
 Take several thread dumps during the slowdown period and see what's going

 on.
 
 http://wiki.apache.org/tomcat/HowTo#How_do_I_obtain_a_thread_dump_of_my_running_webapp_.3F

 http://wiki.apache.org/tomcat/FAQ/Performance_and_Monitoring
 
 BTW, tell us the *exact* Tomcat version, and the JVM level you're running

 on.
 
 


as far as the version as concerned:

Tomcat Version:  6.0.26 
JVM Version : 1.6.0_20-b02  
JVM Vendor : Sun Microsystems Inc.


I will look at the links you proposed to see what's going on with my
webapps, but I am pretty sure that there must be some limit somewhere that I
can't see.

Where can I set the database options regarding timouts, pool size,
max_database_connections, etc? 


thanx again,

mamalos







Try the tools to make a threadsdump. That wil show you what the webapp is doing 
and wil probably give you a hint about the 'limits'. Stay open minded. You can 
also have some bug in the software so some resources are never free'd. In that 
case you can keep raising the limits, but that doesn't solve the problem.

Ronald.



Re: Serialization

2010-10-04 Thread Ronald Klop

What does ddm2 look like? Does it have a reference to the jsp object?

Ronald.


Op maandag, 4 oktober 2010 15:10 schreef Wolfgang Orthuber 
orthu...@kfo-zmk.uni-kiel.de:


 
  Hello,


my tomcat version is 5.5.17, my question concerns serialization of objects, 
below is a code section for writing and reading an object. If I call write 
immediately before read:
d5.write();
d5.read();

then all works fine, but if I use only read (on an formerly written file) with 
the same code included in another program module, I got the exceptions like 
this:
java.lang.ClassCastException: org.apache.jsp.w.w4a_jsp$1ddm2 cannot be cast to 
org.apache.jsp.w.w4b_jsp$1ddm2

in which w4a.jsp and w4b.jsp are two different modules which include the same 
code for read and write. The name of the program module is stored in the 
serialized object, but the name of the program module does not matter, because 
both modules include the same code.

Do you know a simple solution which avoids the exception?

Wolfgang



The code section with read and write:


class dm5t implements Serializable {
 public ArrayListddm2v5;

 public dm5t () {  v5 = new ArrayListddm2 (); }

 public String topicpath(){return 
getServletContext().getRealPath()+/tp/;}

 public synchronized boolean write () {
 String fn=fntopics;
 boolean ok=true;
 try {
 String spath = topicpath();

 FileOutputStreamfs = new FileOutputStream (spath+fn);
 ObjectOutputStreamos = new ObjectOutputStream(fs);
 os.writeObject (v5);
 os.close ();}
 catch (IOException e) {ok=false;} return ok;}

 public synchronized booleanread () {
 String fn=fntopics;
 boolean ok=true;
 ArrayListddm2v5tmp=null;
 try {
 String spath = topicpath();

 FileInputStreamfs = new FileInputStream (spath+fn);
 ObjectInputStreamos = new ObjectInputStream(fs);

 v5tmp = (ArrayListddm2) os.readObject ();
 os.close ();

 } catch (IOException e) {ok=false;}
 catch (ClassNotFoundException e) {ok=false;}
 if (ok)if (v5tmp != null) v5=v5tmp;
 return ok;}
}


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









RE: Tabbed browsers sharing session - work around.

2010-10-04 Thread Ronald Klop

Hi,

Ok. I didn't understand that somebody chooses an environment dynamicly.

The JSESSION cookie is tight to a hostname. So if you make unique hostnames for 
every login you have unique sessions.
For our helpdesk I made a wildcard DNS entry *.example.com IN CNAME 
tomcat.example.com and a button which redirects you to timestamp.example.com, 
so a login goes to something like 1286190607.example.com and the next user will go to 
1286190608.example.com and has its own session.

It is about the same as you do with your virtual context, but you don't have to 
do tricks to org.apache.catalina.connector.Request and it keeps all the safety 
of WEB-INF, etc.

Ronald.


Op maandag, 4 oktober 2010 12:58 schreef Rob Gregory 
rob.greg...@ibsolutions.com:


 
Hi Ronald,


Thanks for the prompt response but I am not sure I fully understand your
suggestion. Would that approach require knowing the available
environments before hand and registering these somehow so that the names
get resolved to the machine. If so this is not really an option as our
application dynamically creates these environments. The application is
not internet facing if that makes a difference.

Regards
Rob

-Original Message-
From: Ronald Klop [mailto:ronald-mailingl...@base.nl] 
Sent: 04 October 2010 11:12

To: Tomcat Users List
Subject: Re: Tabbed browsers sharing session - work around.

You can run your test environment on another hostname.

live.example.com
test.example.com
train.example.com

Maybe use a login.example.com to redirect you to the right url after
login.

Ronald.


Op maandag, 4 oktober 2010 11:03 schreef Rob Gregory
rob.greg...@ibsolutions.com:
 
  
 
 Hi Tomcat community, 
 
  
 
 I'm after advice on some session frigging I have recently bespoke'd

into
 Tomcat (version 6.0.29) to resolve an issue with the recent changes in
 tabbed browsers where they now share the same session across multiple
 browser tabs/instances.
 
  
 
 I have googled the issue and the following post seems to be asking the

 same question, and suggestions come very close to what I have
 implemented:-
 


http://old.nabble.com/Want-to-customise-the-tomcat's-session-logic-td261
 61430.html
 
  
 
 The problem:-
 
 I have a web application that supports multiple environments

(database)
 such as live, test, train, etc. from a single code base/web
application.
 Example scenario is as follows:- 
 
  
 
 * User Bob logs into the application and selects the TEST
 environment and starts entering some data. 
 
 * Bob then opens up another browser or tab and logs into

the
 LIVE environment.
 
 * Behind the scenes the browser has shared the session and

 has in fact switched the first browser from TEST into the LIVE
 environment without Bob being aware.
 
 * Bob  hits save within what he thinks is the TEST

 environment and the LIVE environment is actually updated.
 
  
 
 The solution:-
 
 I have introduced what is basically a sub context into our url's and

 changed the path of the jsession cookie to limit each generated
session
 to the 'virtual' context it was issued within. E.g.
 cookie.setPath(contextPath + / + unique-id); where unique-id is
 just a unique generated number.
 
  
 
 The Implementation:-
 
 I have bespoked the org.apache.catalina.connector.Request class to

 include a unique id as the context to the cookie path and prior to
 creating the session I redirect the user to this context e.g.
 http://localhost/webapp/unique-id/page.jsp. The unique-id is then
 removed by the Request class before returning the path from
 getServletPath() and getRequestURI() so the actual web application is
 unaware of this context switching. 
 
  
 
 The Question:-
 
 While this seems to be working well and the multiple browser

 tabs/instances do indeed have unique sessions I would like to ask if
 anyone can see any potential issues with what I have done or how I
have
 implemented it. I did have one serious issue where I could type in
 http://localhost/webapp/unique-id/WEB-INF/lib/application.jar and it
 bypassed Tomcat built in security and actually downloaded the .jar but
 this was quickly resolved.
 
  
 
 Any input or criticisms would be greatly appreciated if you can see a

 flaw in this design or know of a better approach to bypass this shared
 session behaviour of recent browsers. 
 
  
 
 Many thanks for your time.
 
 Rob Gregory
 
 
 
 
 



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









Re: Tabbed browsers sharing session - work around.

2010-10-04 Thread Ronald Klop

You can run your test environment on another hostname.

live.example.com
test.example.com
train.example.com

Maybe use a login.example.com to redirect you to the right url after login.

Ronald.


Op maandag, 4 oktober 2010 11:03 schreef Rob Gregory 
rob.greg...@ibsolutions.com:


 

Hi Tomcat community, 

 


I'm after advice on some session frigging I have recently bespoke'd into
Tomcat (version 6.0.29) to resolve an issue with the recent changes in
tabbed browsers where they now share the same session across multiple
browser tabs/instances.

 


I have googled the issue and the following post seems to be asking the
same question, and suggestions come very close to what I have
implemented:-

http://old.nabble.com/Want-to-customise-the-tomcat's-session-logic-td261
61430.html

 


The problem:-

I have a web application that supports multiple environments (database)
such as live, test, train, etc. from a single code base/web application.
Example scenario is as follows:- 

 


* User Bob logs into the application and selects the TEST
environment and starts entering some data. 


* Bob then opens up another browser or tab and logs into the
LIVE environment.

* Behind the scenes the browser has shared the session and
has in fact switched the first browser from TEST into the LIVE
environment without Bob being aware.

* Bob  hits save within what he thinks is the TEST
environment and the LIVE environment is actually updated.

 


The solution:-

I have introduced what is basically a sub context into our url's and
changed the path of the jsession cookie to limit each generated session
to the 'virtual' context it was issued within. E.g.
cookie.setPath(contextPath + / + unique-id); where unique-id is
just a unique generated number.

 


The Implementation:-

I have bespoked the org.apache.catalina.connector.Request class to
include a unique id as the context to the cookie path and prior to
creating the session I redirect the user to this context e.g.
http://localhost/webapp/unique-id/page.jsp. The unique-id is then
removed by the Request class before returning the path from
getServletPath() and getRequestURI() so the actual web application is
unaware of this context switching. 

 


The Question:-

While this seems to be working well and the multiple browser
tabs/instances do indeed have unique sessions I would like to ask if
anyone can see any potential issues with what I have done or how I have
implemented it. I did have one serious issue where I could type in
http://localhost/webapp/unique-id/WEB-INF/lib/application.jar and it
bypassed Tomcat built in security and actually downloaded the .jar but
this was quickly resolved.

 


Any input or criticisms would be greatly appreciated if you can see a
flaw in this design or know of a better approach to bypass this shared
session behaviour of recent browsers. 

 


Many thanks for your time.

Rob Gregory









Re: jsp-examples sessions

2010-10-04 Thread Ronald Klop

Do you use /jsp-examples for something?
In production (or on all your systems) remove the jsp-examples context/webapp 
if you don't need it. In fact... remove all webapps which you don't use.

Ronald.


Op maandag, 4 oktober 2010 11:42 schreef rujin raj rujin...@gmail.com:


 




Dear Support,
 
I installed some applications in tomcat 5.5.When i m monitoring through the Lambda probe,I noticed that the /jsp-examples sessions are increased invariably.
 
Please guide me in which circumstances these /jsp-examples sessions will increase and whether it will affect my server performance.
 
Regards,
 
rujinraj




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








RE: Tabbed browsers sharing session - work around.

2010-10-04 Thread Ronald Klop

if (session.environment != newEnvironment) {
   logoutUser(You cannot change a running environment.);
}

Something like that.

Ronald.


Op maandag, 4 oktober 2010 13:27 schreef Rob Gregory 
rob.greg...@ibsolutions.com:


 
Hi Ronald,


Using the hostname doesn't really guarantee a unique session for example
if I click new tab and paste the URL into the new window I suspect the
browser will see the same session from the first tab. In our application
the user can then change the environment with disastrous consequences
when updating the database. Did you implement anything to stop the
session sharing at this level. What I did was to use the window.name
attribute to allow tracking of browser instances and compare this when
doing the session timeout checking and this way I am able to redirect
any further browser opens into new sessions. 


With the exception of WEB-INF (which was due to tomcat no longer seeing
that as a WEB-INF call because I have my unique-id in the path) do you
see any security faults in what I am doing?   


Again thanks for the suggestion and I will look into maybe using the
host over a virtual context as part of the final solution. 


Kind Regards,
Rob

-Original Message-
From: Ronald Klop [mailto:ronald-mailingl...@base.nl] 
Sent: 04 October 2010 12:15

To: Tomcat Users List
Subject: RE: Tabbed browsers sharing session - work around.

Hi,

Ok. I didn't understand that somebody chooses an environment dynamicly.

The JSESSION cookie is tight to a hostname. So if you make unique
hostnames for every login you have unique sessions.
For our helpdesk I made a wildcard DNS entry *.example.com IN CNAME
tomcat.example.com and a button which redirects you to
timestamp.example.com, so a login goes to something like
1286190607.example.com and the next user will go to
1286190608.example.com and has its own session.

It is about the same as you do with your virtual context, but you don't
have to do tricks to org.apache.catalina.connector.Request and it keeps
all the safety of WEB-INF, etc.

Ronald.


Op maandag, 4 oktober 2010 12:58 schreef Rob Gregory
rob.greg...@ibsolutions.com:
 
  
 Hi Ronald,
 
 Thanks for the prompt response but I am not sure I fully understand

your
 suggestion. Would that approach require knowing the available
 environments before hand and registering these somehow so that the
names
 get resolved to the machine. If so this is not really an option as our
 application dynamically creates these environments. The application is
 not internet facing if that makes a difference.
 
 Regards

 Rob
 
 -Original Message-
 From: Ronald Klop [mailto:ronald-mailingl...@base.nl] 
 Sent: 04 October 2010 11:12

 To: Tomcat Users List
 Subject: Re: Tabbed browsers sharing session - work around.
 
 You can run your test environment on another hostname.
 
 live.example.com

 test.example.com
 train.example.com
 
 Maybe use a login.example.com to redirect you to the right url after

 login.
 
 Ronald.
 
 
 Op maandag, 4 oktober 2010 11:03 schreef Rob Gregory

 rob.greg...@ibsolutions.com:
  
   
  
  Hi Tomcat community, 
  
   
  
  I'm after advice on some session frigging I have recently bespoke'd

 into
  Tomcat (version 6.0.29) to resolve an issue with the recent changes
in
  tabbed browsers where they now share the same session across
multiple
  browser tabs/instances.
  
   
  
  I have googled the issue and the following post seems to be asking

the
  same question, and suggestions come very close to what I have
  implemented:-
  
 


http://old.nabble.com/Want-to-customise-the-tomcat's-session-logic-td261
  61430.html
  
   
  
  The problem:-
  
  I have a web application that supports multiple environments

 (database)
  such as live, test, train, etc. from a single code base/web
 application.
  Example scenario is as follows:- 
  
   
  
  * User Bob logs into the application and selects the

TEST
  environment and starts entering some data. 
  
  * Bob then opens up another browser or tab and logs into

 the
  LIVE environment.
  
  * Behind the scenes the browser has shared the session

and
  has in fact switched the first browser from TEST into the LIVE
  environment without Bob being aware.
  
  * Bob  hits save within what he thinks is the TEST

  environment and the LIVE environment is actually updated.
  
   
  
  The solution:-
  
  I have introduced what is basically a sub context into our url's and

  changed the path of the jsession cookie to limit each generated
 session
  to the 'virtual' context it was issued within. E.g.
  cookie.setPath(contextPath + / + unique-id); where unique-id
is
  just a unique generated number.
  
   
  
  The Implementation:-
  
  I have bespoked the org.apache.catalina.connector.Request class to

  include a unique id as the context to the cookie path and prior to
  creating the session I redirect the user to this context e.g.
  http://localhost/webapp/unique-id/page.jsp

Re: Howto: call a Servlet from another Servlet (Example)?!

2010-09-20 Thread Ronald Klop

You can use the RequestDispatcher.

RequestDispatcher dispatcher = request.getRequestDispatcher(/userlist);
dispatcher.forward(request, response);

Google gives you a lot of examples.

Ronald.



Op maandag, 20 september 2010 16:47 schreef Michael Stockhausen 
prof.dr.moe...@googlemail.com:


 


Hello,

I have create two Servlets (LoginServlet  UserListServlet).
I'm using a JSP for the User credentials. When you press the login-button,
the LoginServlet is called.

I would like to call the UserListServlet, when the username and password are
correct.

How can I call UserListServle from the doGet(...) function of the
LoginServlet. I would like to call a Servlet from another servlet.

Where can I find some examples?

Thanks,
Michael








Re: How to spwan child processes.

2010-08-23 Thread Ronald Klop

class OtherAppNotifier implements Runnable {
  public void run() {
  ... doe something...
  }
}

In your servlet:

doGet() {
   processUserRequest();
   new Thread(new OtherAppNotifier()).start();
}

You can also use java.util.TimerTask or some other threadpool thing if this 
spawns too many threads. But try the simple case first to make it working 
before optimizing it.

Ronald.

Op maandag, 23 augustus 2010 16:11 schreef Wesley Acheson 
wesley.ache...@gmail.com:


 
Hi,


As far as I'm aware your not supposed to extend Thread in JEE. I've
seen similar questions on Stack Overflow where it was suggested you
may use your containers Thread pool. This sounds like a terrible idea
for portability.

So take the following example.

1 A request for something specific is made to tomcat. That specific
request needs to two actions.
2 Process the users request.
3 Notify another application over http

Now If the notification fails in step 3 the users request still needs
to process and not to error so we would like to send the notification
as a background task.  This is pretty easy with Threads but we
shouldn't extend Thread according to the specifications.

Questions:
1 Should this be delegated to the container?
2 If it should be delegated to the container how would I/we achieve
this in tomcat 6.
3 If it shouldn't be delegated to the container where should I ask how
to achieve a background task, because it isn't a tomcat question.
(Disclaimer: If you really want to give me the answer I won't mind :P
)

Regards,

Wesley

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









Re: Tuning garbage collection

2010-07-22 Thread Ronald Klop
Op donderdag, 22 juli 2010 14:14 schreef paul womack pwom...@papermule.co.uk: 
 
laredotornado wrote:

 Hi,
 
 I'm using Tomcat 6.0.26, Java 1.6 and wondering what tools/strategies you

 use to tune your garbage collection parameters?

My main strategy is to see if I have any cripping GC problems.

If not, I leave the GC to its own (or Sun's) devices.

GC tuning is likely to be outdated/obseleted
almost as soon as you've done it.

BugBear






Just run jstat -gc on your live server for a while and check the overhead of 
GC. If it is to high add some memory.

Ronald.


Re: Question on ClientAbortException

2010-07-05 Thread Ronald Klop



Op vrijdag, 2 juli 2010 21:49 schreef Leo Donahue - PLANDEVX 
leodona...@mail.maricopa.gov:


 


http://tomcat.apache.org/tomcat-6.0-doc/api/org/apache/catalina/connector/ClientAbortException.html

What does this mean exactly?  A user makes a request for a resource and closes 
the browser before they get the response?

...

Leo Donahue







Or a file download and the user presses cancel in stead of save.

Ronald.



Re: Does GC Really Matter (Is This Situation)?

2010-06-23 Thread Ronald Klop




Op dinsdag, 22 juni 2010 18:33 schreef Robinson, Eric 
eric.robin...@psmnv.com:


 
This is a similar question to one already being discussed in the list

with the subject Setting the Right Amount of Memory.

We have 160 instances of tomcat on the same server, with most instances
configured to use 64-96MB of RAM. We carefully watch the logs for OOMEs.
If we see any, we increase the RAM allocation for that instance by 32MB,
which is enough to make the OOMEs go away.

Some people say this approach will lead to increased CPU utilization
from frequent GC; however, our server runs 90% idle all day long so CPU
is evidently not being driven up by much, if any. 


Given the circumstances, is there anything to be gained from increasing
the heap size? Our software vendor wants us to increase each tomcat
instance to 512MB, just as a matter of policy, but I don't see a good
technical reason to do that. 


Am I missing something?

--
Eric Robinson






You can monitor the gc with jstat.
jstat -gc pid 10s
This wil show you the memory usage of a java instance with the time spent in 
GC. If it does 0.9 sec. of GC every sec. you are running inefficient. :-)

Ronald.




RE: Does GC Really Matter (In This Situation)?

2010-06-23 Thread Ronald Klop




Op woensdag, 23 juni 2010 14:31 schreef Robinson, Eric 
eric.robin...@psmnv.com:


 

 
 You can monitor the gc with jstat.

 jstat -gc pid 10s
 This wil show you the memory usage of a java instance with the time spent in GC. 
 If it does 0.9 sec. of GC every sec. yare running inefficient. :-)


Thanks. I guess I could restate the question as, Does GC inefficiency really matter 
if overall CPU utilization remains low?

--
Eric Robinson







I don't know. Does it matter to you?

If you have a lot of GC your CPU% wil not be very low. GC is CPU bound (if you 
are not swapping).
If your server still has enough CPU power and the users are not complaining 
about the speed, than you don't have a problem.

Ronald.




Re: Tomcat 4.1.30 failed to startup with 4GB memory

2010-05-31 Thread Ronald Klop
Op maandag, 31 mei 2010 17:40 schreef John Mok j...@attglobal.net: 
 
Hi,


I am running Tomcat 4.1.30 on Ubuntu Linux 8.04.4 LTS. After moving the 
application from a 32-bit machine to a 64-bit machine with 4GB memory, suddenly 
tomcat failed to startup with the following error :-

 Stopping service Tomcat-Standalone
 May 29, 2010 4:27:36 PM org.apache.coyote.http11.Http11Protocol destroy
 INFO: Stoping http11 protocol on 8080  Catalina:type=ThreadPool,name=http8080
 Error occurred during initialization of VM
 java.lang.OutOfMemoryError: unable to create new native thread

On the 64-bit machine, I used the following software :-

Ubuntu 8.04.4 LTS for amd64
Sun JDK 1.5.22 (amd64)

export JAVA_HOME=/opt/jdk1.5.0_22
export PATH=$JAVA_HOME/jre/bin:$JAVA_HOME/bin:$PATH
export CLASSPATH=.
export CATALINA_OPTS=-Djava.awt.headless=true -d64 -Xss3072m -Xmx3072m 
-XX:PermSize=256m -XX:MaxPermSize=256m

When I reduced the max memory to 1GB, tomcat started without any problem :-

export CATALINA_OPTS=-Djava.awt.headless=true -d64 -Xss1024m -Xmx1024m 
-XX:PermSize=256m -XX:MaxPermSize=256m







Don't you really want -Xms in stead of -Xss? Setting the stack size to 3 GB is 
quite unusual. Every thread gets a stack of this size, so 10 threads already 
need 30 GB of memory.
# java -X
   -Xmssizeset initial Java heap size
   -Xmxsizeset maximum Java heap size
   -Xsssizeset java thread stack size

Ronald.




clustering errors in 6.0.26 with multiple contexts

2010-05-19 Thread Ronald Klop

Hello,

Since I'm running 6.0.26 I have clustering errors on startup of some contexts. 
I only see this on servers with multiple clustered contexts. I don't know if 
that is related.
In 6.0.24 everything worked ok for months.
Today I caught the stack below on startup after which I get a 60 second timeout 
on sessionreplication. Can this be anything which has changed in 6.0.26?

Ronald.

java.lang.IllegalStateException: setAttribute: Session already invalidated
   at 
org.apache.catalina.session.StandardSession.setAttribute(StandardSession.java:1321)
   at 
org.apache.catalina.ha.session.DeltaSession.setAttribute(DeltaSession.java:597)
   at org.apache.catalina.ha.session.DeltaRequest.execute(DeltaRequest.java:164)
   at 
org.apache.catalina.ha.session.DeltaManager.handleSESSION_DELTA(DeltaManager.java:1403)
   at 
org.apache.catalina.ha.session.DeltaManager.messageReceived(DeltaManager.java:1357)
   at 
org.apache.catalina.ha.session.DeltaManager.messageDataReceived(DeltaManager.java:1093)
   at 
org.apache.catalina.ha.session.ClusterSessionListener.messageReceived(ClusterSessionListener.java:87)
   at 
org.apache.catalina.ha.tcp.SimpleTcpCluster.messageReceived(SimpleTcpCluster.java:901)
   at 
org.apache.catalina.ha.tcp.SimpleTcpCluster.messageReceived(SimpleTcpCluster.java:882)
   at 
org.apache.catalina.tribes.group.GroupChannel.messageReceived(GroupChannel.java:269)
   at 
org.apache.catalina.tribes.group.ChannelInterceptorBase.messageReceived(ChannelInterceptorBase.java:79)
   at 
org.apache.catalina.tribes.group.ChannelInterceptorBase.messageReceived(ChannelInterceptorBase.java:79)
   at 
org.apache.catalina.tribes.group.interceptors.TcpFailureDetector.messageReceived(TcpFailureDetector.java:110)
   at 
org.apache.catalina.tribes.group.ChannelInterceptorBase.messageReceived(ChannelInterceptorBase.java:79)
   at 
org.apache.catalina.tribes.group.ChannelCoordinator.messageReceived(ChannelCoordinator.java:241)
   at 
org.apache.catalina.tribes.transport.ReceiverBase.messageDataReceived(ReceiverBase.java:225)
   at 
org.apache.catalina.tribes.transport.nio.NioReplicationTask.drainChannel(NioReplicationTask.java:188)
   at 
org.apache.catalina.tribes.transport.nio.NioReplicationTask.run(NioReplicationTask.java:91)
   at 
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
   at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
   at java.lang.Thread.run(Thread.java:619)



Re: Tomcat classpath fpr jar-within-jar

2010-04-27 Thread Ronald Klop




Op maandag, 26 april 2010 19:00 schreef Christopher Schultz 
ch...@christopherschultz.net:


 
-BEGIN PGP SIGNED MESSAGE-

Hash: SHA1

Ronald,

On 4/26/2010 8:53 AM, Ronald Klop wrote:
 That is not possible in Java (not only in Tomcat, but not possible in
 any java application). You must extract jar B from jar A and put both on
 the classpath.
 
 But it would be a nice feature and you can probably vote for an issue

 about it in the bug database of Sun/Oracle.

Really? I would think that a custom ClassLoader would allow this behavior.

To answer the OPs question: there's no way to do this without at least
writing some of your own code (such as a ClassLoader).





Yep. You are right. It is possible, just not out of the box.



Re: Tomcat classpath fpr jar-within-jar

2010-04-26 Thread Ronald Klop

That is not possible in Java (not only in Tomcat, but not possible in any java 
application). You must extract jar B from jar A and put both on the classpath.

But it would be a nice feature and you can probably vote for an issue about it 
in the bug database of Sun/Oracle.

Ronald.


Op maandag, 26 april 2010 14:05 schreef Adam Lipscombe 
adam.lipsco...@googlemail.com:


 
Folks,



Firstly, apologies if this question is a no-brainer.


I have a war file containing a jar file (jar A) in the WEB-INF/lib directory. 
Jar A contains another another jar file (jar B).
The structure of Jar A is class files under com/... and jar B.


Classes inside jar B do not seem to be accessible to code in the application. Tomcat 
throws a SEVERE: Servlet /ExpenSysWT threw load() exception 
javax.servlet.UnavailableException: ... 

How do I arrange it so that code in my application  can see classes in jar B?


TIA - Adam
--
Adam Lipscombe
E: adam.lipsco...@gmail.com
Skype: adam_lipscombe


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








Re: getServerName returns 'localhost'

2010-03-03 Thread Ronald Klop

Did you do something like this in server.xml?

Engine defaultHost=localhost
  Host name=localhost /
/Engine

And your client goes to www.example.com, but you getServerName() returns localhost in 
stead of www.example.com?

Ronald.

Op woensdag, 3 maart 2010 14:19 schreef vgud ivan.gudi...@yahoo.com:


 


Users use tomcat directly.

My server responds to different domain names, and I want to know which one
users use. I try to get domain name by request.getServerName() but instead
of domainName.com I get 'localhost'.


awarnier wrote:
 
 vgud wrote:

 Gentlemen,
 
 I have the application which could be accessed from different domain

 addresses and I need to know from what domain request was sent. I try to
 get
 following from request:
 
 getRemoteHost: 127.0.0.1

 getServerName: localhost
 
 I use tomcat 5.5 and I suppose i should configure something to get

 correct
 domain name. Can anyone help me?? Any help will be apreciated.
 
 Are users accessing Tomcat directly ? or through an Apache front-end for 
 example ?
 
 Also, your question above is not very clear.  Can you revisit your usage 
 of from above, and rephrase what you are trying to get exactly ?
 Do you mean that your server responds to different domain names, and you 
 want to know which one users use ?
 Or do you want to know from which (user-side) IP address they are 
 accesing your server ?
 
 
 -

 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/getServerName-returns-%27localhost%27-tp27767838p27768081.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: 6.0.19 feature to not swallow input if the connection is going to be closed

2010-01-15 Thread Ronald Klop

Hello,

I think this is an interesting question. I wonder why there is no answer.

Ronald.


Op vrijdag, 8 januari 2010 17:20 schreef Lock Ian IC ian.l...@uk.fujitsu.com:


 


Hi

 


There was a feature introduced in 6.0.19 to not swallow the inputStream
if the servlet throws an exception and the connection is going to be
closed.

Without this, Tomcat drains the inputStream, so for example If you're
uploading a large file it ties up the thread until input is drained -
which could be ages.

 


I've not been able to get this feature working.  My servlet sets the
response status to SC_REQUEST_ENTITY_TOO_LARGE which Tomcat recognises
it should drop the connection for, but the Http11Processor.java code
doesn't set the error flag which controls whether or not the inputStream
is swallowed.

 


The Http11Processor.java line of code in question in the 6.0.20 code set
is 855.  This line checks the value of keepAlive is true before setting
the error flag which controls whether or not input is swallowed.
keepAlive has previously been set to false by line 1590 so the error
flag is not set.

 


Am I missing something here? Is there a specific way for the servlet to
invoke this functionality?

 


Thanks very much

 


Ian

 










Re: Tips on tracking down memory leaks

2010-01-13 Thread Ronald Klop

No. But historical results are not a guarantee for the future.

It is very easy to make a heapdump with jmap and analyze it with MAT 
(http://www.eclipse.org/mat/) or other tools as suggested by others on this 
list.

Ronald.


Op woensdag, 13 januari 2010 11:44 schreef Greg McCane gregmcc...@yahoo.ca:


 


Thanks Chuck.

Is there any danger in taking a heap dump on our system running in production? 
Will it cause a significant performance hit or other nasty?

Thanks again,
Greg





From: Caldarale, Charles R chuck.caldar...@unisys.com
To: Tomcat Users List users@tomcat.apache.org
Sent: Tue, January 12, 2010 11:31:16 PM
Subject: RE: Tips on tracking down memory leaks

 From: Greg McCane [mailto:gregmcc...@yahoo.ca]
 Subject: Tips on tracking down memory leaks
 
 The memory growth appears to be in large chunks rather 
 than slow, steady growth.


Use a heap profiler to find out what's eating up the space and who is 
allocating it.  Even the simple one (hprof) included in the 1.5 JDK will tell 
you that.  Better ones (e.g., jhat) are available in 1.6, if you're willing to 
move up.  There are also numerous 3rd-party profilers available, with YourKit 
being a favorite of many.

- 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


  __
The new Internet Explorer® 8 - Faster, safer, easier.  Optimized for Yahoo!  
Get it Now for Free! at http://downloads.yahoo.com/ca/internetexplorer/








Re: Ignore http header if-modified-since

2009-12-16 Thread Ronald Klop
If it is 304 and not 404. You can implement the lastModified method on  
your Servlet and always return 0 or -1 (see the javadocs).


Ronald.

On Wed, 16 Dec 2009 15:47:33 +0100, Looijmans, Mike  
mike.looijm...@oce.com wrote:



I assume you mean 304 (Not modified) instead of 404 (Not found).

Simplest I can think of is to NOT put the last-modified header in your
response. Then the browser
won't send you an if-modified-since back.

On the other hand, if you can put a datestamp on the response - e.g. a
file date or by reading it from a DB or so - provide the proper response
and you get client-side caching for (almost) free, which can seriously
reduce load on a server.

M.


-Original Message-
From: Abid Hussain [mailto:abid.huss...@dilax.com]
Sent: woensdag 16 december 2009 14:11
To: users
Subject: Ignore http header if-modified-since

Hallo,

when processing ajax-requests Tomcat sometimes responds with
a 404 instead of delivering XML.

This seems to happen when the http header if-modified-since
in the request doesn't somehow contain the right value. At
least, if the request doesn't contain this header, tomcat
responds correctly.

Is it possible to instruct tomcat to simply ignore this
header so that the correct response will be delivered,
whatever is contained in this header?

Best regards,

Abid


(EOF)

This message and attachment(s) are intended solely for use by the  
addressee and may contain information that is privileged, confidential  
or otherwise exempt from disclosure under applicable law.


If you are not the intended recipient or agent thereof responsible for  
delivering this message to the intended recipient, you are hereby  
notified that any dissemination, distribution or copying of this  
communication is strictly prohibited.


If you have received this communication in error, please notify the  
sender immediately by telephone and with a 'reply' message.


Thank you for your co-operation.



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




--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/

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



Re: ArrayIndexOutOfBoundsException

2009-11-25 Thread Ronald Klop

You can compile Tomcat yourself and insert some debug statements at the 
location of the exception.

Ronald.


Op dinsdag, 24 november 2009 18:17 schreef geoff...@fileflow.com:


 


The bytesRead returns the size of the buffer (8KB) every time. I also debug and 
I can't find anything wrong. Input and OutputStream are not null, bytesRead is 
the correct size and the buffer is also filled.

Any other ideas?


Best Regards

Geoffrey



On 24 Nov 2009, at 18:13, Ronald Klop wrote:

 Try insert some debug statements just before the out.write.
 System.out.println(bytesRead:  + bytesRead) would be interesting.
 
 In fact this is kind of my-first-debugging and you don't even mention you did try it.
 
 Ronald.
 
 
 Op dinsdag, 24 november 2009 17:57 schreef geoff...@fileflow.com:

 Hi everyone.
 I'm stuck with a problem I don't understand. We have a tomcat server and 
after redeploying our war file, we get this error:
 java.lang.ArrayIndexOutOfBoundsException
 at org.apache.tomcat.util.buf.ByteChunk.append(ByteChunk.java:346)
 at 
org.apache.coyote.http11.InternalOutputBuffer$OutputStreamOutputBuffer.doWrite(InternalOutputBuffer.java:764)
 at 
org.apache.coyote.http11.filters.IdentityOutputFilter.doWrite(IdentityOutputFilter.java:118)
 at 
org.apache.coyote.http11.InternalOutputBuffer.doWrite(InternalOutputBuffer.java:573)
 at org.apache.coyote.Response.doWrite(Response.java:560)
 at 
org.apache.catalina.connector.OutputBuffer.realWriteBytes(OutputBuffer.java:353)
 at org.apache.tomcat.util.buf.ByteChunk.append(ByteChunk.java:325)
 at 
org.apache.catalina.connector.OutputBuffer.writeBytes(OutputBuffer.java:381)
 at org.apache.catalina.connector.OutputBuffer.write(OutputBuffer.java:370)
 at 
org.apache.catalina.connector.CoyoteOutputStream.write(CoyoteOutputStream.java:89)
 at com.fileflow.downloader.Downloader.doGet(Downloader.java:123)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
 at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
 at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
 at 
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
 at 
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
 at 
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
 at 
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
 at 
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
 at 
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
 at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:849)
 at 
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
 at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:454)
 at java.lang.Thread.run(Thread.java:619)
 Notice that there are no number on the first line and it is usually the case.
 The code that is responsible is:
 private ServletOutputStream out;
 private InputStream in;
 ...
 in = new FileInputStream(tmp);
 ...
 out = response.getOutputStream();
 byte[] buf = new byte[8 * 1024]; // 8K buffer
 int bytesRead;
 while((bytesRead = in.read(buf))  0) {
 out.write(buf, 0, bytesRead);
 }
 The updated code didn't change anything in that Servlet so I really have no 
clue what happened. It happens on tomcat 6.0.18 and 6.0.20. Java is 1.6.0_11.
 Thanks for any help.
 Best Regards
 Geoffrey
 












Re: Tomcat Https loadbalancing??

2009-11-25 Thread Ronald Klop

Always make a drawing.

client - https - tcp-loadbalancer - still same https connection- multiple 
tomcats

client - https - http-loadbalancer (Apache, proxy) - new ajp/http(s) 
connection- multiple tomcats

Normally the loadbalancer and tomcats are in the same private network. It is 
your choice if that is secure enough. In the end the data is unencrypted in the 
database I guess, so normally you trust your own network.

Ronald.


Op woensdag, 25 november 2009 10:18 schreef jkv j.kumara...@gmail.com:


 


Hello,

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? 


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? 


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

I searched the forums and they are too advanced for my question. I am really
new to clustering and load balancing and any help is deeply appreciated.
Thanks in advance.

Regards
jkv
--
View this message in context: 
http://old.nabble.com/Tomcat-Https-loadbalancing---tp26509573p26509573.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: [ANN] Apache Tomcat Native 1.1.18 released

2009-11-24 Thread Ronald Klop

This changelog link works better.

http://tomcat.apache.org/native-doc/miscellaneous/changelog-1.1.x.html

Cheers,

Ronald.


Op maandag, 23 november 2009 21:59 schreef jean-frederic clere 
jfcl...@gmail.com:


 
The Apache Tomcat team announces the immediate availability of Apache Tomcat Native 1.1.18 stable. This release includes few bug fixes over Apache Tomcat Native 1.1.16 and fixes the client initiated part of cve-2009-3555, note that the server initiated renegociation was added in 1.1.17 (and is still in the 1.1.18 code).


Please refer to the change log for the list of changes: 
http://tomcat.apache.org/native-doc/miscellaneous/changelog.html

Downloads: http://tomcat.apache.org/download-native.cgi

Thank you,

-- The Apache Tomcat Team

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








Re: ArrayIndexOutOfBoundsException

2009-11-24 Thread Ronald Klop

Try insert some debug statements just before the out.write.
System.out.println(bytesRead:  + bytesRead) would be interesting.

In fact this is kind of my-first-debugging and you don't even mention you did 
try it.

Ronald.


Op dinsdag, 24 november 2009 17:57 schreef geoff...@fileflow.com:


 




Hi everyone.
 
I'm stuck with a problem I don't understand. We have a tomcat server and after redeploying our war file, we get this error:
 
java.lang.ArrayIndexOutOfBoundsException

at org.apache.tomcat.util.buf.ByteChunk.append(ByteChunk.java:346)
at 
org.apache.coyote.http11.InternalOutputBuffer$OutputStreamOutputBuffer.doWrite(InternalOutputBuffer.java:764)
at 
org.apache.coyote.http11.filters.IdentityOutputFilter.doWrite(IdentityOutputFilter.java:118)
at 
org.apache.coyote.http11.InternalOutputBuffer.doWrite(InternalOutputBuffer.java:573)
at org.apache.coyote.Response.doWrite(Response.java:560)
at 
org.apache.catalina.connector.OutputBuffer.realWriteBytes(OutputBuffer.java:353)
at org.apache.tomcat.util.buf.ByteChunk.append(ByteChunk.java:325)
at org.apache.catalina.connector.OutputBuffer.writeBytes(OutputBuffer.java:381)
at org.apache.catalina.connector.OutputBuffer.write(OutputBuffer.java:370)
at 
org.apache.catalina.connector.CoyoteOutputStream.write(CoyoteOutputStream.java:89)
at com.fileflow.downloader.Downloader.doGet(Downloader.java:123)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at 
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at 
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at 
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:849)
at 
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:454)
at java.lang.Thread.run(Thread.java:619)
 
Notice that there are no number on the first line and it is usually the case.

The code that is responsible is:


private ServletOutputStream out;
private InputStream in;
...
in = new FileInputStream(tmp);
...
out = response.getOutputStream();
byte[] buf = new byte[8 * 1024]; // 8K buffer
int bytesRead;
while((bytesRead = in.read(buf))  0) {
out.write(buf, 0, bytesRead);
}
 
The updated code didn't change anything in that Servlet so I really have no clue what happened. It happens on tomcat 6.0.18 and 6.0.20. Java is 1.6.0_11.
 
Thanks for any help.


Best Regards
 
Geoffrey










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

2009-11-20 Thread Ronald Klop
On Fri, 20 Nov 2009 07:13:44 +0100, Karthik Nanjangude  
karthik.nanjang...@xius-bcgi.com wrote:



Hi

This is not Fun dude...

I know how to write a SOCKET Programming for Standalone,

How do I write a socket Listener for WEB Application running over  
TOMCAT  when the application is up and running.?


Please be serious...I asked for some help or ideas  :(


Tomcat is a Servlet engine. You can use Tomcat to write/run Servlets.

What is your setup?

client -A- tomcat -B- 3rd party app?

'A' is handled by a servlet?
And you have to write 'B'?

Can you provide more information?

Ronald.




With regards
KArthik

-Original Message-
From: Ronald Klop [mailto:ronald-mailingl...@base.nl]
Sent: Thursday, November 19, 2009 9:06 PM
To: Tomcat Users List
Subject: Re: Howto Socket (TCP / IP ) reading from a war application on  
Tomcat


On Thu, 19 Nov 2009 14:59:16 +0100, Karthik Nanjangude
karthik.nanjang...@xius-bcgi.com wrote:


Hi

Can some body  provide me a sample code for  Socket  (TCP / IP )
reading  from a war application on Tomcat

Can Listeners be made use of for the same?

Reason:  I need to   Accept / Reply  a XML File over the socket port
from 3rd party application (as Client )
 Also the  Soap (Approached was not recommended for
this  existing application )



With regards
Karthik


See here for some examples:
http://tinyurl.com/ylq2zlj



--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/

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



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

2009-11-20 Thread Ronald Klop
On Fri, 20 Nov 2009 13:20:04 +0100, Karthik Nanjangude  
karthik.nanjang...@xius-bcgi.com wrote:



Hi


You mentioned XML - use some existing library that works with XML.


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




You are not having a problem with a Tomcat installation.


TOMCAT 6.0.2.0
JDK 1.6.0
O/s  Linux / Unix / Windows



Why are you determined to use a Socket?

Soap over HTTP (Approached was not recommended by the existing client s/w



You are not stating what you've tried.
With a Load on Startup servlet tried to listen to the socket,which does  
not work


What went wrong? There is no reason why such a thing should not work. Just  
instantiate a static class/Thread which listens on a port. I don't  
understand your problem. It is the same as a standalone program except you  
are starting your class differently.


Ronald.







People get paid to write code and solve this type of problem
I have been using this form since 2000 (almost 10 years) and have giving  
solutions /ideas to not so smart guys like me

This form was created for the same cause, I presume not to make money :(




With regards
Karthik

-Original Message-
From: Pid [mailto:p...@pidster.com]
Sent: Friday, November 20, 2009 3:34 PM
To: users@tomcat.apache.org
Subject: Re: Howto Socket (TCP / IP ) reading from a war application on  
Tomcat


On 20/11/2009 06:13, Karthik Nanjangude wrote:

Hi

This is not Fun dude...

I know how to write a SOCKET Programming for Standalone,

How do I write a socket Listener for WEB Application running over  
TOMCAT  when the application is up and running.?


Please be serious...I asked for some help or ideas  :(


You mentioned XML - use some existing library that works with XML.

Why are you determined to use a Socket?  You're making an HTTP
connection, if you must do it the hard way, use an appropriate class,
e.g. HttpURLConnection.

  http://lmgtfy.com/?q=java+Socket
  http://lmgtfy.com/?q=java+HttpURLConnection


You're not asking questions that anyone here is likely to want to help
you with because:

1. You are not having a problem with a Tomcat installation.
2. You are not being specific about what the real issue is.
3. You are not stating what you've tried.
4. People get paid to write code and solve this type of problem.


You've posted on this list before and received help, no?
You've read this before, yes?

  http://catb.org/~esr/faqs/smart-questions.html



p




With regards
KArthik

-Original Message-
From: Ronald Klop [mailto:ronald-mailingl...@base.nl]
Sent: Thursday, November 19, 2009 9:06 PM
To: Tomcat Users List
Subject: Re: Howto Socket (TCP / IP ) reading from a war application on  
Tomcat


On Thu, 19 Nov 2009 14:59:16 +0100, Karthik Nanjangude
karthik.nanjang...@xius-bcgi.com  wrote:


Hi

Can some body  provide me a sample code for  Socket  (TCP / IP )
reading  from a war application on Tomcat

Can Listeners be made use of for the same?

Reason:  I need to   Accept / Reply  a XML File over the socket port
from 3rd party application (as Client )
  Also the  Soap (Approached was not recommended for
this  existing application )



With regards
Karthik


See here for some examples:
http://tinyurl.com/ylq2zlj

--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/

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


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




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


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




--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/

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



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

2009-11-20 Thread Ronald Klop

On Fri, 20 Nov 2009 14:22:57 +0100, André Warnier a...@ice-sa.com wrote:


Ronald Klop wrote:
On Fri, 20 Nov 2009 13:20:04 +0100, Karthik Nanjangude  
karthik.nanjang...@xius-bcgi.com wrote:



Hi


You mentioned XML - use some existing library that works with XML.


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




You are not having a problem with a Tomcat installation.


TOMCAT 6.0.2.0
JDK 1.6.0
O/s  Linux / Unix / Windows



Why are you determined to use a Socket?
Soap over HTTP (Approached was not recommended by the existing client  
s/w




You are not stating what you've tried.
With a Load on Startup servlet tried to listen to the socket,which  
does not work
 What went wrong? There is no reason why such a thing should not work.  
Just instantiate a static class/Thread which listens on a port. I don't  
understand your problem. It is the same as a standalone program except  
you are starting your class differently.



Just jumping in here for a minute..
Isn't there some fundamental logical problem here ?
Unless I am mistaken, we are talking about a webapp running under  
Tomcat.  This webapp is being run when there is a request (in principle,  
a HTTP request) received by Tomcat, whose URL matches one that the  
webapp is mapped to.
Now if that webapp gets started, somehow, and even if it starts  
listening on a socket (separate from the Tomcat Connector listening  
sockets), isn't that socket not going to be listening anymore when that  
webapp, somehow, stops running ?
I fail to see the inherent logic in running something like this under  
Tomcat.  I mean, even if somehow it works, what is the benefit of  
running this under a servlet engine ?

Should this not be instead a stand-alone application ?



That is something everybody except the OP is wondering about. :-)

Ronald.

--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/

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



Re: 64bit Tomcat for Windows

2009-11-19 Thread Ronald Klop
On Thu, 19 Nov 2009 13:30:19 +0100, Bruce Foster gis.fos...@gmail.com  
wrote:



Hi List,

I have another thread running and someone suggested to use 64bit JDK
on my Windows 2003 server 64 bit.

Wonder, if there is a 64 bit installer for Tomcat on Windows. I see my
current tomcat is running x86 folder in 32 bit mode.




Tomcat isn't 64 or 32 bits. Tomcat just uses the JVM it is running on.

Ronald.

--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/

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



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

2009-11-19 Thread Ronald Klop
On Thu, 19 Nov 2009 14:59:16 +0100, Karthik Nanjangude  
karthik.nanjang...@xius-bcgi.com wrote:



Hi

Can some body  provide me a sample code for  Socket  (TCP / IP )  
reading  from a war application on Tomcat


Can Listeners be made use of for the same?

Reason:  I need to   Accept / Reply  a XML File over the socket port  
from 3rd party application (as Client )
 Also the  Soap (Approached was not recommended for  
this  existing application )




With regards
Karthik


See here for some examples:
http://tinyurl.com/ylq2zlj

--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/

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



RE: MISC; Tomcat-5.5.12; After one Tomcat Cluster node shutdown, sessionDestroyed been called before contextDestroyed

2009-11-17 Thread Ronald Klop

Hi Imad,

I think also that Tomcat should only invalidate the Session on shutdown if it 
is the last node in the cluster.
But the developers of Tomcat think of it as invalidating the Session object (as 
in java Object) and you and me see it as invalidating the session of the user.

Ronald. (The Ronald of the link mentioned by Pid.)


Op dinsdag, 17 november 2009 14:36 schreef Imad Hachem 
hachem_i...@hotmail.com:


 



Dear Pid,

 


I am running a Logout Process at each sessionDestroy.

 


After applying the Cluster configuration,  I don't want to Logout my Users (or 
run this Logout Process) after any Tomcat Cluster node shutdown, since the 
Session has been replicated to the other Node Cluster.

 




Best Regards,
Imad Hachem 

System Engineer 




 
 From: p...@pidster.com

 Date: Tue, 17 Nov 2009 13:09:47 +
 Subject: Re: MISC; Tomcat-5.5.12; After one Tomcat Cluster node shutdown, 
sessionDestroyed been called before contextDestroyed
 To: users@tomcat.apache.org
 
 On 17 Nov 2009, at 12:11, Imad Hachem hachem_i...@hotmail.com wrote:
 
 

  Dear Pid,
 
 
 
  I have tried that code and didn't helped, note that my context 
  session variables are not coming as null in order to rely on to be
  able to differenciate between Tomcat Node shutdown 
  session.invalidate().
 
 I'm sorry but I don't understand what you're saying here.
 
 Tomcat  the servlet api can't tell you the difference between an app

 shutdown and a session expiry without you writing code.
 
 What did you try?
 
 What was or wasn't null exactly?
 
 p
 
 
  Best Regards,

  Imad Hachem
 
  System Engineer
 
 
 
 
  Date: Tue, 17 Nov 2009 11:41:20 +
  From: p...@pidster.com
  To: users@tomcat.apache.org
  Subject: Re: MISC; Tomcat-5.5.12; After one Tomcat Cluster node
  shutdown, sessionDestroyed been called before contextDestroyed
 
  On 17/11/2009 11:31, Imad Hachem wrote:
 
  Dear Pid,
 
  Thanks for your reply.
 
  But can you specify exactly which Servlets API method to use?
 
  The link I sent had some code in it, did you read it?
 
  Note that Tomat-5.5.12 is deployed on Production environment and
  we are not facing major issues.
 
  But you might be facing some security ones.
 
  I will appreciate if you can adivse to which Tomcat Stable version
  we should Migrate taking in consideration that Tomcat Cluster is
  used in our environment as well.
 
  The latest: Tomcat 5.5.28. Same app, many bugfixes. Your version was
  released September 2005, over 4 years ago (that's 28 internet years).
 
  It's not good practice to avoid upgrading for that long.
 
 
  p
 
 
 
 
 
 
 
 
  Best Regards,
  Imad Hachem
 
  System Engineer
 
 
 
 
  Date: Tue, 17 Nov 2009 10:15:58 +
  From: p...@pidster.com
  To: users@tomcat.apache.org
  Subject: Re: MISC; Tomcat-5.5.12; After one Tomcat Cluster node
  shutdown, sessionDestroyed been called before contextDestroyed
 
  On 17/11/2009 04:14, Imad Hachem wrote:
 
  Dear all,
 
  I am using Tomcat-5.5.12 as Clustering nodes, and after one node
  shutdown sessionDestroyed is called before contextDestroyed.
 
  Are you still using 5.5.12? Hasn't anyone advised you to upgrade
  to a
  newer version yet?
 
  I think it's perfectly reasonably to call sessionDestroyed() before
  contextDestroyed().
 
  How can I know if sessionDestroyed is called from
  session.invalidate()
  from the real expiration of the session or shutdown of one
  cluster node?
 
  You can't know this directly from the Servlet API methods.
 
  Note that on sessionDestroyed event, I am using a Logout
  behavior to
  logout my users from the DATABASE.
 
  I have tried to set a KEY on the context (or application scope)
  to check
  on it during the sessionDestroyed event, but it seems the
  context is
  destroyed after the session destroy event.
 
  This comes up not infrequently on the list, the archives have more
  information:
 
  
http://old.nabble.com/Re%3A-sessionListener.sessionDestroyed-is-called-on-shutdown-of-a-node-in-the-cluster-p16746969.html
 
  Is there any event listener that I can use before the
  sessionDestroyed to differentiate if one cluster node has been
  shutdown or my session has been expired?
 
  Or is how to configure the contextDestroy to be called before
  the sessions destroy?
 
  No, contextDestroyed() means that the web application itself has
  been
  stopped, this is mandated by the Servlet Spec.
 
 
  p
 
 
  Thanks in advance for your help.
 
  Best Regards,
  Imad Hachem
 
  System Engineer
 
 
 
  _
  Windows Live: Make it easier for your friends to see what yo
  u锟斤拷re up to on Facebook.
  
http://www.microsoft.com/middleeast/windows/windowslive/see-it-in-action/social-network-basics.aspx?ocid=PID23461::T:WLMTAGL:ON:WL:en-xm:SI_SB_2:092009
 
 
  ---
  --
  To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
  For additional commands, e-mail: 

RE: MISC; Tomcat-5.5.12; After one Tomcat Cluster node shutdown, sessionDestroyed been called before contextDestroyed

2009-11-17 Thread Ronald Klop

Hi Imad,

You can do everything you like, but it will all be dirty.
1. Set a global variable in your webapp before shutdown of a node. To see If it 
is a planned shutdown or not.
2. Keep references about the nr. of clusternodes yourself. Can be done quite 
cleanly with JMX.
3. Do not really logout the user. Only mark a logout time. If another node 
shuts down or the user really logs out it will overwrite the logout time. And 
in the end the data is quite correct. (This is what I do.)

Everything as pros and cons. Be creative. (I would like to here what works for 
you.)


But the developers of Tomcat think of it as invalidating the Session object (as 
in java Object) and you and me see it as invalidating the session of the user.


This phrase was not very accurate. I meant destroy in stead of invalidating. 
Because those are different things.

Ronald.


Op dinsdag, 17 november 2009 16:23 schreef Imad Hachem 
hachem_i...@hotmail.com:


 



Hi Ronald,

 


Thanks for your reply.

 


So, what 's the solution in my Case?

 


I need to differentiate between Tomat Cluster node shutdown and 
session.invalidate and session Timout?

 


Is that Possible as configuration or Programming ?

 

 




Best Regards,
Imad Hachem 

System Engineer 




 
 Date: Tue, 17 Nov 2009 15:40:30 +0100

 From: ronald-mailingl...@base.nl
 To: users@tomcat.apache.org
 Subject: RE: MISC; Tomcat-5.5.12; After one Tomcat Cluster node shutdown, 
sessionDestroyed been called before contextDestroyed
 
 Hi Imad,
 
 I think also that Tomcat should only invalidate the Session on shutdown if it is the last node in the cluster.

 But the developers of Tomcat think of it as invalidating the Session object 
(as in java Object) and you and me see it as invalidating the session of the user.
 
 Ronald. (The Ronald of the link mentioned by Pid.)
 
 
 Op dinsdag, 17 november 2009 14:36 schreef Imad Hachem hachem_i...@hotmail.com:
  
  
  
  
  Dear Pid,
  
  
  
  I am running a Logout Process at each sessionDestroy.
  
  
  
  After applying the Cluster configuration, I don't want to Logout my Users (or run this Logout Process) after any Tomcat Cluster node shutdown, since the Session has been replicated to the other Node Cluster.
  
  
  
  
  
  Best Regards,
  Imad Hachem 
  
  System Engineer 
  
  
  
  
   From: p...@pidster.com

   Date: Tue, 17 Nov 2009 13:09:47 +
   Subject: Re: MISC; Tomcat-5.5.12; After one Tomcat Cluster node shutdown, 
sessionDestroyed been called before contextDestroyed
   To: users@tomcat.apache.org
   
   On 17 Nov 2009, at 12:11, Imad Hachem hachem_i...@hotmail.com wrote:
   
   

Dear Pid,
   
   
   
I have tried that code and didn't helped, note that my context 
session variables are not coming as null in order to rely on to be
able to differenciate between Tomcat Node shutdown 
session.invalidate().
   
   I'm sorry but I don't understand what you're saying here.
   
   Tomcat  the servlet api can't tell you the difference between an app

   shutdown and a session expiry without you writing code.
   
   What did you try?
   
   What was or wasn't null exactly?
   
   p
   
   
Best Regards,

Imad Hachem
   
System Engineer
   
   
   
   
Date: Tue, 17 Nov 2009 11:41:20 +
From: p...@pidster.com
To: users@tomcat.apache.org
Subject: Re: MISC; Tomcat-5.5.12; After one Tomcat Cluster node
shutdown, sessionDestroyed been called before contextDestroyed
   
On 17/11/2009 11:31, Imad Hachem wrote:
   
Dear Pid,
   
Thanks for your reply.
   
But can you specify exactly which Servlets API method to use?
   
The link I sent had some code in it, did you read it?
   
Note that Tomat-5.5.12 is deployed on Production environment and
we are not facing major issues.
   
But you might be facing some security ones.
   
I will appreciate if you can adivse to which Tomcat Stable version
we should Migrate taking in consideration that Tomcat Cluster is
used in our environment as well.
   
The latest: Tomcat 5.5.28. Same app, many bugfixes. Your version was
released September 2005, over 4 years ago (that's 28 internet years).
   
It's not good practice to avoid upgrading for that long.
   
   
p
   
   
   
   
   
   
   
   
Best Regards,
Imad Hachem
   
System Engineer
   
   
   
   
Date: Tue, 17 Nov 2009 10:15:58 +
From: p...@pidster.com
To: users@tomcat.apache.org
Subject: Re: MISC; Tomcat-5.5.12; After one Tomcat Cluster node
shutdown, sessionDestroyed been called before contextDestroyed
   
On 17/11/2009 04:14, Imad Hachem wrote:
   
Dear all,
   
I am using Tomcat-5.5.12 as Clustering nodes, and after one node
shutdown sessionDestroyed is called before contextDestroyed.
   
Are you still using 5.5.12? Hasn't anyone advised you to upgrade
to a
newer version yet?
   
I think it's perfectly reasonably to call sessionDestroyed() before

Re: MISC; Tomcat-5.5.12; After one Tomcat Cluster node shutdown, sessionDestroyed been called before contextDestroyed

2009-11-17 Thread Ronald Klop

@P
I didn't want to pollute my deployment process with this manual stuff. So I 
'solved' it different for our setup. I do not log users out on sessionDestroy. 
I only record that they are logged out. Which is overwritten by later logout 
events. So in the end the data is pretty ok. Not very nice, but nice enough for 
me.

Ronald.


Op dinsdag, 17 november 2009 16:38 schreef Pid p...@pidster.com:


 
On 17/11/2009 14:40, Ronald Klop wrote:

 Hi Imad,
 
 Ronald. (The Ronald of the link mentioned by Pid.)

Did the code supplied therein, work for you Ronald?


@Imad

The Servlet Spec (and therefore Tomcat) doesn't differentiate between causes of 
session expiry.

The code requires you to set a value in the application scope, then the 
HttpSessionListener sessionDestroyed method checks for that value.

If the value is present, you initiated shutdown.  If it is not, then it's 
probably a session expiry and you run your logout code.

Did you actually set such an attribute?


p


 Op dinsdag, 17 november 2009 14:36 schreef Imad Hachem
 hachem_i...@hotmail.com:




 Dear Pid,



 I am running a Logout Process at each sessionDestroy.



 After applying the Cluster configuration, I don't want to Logout my
 Users (or run this Logout Process) after any Tomcat Cluster node
 shutdown, since the Session has been replicated to the other Node
 Cluster.





 Best Regards,
 Imad Hachem
 System Engineer



  From: p...@pidster.com
  Date: Tue, 17 Nov 2009 13:09:47 +
  Subject: Re: MISC; Tomcat-5.5.12; After one Tomcat Cluster node
 shutdown, sessionDestroyed been called before contextDestroyed
  To: users@tomcat.apache.org
   On 17 Nov 2009, at 12:11, Imad Hachem hachem_i...@hotmail.com
 wrote:
   
   Dear Pid,
  
  
  
   I have tried that code and didn't helped, note that my context 
   session variables are not coming as null in order to rely on to be
   able to differenciate between Tomcat Node shutdown 
   session.invalidate().
   I'm sorry but I don't understand what you're saying here.
   Tomcat  the servlet api can't tell you the difference between an app
  shutdown and a session expiry without you writing code.
   What did you try?
   What was or wasn't null exactly?
   p
 Best Regards,
   Imad Hachem
  
   System Engineer
  
  
  
  
   Date: Tue, 17 Nov 2009 11:41:20 +
   From: p...@pidster.com
   To: users@tomcat.apache.org
   Subject: Re: MISC; Tomcat-5.5.12; After one Tomcat Cluster node
   shutdown, sessionDestroyed been called before contextDestroyed
  
   On 17/11/2009 11:31, Imad Hachem wrote:
  
   Dear Pid,
  
   Thanks for your reply.
  
   But can you specify exactly which Servlets API method to use?
  
   The link I sent had some code in it, did you read it?
  
   Note that Tomat-5.5.12 is deployed on Production environment and
   we are not facing major issues.
  
   But you might be facing some security ones.
  
   I will appreciate if you can adivse to which Tomcat Stable version
   we should Migrate taking in consideration that Tomcat Cluster is
   used in our environment as well.
  
   The latest: Tomcat 5.5.28. Same app, many bugfixes. Your version was
   released September 2005, over 4 years ago (that's 28 internet
 years).
  
   It's not good practice to avoid upgrading for that long.
  
  
   p
  
  
  
  
  
  
  
  
   Best Regards,
   Imad Hachem
  
   System Engineer
  
  
  
  
   Date: Tue, 17 Nov 2009 10:15:58 +
   From: p...@pidster.com
   To: users@tomcat.apache.org
   Subject: Re: MISC; Tomcat-5.5.12; After one Tomcat Cluster node
   shutdown, sessionDestroyed been called before contextDestroyed
  
   On 17/11/2009 04:14, Imad Hachem wrote:
  
   Dear all,
  
   I am using Tomcat-5.5.12 as Clustering nodes, and after one node
   shutdown sessionDestroyed is called before contextDestroyed.
  
   Are you still using 5.5.12? Hasn't anyone advised you to upgrade
   to a
   newer version yet?
  
   I think it's perfectly reasonably to call sessionDestroyed()
 before
   contextDestroyed().
  
   How can I know if sessionDestroyed is called from
   session.invalidate()
   from the real expiration of the session or shutdown of one
   cluster node?
  
   You can't know this directly from the Servlet API methods.
  
   Note that on sessionDestroyed event, I am using a Logout
   behavior to
   logout my users from the DATABASE.
  
   I have tried to set a KEY on the context (or application scope)
   to check
   on it during the sessionDestroyed event, but it seems the
   context is
   destroyed after the session destroy event.
  
   This comes up not infrequently on the list, the archives have more
   information:
  
  
 
http://old.nabble.com/Re%3A-sessionListener.sessionDestroyed-is-called-on-shutdown-of-a-node-in-the-cluster-p16746969.html

  
   Is there any event listener that I can use before the
   sessionDestroyed to differentiate if one cluster node has been
   shutdown or my session has been expired?
  
   Or is how to configure the contextDestroy to be called before

Re: loading a CharsetProvider via WebappClassLoader

2009-11-02 Thread Ronald Klop

Kris,

Thanks a lot for these pointers. It makes a lot very clear and we will do the 
dirty workaround now and vote for the bugs at the Sun website.

Ronald.


Op donderdag, 29 oktober 2009 16:48 schreef Kris Schneider 
kschnei...@gmail.com:


 
I guess this bug will be of interest since it mentions both jutf7 and

webapps ;-)

http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4619777

On Thu, Oct 29, 2009 at 11:42 AM, Kris Schneider kschnei...@gmail.com wrote:
 While the Javadoc for CharsetProvider claims that providers are looked
 up via the current thread's context class loader, the code for Charset
 seems to clearly be using ClassLoader.getSystemClassLoader()...

 On Thu, Oct 29, 2009 at 10:51 AM, Ronald Klop
 ronald-mailingl...@base.nl wrote:
 Hi,

 I have this jar (jutf7.jar) which should register itself with the
 CharsetProvider of Java. If I put it in the WEB-INF/lib directory it is
 ignored by Java. I understand that this is because of order in which the
 WebappClassLoader asks all other classloaders for a class.
 How can this be solved? Withouting having to deploy a jar file outside of
 the webapp. Or is this not possible?

 Thanks in advance for any tips.

 Ronald.

 --
 Kris Schneider




--
Kris Schneider

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








loading a CharsetProvider via WebappClassLoader

2009-10-29 Thread Ronald Klop

Hi,

I have this jar (jutf7.jar) which should register itself with the 
CharsetProvider of Java. If I put it in the WEB-INF/lib directory it is ignored 
by Java. I understand that this is because of order in which the 
WebappClassLoader asks all other classloaders for a class.
How can this be solved? Withouting having to deploy a jar file outside of the 
webapp. Or is this not possible?

Thanks in advance for any tips.

Ronald.



FOO / HTTP/1.1

2009-10-12 Thread Ronald Klop

Hi,

If I send this to my Tomcat it responds with HTTP/1.1 200 OK and calls my 
servlet. :-)
telnet localhost 8080
FOO / HTTP/1.1
Host: localhost

What is this suppost to do?

Ronald.



Re: FOO / HTTP/1.1

2009-10-12 Thread Ronald Klop

The question is why Tomcat does not return a 501 NOT IMPLEMENTED error like 
Apache does?

But I already found something. It does give a 501 when I call my servlet which 
only implements doGet, but when it goes to index.jsp the jsp stuff calls the 
service() method which doesn't check the http method. Probably this is ok.

Ronald.


Op maandag, 12 oktober 2009 12:01 schreef André Warnier a...@ice-sa.com:


 
Ronald Klop wrote:

 Hi,
  If I send this to my Tomcat it responds with HTTP/1.1 200 OK and calls  my 
servlet. :-)
 telnet localhost 8080
 FOO / HTTP/1.1
 Host: localhost
  What is this suppost to do?
 :-)
I don't know what is the context, and how you determine that Tomcat is the target, nor 
how you know that your servlet is being called, but on the face if it, it 
does exactly what it is supposed to do.
 From the above, the conclusions that can be drawn are :
- there is a webserver on localhost which answers to port 8080
- it has a valid document to return for the URL /
- and it is not too picky about HTTP verbs, since it seems to consider FOO as an 
acceptable alias for GET
If you want more information, I am afraid that you will have to supply more 
details about your configuration, and maybe explain exactly what the question 
is.


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








Re: POST request with timeout acts weird

2009-10-05 Thread Ronald Klop

Op maandag, 5 oktober 2009 00:47 schreef André Warnier a...@ice-sa.com:


 
Christopher Schultz wrote:

 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA1
  Ronald,
  On 10/2/2009 9:20 AM, Ronald Klop wrote:
 But I don't send any data. My servlet than waits in getParameterMap(),
 because that try's to read the inputstream and parse the parameters.
 After 20 seconds (Connector has connectionTimeout=2) the reading
 of the inputstream ends, but my application just gets an empty Map in
 stead of some TimeoutException.
  What leads you to believe that a TimeoutException would be thrown? The
 documentation for the HTTP connector's connectionTimeout attribute says:
  
 The number of milliseconds this Connector will wait, after accepting a
 connection, for the request URI line to be presented. The default value
 is 6 (i.e. 60 seconds).
 
  You provided the URI line within plenty of time. If you didn't enter
 anything, Tomcat would disconnect. Since you did, it doesn't.
 ...
Doesn't the fact that the read on the inputstream returns, imply that there is 
actually a timeout, even if it is not returned to the webapp ?

And, to Ronald : if the request is a POST, and it has a Content-length, and you 
get an empty parameter map after 20 seconds, can't you just reject the request 
as invalid ?

And, curiosity : if you set the Connector timeout to 30 seconds, does your 
inputstream then return after 30 seconds too ?







Yes it implies there is a timeout, but it is kind of guessing if it was a 
timeout or really an empty ParameterMap for the webapp. This can be 
workarounded by always including a dummyvar in the parameters as Christopher 
Shultz mentions or checking the Content-Length. But maybe Tomcat can do 
something better internally.

Yes if I set the connector timeout to 30 seconds it returns after 30 seconds.

My other workaround is doing a GET ajax in stead of POST. For this case the url 
wouldn't be too long for Internet Explorer and than more data is send at once 
over the network.

Ronald.



Re: POST request with timeout acts weird

2009-10-05 Thread Ronald Klop




Op zondag, 4 oktober 2009 22:23 schreef Christopher Schultz 
ch...@christopherschultz.net:


 


Ronald,

On 10/2/2009 9:20 AM, Ronald Klop wrote:
 But I don't send any data. My servlet than waits in getParameterMap(),
 because that try's to read the inputstream and parse the parameters.
 After 20 seconds (Connector has connectionTimeout=2) the reading
 of the inputstream ends, but my application just gets an empty Map in
 stead of some TimeoutException.

What leads you to believe that a TimeoutException would be thrown? The
documentation for the HTTP connector's connectionTimeout attribute says:


The number of milliseconds this Connector will wait, after accepting a
connection, for the request URI line to be presented. The default value
is 6 (i.e. 60 seconds).


You provided the URI line within plenty of time. If you didn't enter
anything, Tomcat would disconnect. Since you did, it doesn't.

 Why? And how should I handle this?

Honestly, I'm not sure if there's a way to check to see if all bytes
advertised in Content-Length were actually consumed by a request.

 (The real problem is that IE has some issue's and that some of my
 customers sometimes send synchronous ajax calls which don't send any
 data. I'm investigating that too. If somebody has a tip about that it is
 also appreciated.)

Technically speaking, the HTTP spec does not require the Content-Length
to be correct(!). I think this is something that your webapp is just
going to have to tolerate.

Perhaps you could add a parameter to all your requests like 'last=true'
and always make that the last parameter submitted. If the last parameter
has the value true then the POST was sane. Otherwise, reject the
request. Just a thought.

- -chris







There is even more fun about the documentation of connectionTimeout. It states 
that it waits for the URI after accepting the connection, but in my example 
Tomcat is not waiting for the URI, but for data from the request. So 
connectionTimeout does much more than what is mentioned in the documentation.

I know about the issue of interpreting the Content-Length in comination with 
charsets and Content-Encoding and Transfer-Encoding.

But I guess Tomcat does something like this.
Socket s = ...;
s.setSoTimeout(2);
InputStream in = s.getInputStream();
try {
  in.read();
} catch (SocketTimeoutException e) {
  // Ignore and give (part of the) data to the Servlet, because the specs of 
getParameter(...) gives us no room for bubbling up this exception.
}

I will verify if this is correct in the code, but I hope to illustrate what I 
puzzled by. I can't handle this situation without workarounds, while the 
problem is so simple.
I think the lazy evaluation of the POST parameters in Tomcat is making it very 
difficult to give good errors. But don't take this wrong. I'm not telling that 
the advantages of lazy evalution are bigger of smaller.

Ronald.




  1   2   >