limit number of connections tomcat accepts

2010-01-06 Thread Peter Beichert
Hi,

I like to limit the number of connections tomcat (6.0.20) accepts. However, 
this is not possible. 

For testing purpose I use the following connector statement:

Connector port=8080 acceptCount=5 maxThreads=3 minSpareThread=1 
maxSpareThreads=2 /

Here only 3 threads should process the requests and 5 more requests should be 
queued. 

If I start 100 parallel requests to a servlet which does nothing else than 
waiting 5 seconds, I would expect that only 8 requests would be accepted, the 
rest should receive a connection refused. 
However all 100 Requests a accepted and it takes a long time until they finish.

I use Debian Linux and have the same behavior with suns jdk1.6.0_17 and the 
ibm-jdk.

I appreciate any help how to solve this problem.

Regards
Peter 

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



Re: limit number of connections tomcat accepts

2010-01-06 Thread Mark Thomas
On 06/01/2010 08:03, Peter Beichert wrote:
 Hi,
 
 I like to limit the number of connections tomcat (6.0.20) accepts. However, 
 this is not possible. 
 
 For testing purpose I use the following connector statement:
 
 Connector port=8080 acceptCount=5 maxThreads=3 minSpareThread=1 
 maxSpareThreads=2 /

minSpareThread  maxSpareThreads do nothing and will be ignored.

 Here only 3 threads should process the requests and 5 more requests should be 
 queued. 
 
 If I start 100 parallel requests to a servlet which does nothing else than 
 waiting 5 seconds, I would expect that only 8 requests would be accepted, the 
 rest should receive a connection refused. 
 However all 100 Requests a accepted and it takes a long time until they 
 finish.
 
 I use Debian Linux and have the same behavior with suns jdk1.6.0_17 and the 
 ibm-jdk.
 
 I appreciate any help how to solve this problem.

This works as expected for me using JMeter as the test client. How are
you testing this?

Mark



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



Toggling

2010-01-06 Thread Nikita Manohar
I would like to know if an entire web application can be toggled between
http and https in Tomcat.

Thank you,
-Nikita


Re: Toggling

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

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

- Peter

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

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

 Thank you,
 -Nikita



RE: Toggling

2010-01-06 Thread Shanmugham, Dayanand (IE10)
We could forward http requests to https - this configuration is feasible
at Apache level.

Regards,
Daya

-Original Message-
From: Nikita Manohar [mailto:nikita.mano...@gmail.com] 
Sent: Wednesday, January 06, 2010 2:32 PM
To: users@tomcat.apache.org
Subject: Toggling

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

Thank you,
-Nikita

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



Re: Toggling

2010-01-06 Thread Nikita Manohar
Hi Peter,

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

Is it possible to do so automatically?


Thank you,
-Nikita


Re: Toggling

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

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

 Is it possible to do so automatically?

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

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

- Peter


Re: Toggling

2010-01-06 Thread Mark Thomas
On 06/01/2010 09:16, Nikita Manohar wrote:
 Hi Peter,
 
 The trigger here is suppose in a web application there is a welcome page
 which is to be re-directed to a user's homepage after login. The secure
 information (login page) should be toggled to https and the rest as http.

If the login page needs protecting with https then so do the subsequent
requests.

 Is it possible to do so automatically?

No.

Mark



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



RE: Toggling

2010-01-06 Thread Looijmans, Mike
Just redirect as required.

http://myserver/login redirects to https://myserver/login, form submits
to the same page and when OK, it redirects to http://myserver/home or
whatever. You'll probably need to pass a 'secret' to the home link to
preserve the user's login, which might be a simple URI parameter.

Don't do the above on the big bad internet. From a security perspective
it's virtually pointless to do it this way.

I'm assuming you're doing this because you have an intranet www server
and some company policy dictates that plaintext passwords are not
allowed on the net any longer. It's probably much smarter to look at
single-sign-on solutions instead, Kerberos integration with Tomcat is
about a day's work and will both provide a better user experience and
provide much better security too.

M
 

 -Original Message-
 From: Nikita Manohar [mailto:nikita.mano...@gmail.com] 
 Sent: woensdag 06 januari 2010 10:17
 To: Tomcat Users List
 Subject: Re: Toggling
 
 Hi Peter,
 
 The trigger here is suppose in a web application there is a 
 welcome page which is to be re-directed to a user's homepage 
 after login. The secure information (login page) should be 
 toggled to https and the rest as http.
 
 Is it possible to do so automatically?
 
 
 Thank you,
 -Nikita
 

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



hello world

2010-01-06 Thread Cristobal Castro

hello
i just installed tomcat on win xp, now how can i set my firt project ? i 
see the tomcat folder in C:, do i need to put my first program in one of 
those folders? just like i did with normal apache ? (ex htdocs folder - 
called on browser by http://localhost/nameOfYourFile)

thanks
--
http://cristobal.castro.free.fr/


__ Information from ESET Smart Security, version of virus signature 
database 4747 (20100106) __

The message was checked by ESET Smart Security.

http://www.eset.com



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



Re: hello world

2010-01-06 Thread Mark Thomas
On 06/01/2010 11:09, Cristobal Castro wrote:
 hello
 i just installed tomcat on win xp, now how can i set my firt project ? i
 see the tomcat folder in C:, do i need to put my first program in one of
 those folders? just like i did with normal apache ? (ex htdocs folder -
 called on browser by http://localhost/nameOfYourFile)
 thanks

http://tomcat.apache.org/tomcat-6.0-doc/appdev/index.html

Mark



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



Re: limit number of connections tomcat accepts

2010-01-06 Thread Peter Beichert
Am Mittwoch, 6. Januar 2010 09:15:23 schrieb Mark Thomas:
 On 06/01/2010 08:03, Peter Beichert wrote:
  Hi,
 
  I like to limit the number of connections tomcat (6.0.20) accepts.
  However, this is not possible.
 
  For testing purpose I use the following connector statement:
 
  Connector port=8080 acceptCount=5 maxThreads=3 minSpareThread=1
  maxSpareThreads=2 /
 
 minSpareThread  maxSpareThreads do nothing and will be ignored.
 
  Here only 3 threads should process the requests and 5 more requests
  should be queued.
 
  If I start 100 parallel requests to a servlet which does nothing else
  than waiting 5 seconds, I would expect that only 8 requests would be
  accepted, the rest should receive a connection refused.
  However all 100 Requests a accepted and it takes a long time until they
  finish.
 
  I use Debian Linux and have the same behavior with suns jdk1.6.0_17 and
  the ibm-jdk.
 
  I appreciate any help how to solve this problem.
 
 This works as expected for me using JMeter as the test client. How are
 you testing this?
I used jmeter and in addition I started 100 requests in parallel by a shell-
script with wget. With wget I could observe all the waiting threads. Their 
number got reduced by 3 every 5 seconds. All requests got answered with Status 
200. I did not get any connection refused.
 
 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: Tomcat 5.5 root directory

2010-01-06 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Joseph,

On 1/5/2010 8:06 PM, File Send wrote:
 I looked into logs folder but its empty. I have attached here the content of
 ROOT directory. I made permission to read using property. it was not there
 before.
 
 *How to verify which userid tomcat is using and what access it has ?* I have
 no access to admin and it asks me to install admin package. Please let me
 know for more information.

Uh, oh. It sounds like you're using a re-packaged version of Tomcat. Can
you specify your environment?

If you are using, say, Debian's Tomcat package, then the definition of
CATALINA_BASE/webapps/ROOT becomes somewhat muddled. You might have to
use, instead, something like /var/www/webapps/ROOT or whatever setup
Debian's Tomcat package demands. You'll have to read the documentation
for your package maintainer's version of Tomcat, or hope someone on the
list knows how to configure it and happens to read this thread.

This is the danger of running package-managed versions of Tomcat instead
of the official package: readers on this list can rarely help because
each package is configured completely differently.

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

iEYEARECAAYFAktElKAACgkQ9CaO5/Lv0PAkvACgrpgxgTNxvLO/hFxQgZVxqpla
8yoAnjlweVtCPdF7bSvOBO3PBNmXn7P8
=bUJM
-END PGP SIGNATURE-

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



Re: limit number of connections tomcat accepts

2010-01-06 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Peter,

On 1/6/2010 3:03 AM, Peter Beichert wrote:
 If I start 100 parallel requests to a servlet which does nothing else than 
 waiting 5 seconds, I would expect that only 8 requests would be accepted, the 
 rest should receive a connection refused. 

A lot here depends upon the behavior of the client. Some clients will
try until they get a connection rather than giving up. Is this how you
have configured JMeter and/or wget?

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

iEYEARECAAYFAktElRoACgkQ9CaO5/Lv0PAQOgCfd3PP+2CBzWgucpCknu7BVObJ
hFMAoKpvb+l+8pYOeKEJLSqzi7aHFazR
=16aL
-END PGP SIGNATURE-

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



Re: Configuring tomcat to release the webapp jar file handles

2010-01-06 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Vijay,

On 1/6/2010 1:12 AM, Vijay wrote:
 I have a webapp that has 300 jar files bundled in WEB-INF/lib. Most of
 the classes in these jar files need to be loaded during the startup of the
 webapp. Does tomcat release the jar file handles once the class loader is
 done loading the classes? It does not seem to be the case.
 Ideally, tomcat should close the jar file handles that the webapp no longer
 needs.

I haven't looked at the code, but it would seem that the
WebappClassLoader shouldn't need file handles to remain open to do it's
up-to-date checking of .jar and .class files.

WebappClassLoader /does/ contain a JarFile[] member, which may keep file
handles open. I haven't looked at the code -- only the Javadoc.

 Is there a way to configure tomcat to have an agressive policy to close
 unused file handles?

None that I know of: patches are always welcome.

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

iEYEARECAAYFAktEly8ACgkQ9CaO5/Lv0PAKrgCgwCSa9Xy5MVlpYBy+Gn3AZXeE
jukAn3DpombmSP3FXZ8EPTobtgDe09b8
=GKts
-END PGP SIGNATURE-

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



Re: Changing request address to x-forwarded-for

2010-01-06 Thread Mohit Anchlia
Could you please point me to an example of how I can do this? We are
using apache-tomcat-6.0.18

On Tue, Jan 5, 2010 at 11:41 PM, Mark Thomas ma...@apache.org wrote:
 On 06/01/2010 04:14, Mohit Anchlia wrote:
 tomcat 6:

 Is it possible to inject or change remote address to what's in
 x-forwaded-for in http header such that when Servlet received the
 request it's already in the request.getRemoteAddress()? Otherwise
 we'll need to make a urgent change to read from the HTTP header. We
 didn't realize it earlier since we are using F5 LTM.

 The next release of Tomcat 6 will include a new valve (RemoteIpValve) to
 do exactly this. If you can't wait for the next 6.0.x release (should be
 soon - hopefully next week or so) then you can always use that as the
 basis to write your own valve. Alternatively, Tomcat 7 also has a filter
 that does the same thing that you could use as a startign point.

 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: Load balancing questions

2010-01-06 Thread assan alhamoud
any suggestion ?

On Tue, Jan 5, 2010 at 1:54 PM, assan alhamoud hamoudas...@gmail.comwrote:

 Hello ,

 *In Server.xml for Tomcat I have the following values*

 !-- A HTTP/1.1 Connector on port 8080  --
   Connector port=42591 address=${jboss.bind.address}
  maxThreads=750 minSpareThreads=50 maxSpareThreads=150
  enableLookups=false redirectPort=8443
  connectionTimeout=2 disableUploadTimeout=true
  useBodyEncodingForURI=true/

   !-- A AJP 1.3 Connector on port 8009 --
   Connector port=42510 address=${jboss.bind.address}
  minSpareThreads=50 maxSpareThreads=150
  enableLookups=false redirectPort=8443 debug=0
 minThreads=40 minProcessors=40 maxProcessors=500
  protocol=AJP/1.3 acceptCount=100
  useBodyEncodingForURI=true connectionTimeout=7000
 maxThreads=750/


 *and in workers.properties I have the following values*
 *
 *
 worker.server1.port=42510
 worker.server1.host=X.X.X.X
 worker.server1.type=ajp13
 worker.server1.lbfactor=1
 worker.server1.connect_timeout=1
 worker.server1.prepost_timeout=2000
 worker.server1.socket_keepalive=True

 *and I am going to add the following *
 reply_timeout
 max_reply_timeouts
 retries =1
 retry_interval
 recovery_options=1
 socket_timeout
 connection_pool_size
 connection_pool_timeout

 Do you suggest values for them ? and do you recommend adding
 other parameters  ?

 Notes :
 1- I upgraded  mod_jk
 2- upgrade tomcat is not easy to do , I have some questions about this ,
 but now I am concentrating on tuning the parameters first.
 3- I have long garbage collection pauses  GC 2993642K-1550690K (3145728K),
 5590.496 ms



 On Mon, Jan 4, 2010 at 12:54 PM, Bob Hall rfha...@yahoo.com wrote:



 --- On Mon, 1/4/10 at 1:34 AM, Mark Thomas ma...@apache.org wrote:

  On 03/01/2010 11:09, assan alhamoud
  wrote:
   Happy new year to all ,
  
   I am using tomcat and JBoss.
 
  You'll need to explain that further. Why would you use
  Tomcat and JBoss
  for the same app. I would expect one or the other.
 
   Tomcat/5.0.26
 
  That is very, very old and has many known bugs and a number
  of security
  vulnerabilities. I'd strongly suggest moving to 5.5.28.

 JBoss 3.2.5 has Tomcat 5.0 embedded (both very old versions)

 JBoss 4.0.3 has Tomcat 5.5 embedded (both old versions)

 Current version of JBoss is 6.0 not sure what version of Tomcat is
 embedded,
 http://community.jboss.org isn't responding...

 - Bob

 
   mod_jk/1.2.26
 
  Also worth upgrading to the latest version
 
 
  To get back to your original question, it looks like your
  app could
  benefit from some tuning. The hanging is likely to be
  caused by long
  running requests using up all the connections between httpd
  and Tomcat
  and/or poor mod_jk / AJP connector configuration. Since you
  haven't
  shown us this configuration it is hard to provide specific
  advice but
  generally I would suggest:
  - use JkOptions +DisableReuse (or sort out your timeouts
  but my
  experience has been disable reuse is simpler to configure
  and has
  similar performance)
  - turn on access logging for Tomcat
  - check any timeouts are consistent with your longest
  running requests
  - ensure the following are compatible
- httpd processes/threads
- Tomcat AJP connector threads
- mod_jk connection pooling
 
  Mark
 
  
   Regards,
  
   2009/12/29 Mark Thomas ma...@apache.org
  
   On 29/12/2009 16:17, assan alhamoud wrote:
   Hello Mark  ,
  
   we are using apache  Server version:
  Apache/2.2.11 (Unix)
   we use  mod_jk.so module
   jboss-3.2.5
   Tomcat5
   and jrockit-jdk1.4.2_19
  
   at your disposal if you need more information
  
   Are you using Tomcat or JBoss?
   Tomcat version?
   mod_jk version?
  
   Mark
  
  
   Regards,
   Ghassan
  
   2009/12/29 Mark Thomas ma...@apache.org
  
   On 29/12/2009 15:21, assan alhamoud
  wrote:
   Hello All
  
I have some questions and I hope
  to find answers about Load balancing
   .
  
   1- The first question , our DBA says
  that it not normal and no logic
to
   have several instances of tomcat
  server on the same machine   with the
   same
configuration , is this correct
  ?
   No. Your DBA is wrong.
  
   2- Each tomcat instance here can serve
  about 125 user , and I have more
   than
   this number on the server I got alot
  of problems and usually  the
   instance
   hang , is there anyway to get better
  performance from tomcat.
   That isn't a Tomcat problem, that is an
  application problem. The
   solution is to fix/tune your application.
  
  I am using now 3G memory
  for each instance and 120 for max_pool_size
   and
   750 maxThread
   It isn't clear what the 125 users refers
  to. Is it concurrent requests,
   is it concurrent sessions, is it
  concurrent users (assuming 1 concurrent
   user == more than 1 concurrent request).
  From these numbers the
   application seems very resource intensive.
  It does appear that it would
   benefit from some tuning.

Re: Changing request address to x-forwarded-for

2010-01-06 Thread Cyrille Le Clerc
   Hello Mohit,

   You can use this RemoteIpValve (1) on Tomcat 6.0.18, you just have
to drop the xebia-tomcat-extras-1.0.0.jar (2) in your Tomcat lib
directory.

   This version is being used on several web sites including high volume ones.

   If you can wait few days, a new version of Tomcat 6 including this
valve will hopefully be released very soon ; vote has started on the
tomcat-dev mailing list just before christmas.

   Don't hesitate to ask questions if the docs aren't clear enough,

   Hope this helps,

   Cyrille
--
Cyrille Le Clerc
clecl...@xebia.fr
http://blog.xebia.fr

(1) http://code.google.com/p/xebia-france/wiki/RemoteIpValve
(2) http://xebia-france.googlecode.com/files/xebia-tomcat-extras-1.0.0.jar

On Wed, Jan 6, 2010 at 4:52 PM, Mohit Anchlia mohitanch...@gmail.com wrote:

 I found this site

 http://code.google.com/p/xebia-france/wiki/RemoteIpValve

 Can I directly download and install it in 6.0.18?

 On Wed, Jan 6, 2010 at 7:41 AM, Mohit Anchlia mohitanch...@gmail.com wrote:
  Could you please point me to an example of how I can do this? We are
  using apache-tomcat-6.0.18
 
  On Tue, Jan 5, 2010 at 11:41 PM, Mark Thomas ma...@apache.org wrote:
  On 06/01/2010 04:14, Mohit Anchlia wrote:
  tomcat 6:
 
  Is it possible to inject or change remote address to what's in
  x-forwaded-for in http header such that when Servlet received the
  request it's already in the request.getRemoteAddress()? Otherwise
  we'll need to make a urgent change to read from the HTTP header. We
  didn't realize it earlier since we are using F5 LTM.
 
  The next release of Tomcat 6 will include a new valve (RemoteIpValve) to
  do exactly this. If you can't wait for the next 6.0.x release (should be
  soon - hopefully next week or so) then you can always use that as the
  basis to write your own valve. Alternatively, Tomcat 7 also has a filter
  that does the same thing that you could use as a startign point.
 
  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


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



Java EE 6 Support

2010-01-06 Thread eric wright
Hi,

What are the plans on adding Java EE 6 support to Tomcat? Any dates on
delivering Tomcat v7?

Thanks.


Re: Java EE 6 Support

2010-01-06 Thread Mark Thomas
On 06/01/2010 16:36, eric wright wrote:
 Hi,
 
 What are the plans on adding Java EE 6 support to Tomcat? Any dates on
 delivering Tomcat v7?

The first 7.0.x release is expected by the end of the month. That
time-scale is dependent on the async work being completed (Filip), the
remaining EL changes (me) and anything the TCK throws up (we haven't got
the TCK yet).

I may try a 7.0.0 alpha release to give folks a chance to test even if
the development work isn't quite complete. Of course, you are free to
build from trunk to test whenever you wish. Some folks have done this
already and we have started to see bugs reported against 7.0.x

Mark



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



Re: Load balancing questions

2010-01-06 Thread Bob Hall
--- On Wed, 1/6/10 at 7:54 AM, assan alhamoud hamoudas...@gmail.com wrote:

 any suggestion ?


Upgrade to a more recent version of JBoss/Tomcat, like JBoss 5.1.0.

- Bob


  

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



Nesting servlets with different credentials

2010-01-06 Thread Greg Allen
I have two servlets, http://localhost:8080/s1 and 
http://localhost:8080/s2.  Both servlets

require BASIC authentication.

My application will call s1, and then s1 will turn around and call s2.  
However, the credentials

supplied to s2 need to be different than those supplied to s1.

Inside of s1,  I set up an instance of HttpClient and set the new 
credentials on it.  Here's

the code that does it:

   HostConfiguration config = new HostConfiguration();
   HttpClient client = new HttpClient();

   config.setHost(m_sHost, m_iPort, m_sProtocol);
   client.setHostConfiguration(config);

   Credentials credentials = new 
UsernamePasswordCredentials(m_sUser, m_sPassword);

   client.getState().setCredentials(AuthScope.ANY, credentials);
   client.getParams().setAuthenticationPreemptive(true);

I then call client.executeMethod with the appropriate arguments to call 
into s2.


The problem is that the call to s2 does not use the new credentials - it 
seems to be using the
credentials that were used to access s1.  In fact, I've removed the 
setting of the credentials
on the client, and the call to s2 still succeeds (although as the wrong 
user).


I have verified this behavior by turning on logging in my JDBCRealm. I 
can see that authentication
occurs for the call to s1, but there is no other authentication call 
made.  I expected to see a second

authentication for s2, but there was nothing. It appears as though there
is some sort of caching going on here that I need to handle/disable.

Can anyone shed any light on what is going on, and how to fix it?

Thanks,

-- Greg



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



connect tomcat and apache by mod_jk2

2010-01-06 Thread WILLIAMer

Hi, ALL.
I have connect tomcat and apache by mod_jk2 at the same machine(solaris).
I can see the application page with http://localhost:4080/ 
or http://localhost/ by apache.

Now, i need to move tomcat to another machine in LAN.
So i change the workers2.properties setting like under

---original(tomcat and apache at same machine)---
# Example socket channel, explicitly set port and host.
[channel.socket:127.0.0.1:4009]
tomcatId=127.0.0.1:4009
port=4009
host=127.0.0.1
# define the worker
[ajp13:127.0.0.1:4009]
channel=channel.socket:127.0.0.1:4009

[uri:www.154test.com/*]
worker=ajp13:127.0.0.1:4009

---modify(tomcat and apache at separate machine)---
# Example socket channel, explicitly set port and host.
[channel.socket:192.168.1.153:4009]
tomcatId=192.168.1.153:4009
port=4009
host=192.168.1.153
# define the worker
[ajp13:192.168.1.153:4009]
channel=channel.socket:192.168.1.153:4009

[uri:www.153test.com/*]
worker=ajp13:192.168.1.153:4009

But it didnt work.
I didnt see any error in log.
under is part of log
[Wed Jan 06 23:19:01 2010] [notice] mod_jk2 child 3 initialized
[Wed Jan 06 23:19:01 2010] [notice] jk2_init() Found child 4692 in
scoreboard sl
ot 4
[Wed Jan 06 23:19:01 2010] [notice] channelApr.resolve(): create AF_NET 
192.168
.1.153 4009
[Wed Jan 06 23:19:01 2010] [notice] jk2_init() Setting scoreboard slot 0 for
chi
ld 4693
[Wed Jan 06 23:19:01 2010] [notice] channelApr.resolve(): create AF_NET 
192.168
.1.153 4009
[Wed Jan 06 23:19:01 2010] [notice] workerEnv.init() ok
/usr/local/apache/conf/w
orkers2.properties
[Wed Jan 06 23:19:01 2010] [notice] mod_jk2 child 4 initialized
[Wed Jan 06 23:19:01 2010] [notice] workerEnv.init() ok
/usr/local/apache/conf/w
orkers2.properties
[Wed Jan 06 23:19:01 2010] [notice] mod_jk2 child 4693 initialized
[Wed Jan 06 23:19:01 2010] [notice] jk2_init() Found child 4694 in
scoreboard sl
ot 6
[Wed Jan 06 23:19:01 2010] [notice] channelApr.resolve(): create AF_NET 
192.168
.1.153 4009
[Wed Jan 06 23:19:01 2010] [notice] workerEnv.init() ok
/usr/local/apache/conf/w
orkers2.properties
[Wed Jan 06 23:19:01 2010] [notice] mod_jk2 child 6 initialized

It seems apache catch 192.168.1.153 4009 from the line 
channelApr.resolve(): create AF_NET  192.168.1.153 4009

I really cant see the page with http://192.168.1.153/
But http://192.168.1.153:4080/ is work.

Anyone can help me?
Thanks.
-- 
View this message in context: 
http://old.nabble.com/connect-tomcat-and-apache-by-mod_jk2-tp27027779p27027779.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: Comet and thread binding

2010-01-06 Thread tbee



Joseph Morgan-2 wrote:
 
 Sounds to me you simply need to create a POJO to contain the execution
 context state 

The issue is not the storage, but access to the storage. How would I, at any
place in the execution, access it, without passing the context to each
method.

-- 
View this message in context: 
http://old.nabble.com/Comet-and-thread-binding-tp27026574p27055509.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: Comet and thread binding

2010-01-06 Thread Bob Hall


--- On Wed, 1/6/10 at 10:18 PM, tbee t...@tbee.org wrote:

 
 The issue is not the storage, but access to the storage.
 How would I, at any
 place in the execution, access it, without passing the
 context to each
 method.

Have you considered using ThreadLocal?

- Bob


  

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