Session clustering and session stickiness - Performance issues (was Re: When is Tomcat 5 Release version scheduled to come out?)

2003-11-23 Thread Antonio Fiol Bonnín
Hello Remy,

I did not pretend to be whining. Sorry if it souded like that.

And thank you very much for your response: I find it really useful.

First, thank you for confirming my worries about JMeter not being the 
best available load testing tool.
** [OT] Do you know of a better (free if possible) load testing tool, 
which supports cookies and HTTPS? AB doesn't, AFAIK.

When you say you have to use session stickiness:
** Do you mean as an alternative, or combined with session clustering. I 
can't see clearly the point of combining them.

You also say: only if your webapp does a significant amount of 
computations. Our webapp does a significant amount of XSLT work on a 
few pages, but most of them consist only on personalized versions of a 
static page (the user name is printed on the top, that's all). That is 
what I meant by difficult and trivial. So I guess our app is not the 
type of app that will benefit from session clustering.

And about our worries: we are expecting something similar to slashdot 
effect, i.e. the webapp itself is a moderate traffic one which can be 
easily served with a single Tomcat. However, our marketing people expect 
a very high traffic (x100 or so) for a few hours and a high traffic (x10 
or so) for a few days. They expect a (x2 - x5) permanaent increase. For 
the permanent increase, I am not worried. It is the x100 that worries 
me seriously.

Other than that, our production architecture consists of:
2 load balancers + 2 Apache + 2 Tomcat + 1 Database
** Do the load balancers need to know about session stickiness or is it 
just the mod_jk on the Apache that needs it?

Thank you very much.

Antonio Fiol



Remy Maucherat wrote:

Antonio Fiol Bonnín wrote:

Hello,

I'll begin from the end...

I did not present evidence, that is true, but I explained the 
symptoms. I tested three configurations:

1 Apache + 1 Tomcat;1 Apache + 2 Tomcat;1 Apache + 3 Tomcat

All three gave me very similar performance results. Measurement tool 
was JMeter. Difficult pages were generated faster using three 
tomcats than using one tomcat, and trivial pages were faster with one 
tomcat.

Probably all this is due to the overhead of replicating the sessions, 
but I am not sure.

We also used Apache AB to test it. We did it against one nearly 
static JSP page. With low concurrency levels (less than 5), 2 tomcats 
give more throughput than one. With higher concurency levels (5 or 
more), 2 tomcats give worse throughput.

Probably, again, I think, because of the overhead of creating 
hundreds of sessions and replicating them. But, again, I am not sure.


You don't pretend to win the coveted Whiner Of The Month award with 
this, I hope. There's a lot of competition, you know.

A little more seriously:
- JMeter is IMO a bad load testing tool, but it's good at testing 
latencies.
- With your AB test, you are likely creating a session each time, 
which is basically the worst case for session clustering.
- You have to use session stickiness (the Servlet specification 
requires that operations related to a sigle session be bound to a 
single VM).
- JBoss session clustering is very likely a little more optimized 
(although it is not currently ported to Tomcat 5; coming soon).

You'll get better performance out of this form of clustering only if 
your webapp does a significant amount of computations. XML stuff is 
the prime example. If you are mostly DB based, you'll be moving the 
contention problems to the DB layer.

Given the throughtput a single Tomcat 5 with its HTTP connector gives 
on a decent server, I am surprised you are having problems unless you 
app is really processing intensive or your expected traffic is really 
high.




smime.p7s
Description: S/MIME Cryptographic Signature


IIS is not supported in Tomcat 4.1.29.

2003-11-23 Thread Roeland Meyer
Results of 3x19-hour daze of trying to get 4.1.29
working with IIS. Uncovered several major errors in
both IIS HOW-TO and the Workers HOW-TO. 

There are three section to this email; 
'General Complaints', 'IIS HOW-TO', and 'Workers HOW-TO'.

General complaints: (in no particular order)

1) The printer friendly version isn't. - The
printing standard, everywhere civilized, is
protrait mode. The dox require landscape mode and
any attempts to print in what, for the rest of the
world, is normal mode will result in truncation of
the rightmost part of the text. I wasted 1/2 a
ream of paper finding this out. Paper is cheap,
granted, but that also means the loss of half the
ink, in a 55CHF ink cartridge, printing out
useless drechk. - g

2) Inconsistant handeling of path names. - Older
*nix and MS OSes could not deal with space chars
in file of path names. Modern OSes do. The default
location for applications software, in any version
of Windows, newer than Windows for Workgroups, is
C:\Program Files\. All modern and well-written
software deals with this. Even Linux/Samba deals
with this. Modern Systems Administrators quote
appropriate command line statements correctly to
deal with this. Importantly, when a piece of code
cannot deal with it THEY TELL YOU IN THE DOX!

3) The default install location for all Windows
installers should be C:\Program Files\ and the
user should be made to browse for other
locations. This is every bit as significant as
'/usr/local', '/usr/opt', and '/opt, under *nix.
If it is important to support naming stands under
Linux/Unix then it is equally important to support
similar standards under Win2K.

4) No web page should be more than 800 pixels
wide. - Many of us (80% of those over 45) have
problems reading anything at higher resolution
than 1024x768, on anything less than a 21-inch CRT.
Most of us are buying LCD monitors, whose highest
affordable resolution is 1024x768. Ergo, the
default resolution (today) is 1024x768. Web pages
that meet or exceed that resolution have to be
scrolled to be read. This is normally countered by
reducing the font-size to accommodate such
recalcitrant dox. However, there is a lower limit
to such reduction AND the Tomcat dox pages resist
such reduction. This also relates to item 1.

IIS HOW-TO:

1) Obviously, all references to Workers HOW-TO
point to a defective document, as shown in the
section on the workers HOW-TO.

2) Supported Configuration is obviously wrong.
If you don't have the documentation then you don't
have the feature. The documentation for Tomcat
4.1.29, under Win2K IIS, is misleading at best.

3) Installation Referenced files are not found.
There is no workers.properties or
uriworkermap.properties files to be found
anywhere in the Tomcat directory tree.

4) Configuring the ISAPI Redirector uses all
non-standard path names in it's examples.(see item
2 in the General Complaints).

5) Huge disconnect in Adding additional Contexts
between contexts, workers, and URL bits.

6) Which leaves Advanced Context Configuration
completely in the lurch.

Workers HOW-TO:

This was obviously written for Tomcat 3 and never
updated for Tomcat 4.1.29. I hit 10 errors and
stopped logging. These indicate huge problems and
this document should have never been included in
the Tomcat 4.1.29 release. Not even as a guidline.
It is more misleading than useful.

1) Completely skips the obvious first steps: -
Included excerpt from my workers.properties file
(see Item 2 in the General Complaints). This is
early in the workers.properties files and is not
explained at all, other than to state that it's
for JNI support. 

# workers.tomcat_home should point to the location where you
# installed tomcat. This is where you have your conf, webapps and lib
# directories.
#
workers.tomcat_home=C:\Program Files\Java\Tomcat 4.1
# workers.tomcat_home=c:\tomcat
# workers.tomcat_home=/usr/local/tomcat

#
# workers.java_home should point to your Java installation. Normally
# you should have a bin and lib directories beneath it.
#
workers.java_home=C:\Program Files\Java\_jvm
# workers.java_home=c:\jdk1.3
# workers.java_home=/usr/java

#
# You should configure your environment slash... ps=\ on NT and / on UNIX
# and maybe something different elsewhere.
#
ps=\
# ps=/

2) Introduction is completely accurate yet,
completely inadequate. What is the relationship of
a worker instance to a URL? What is a Tomcat
context? Where is the referal to a document that
can explain these things ( the file Tomcat: A
Minimalistic User's Guide, is not found)? 

3) Defining Workers gives syntax only with no
explaination of content. Are these name referenced
by the calling URL?

4) Workers Type is almost meaningless in light
of item 3. Sometimes, stating the obvious, at
least once, is a good thing.

5) Setting Worker Properties Same complaint as
item 4.

6) inprocess and out process need to be explained
or refered to another doc.

7) The discussion of JNI properties should include
a one paragraph description of 

httpd 500s without tomcat 500s

2003-11-23 Thread J D
I see quite a few httpd 500s in the httpd access.logs without corresponding 
entries in the tomcat access.log. I am using Apache 2.0.42, mod_jk2, and 
Tomcat 4.1.24.

Any suggestions on how I can debug these?

Thanks

_
Groove on the latest from the hot new rock groups!  Get downloads, videos, 
and more here.  http://special.msn.com/entertainment/wiredformusic.armx

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


how to customize HTTPSession

2003-11-23 Thread ppalavilli
Hi,

I am new to the java webapp development. I want to store some user data for my app in 
a client side cookie rather than as a server side object and referencing it with a 
sessionId. One of the main reasons for that is - we will be running multiple servers 
load balancing. Since the HTTPSessions are java container instance specific - I don't 
want to use them. I have read about distributed Session support - but it does involve 
complicated setup and seems to be a overkill when compared to the data that I want to 
store.

Anyway - in that aspect - I have these 2 questions :

1. Is there a way to override the HTTPSession and HTTPResponse provided by tomcat to 
save the contents of the Session as a cookie instead of just storing the sessionId ? 

2. If I implement my own Session class, and store it as a attribute in the HTTPRequest 
object, how can I write the contents of the session as a cookie right before I return 
the response ? The way I used to do it in other apps in C++ is to write a destructor 
for my session object, which will get called when the request is being terminated and 
I could write the cookie in the response. But the java equivalent to destructor 
finalize() is not gauranteed to be called until the GC wakes up. So how can I make 
sure I set the cookie after the request is completely processed?

Please pardon my ignorance if made any wrong assumptions. 
I would appreciate any help.
regards,
Praveen

__
McAfee VirusScan Online from the Netscape Network.
Comprehensive protection for your entire computer. Get your free trial today!
http://channels.netscape.com/ns/computing/mcafee/index.jsp?promo=393397

Get AOL Instant Messenger 5.1 free of charge.  Download Now!
http://aim.aol.com/aimnew/Aim/register.adp?promo=380455

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: how to customize HTTPSession

2003-11-23 Thread Mark R. Diggory
You might look into implementing the
javax.servlet.hhtp.HttpSessionBindingListener interface, this will allow
you to act when an object is added/removed from the session. Simply put, 
you could write valueBound/UnBound methods that set Cookies into the 
HttpResponse.

-Mark

[EMAIL PROTECTED] wrote:

Hi,

I am new to the java webapp development. I want to store some user
data for my app in a client side cookie rather than as a server side
object and referencing it with a sessionId. One of the main reasons
for that is - we will be running multiple servers load balancing.
Since the HTTPSessions are java container instance specific - I don't
want to use them. I have read about distributed Session support - but
it does involve complicated setup and seems to be a overkill when
compared to the data that I want to store.
Anyway - in that aspect - I have these 2 questions :

1. Is there a way to override the HTTPSession and HTTPResponse
provided by tomcat to save the contents of the Session as a cookie
instead of just storing the sessionId ?
2. If I implement my own Session class, and store it as a attribute
in the HTTPRequest object, how can I write the contents of the
session as a cookie right before I return the response ? The way I
used to do it in other apps in C++ is to write a destructor for my
session object, which will get called when the request is being
terminated and I could write the cookie in the response. But the java
equivalent to destructor finalize() is not gauranteed to be called
until the GC wakes up. So how can I make sure I set the cookie after
the request is completely processed?
Please pardon my ignorance if made any wrong assumptions. I would
appreciate any help. regards, Praveen
--
Mark Diggory
Software Developer
Harvard MIT Data Center
http://www.hmdc.harvard.edu
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: how to customize HTTPSession

2003-11-23 Thread ppalavilli
Thanks Mark - the problem with using HTTPSessionBindingListener is that the unbound 
event is not triggered unless someone calls the session.removeAttribute() or 
session.setAttribute(name, null). So there is no way for me to set the cookie from the 
unbound() event without explicitly calling one of the above 2 methods, which ofcourse 
is not possible in real world. Please correct me if I am wrong.

I think what I should be looking for is a way to attach a listener to the HTTPRequest 
itself, which the HTTPRequest can notify corresponding to an attribute when it is set 
in the request using the request.setAttribute() method and when it is removed either 
using the request.removeAttribute() method or when the HTTPRequest itself unbinds the 
attribute when it is done processing a request.

thanks
Praveen


Mark R. Diggory [EMAIL PROTECTED] wrote:

You might look into implementing the
javax.servlet.hhtp.HttpSessionBindingListener interface, this will allow
you to act when an object is added/removed from the session. Simply put, 
you could write valueBound/UnBound methods that set Cookies into the 
HttpResponse.

-Mark

[EMAIL PROTECTED] wrote:

 Hi,
 
 I am new to the java webapp development. I want to store some user
 data for my app in a client side cookie rather than as a server side
 object and referencing it with a sessionId. One of the main reasons
 for that is - we will be running multiple servers load balancing.
 Since the HTTPSessions are java container instance specific - I don't
 want to use them. I have read about distributed Session support - but
 it does involve complicated setup and seems to be a overkill when
 compared to the data that I want to store.
 
 Anyway - in that aspect - I have these 2 questions :
 
 1. Is there a way to override the HTTPSession and HTTPResponse
 provided by tomcat to save the contents of the Session as a cookie
 instead of just storing the sessionId ?
 
 2. If I implement my own Session class, and store it as a attribute
 in the HTTPRequest object, how can I write the contents of the
 session as a cookie right before I return the response ? The way I
 used to do it in other apps in C++ is to write a destructor for my
 session object, which will get called when the request is being
 terminated and I could write the cookie in the response. But the java
 equivalent to destructor finalize() is not gauranteed to be called
 until the GC wakes up. So how can I make sure I set the cookie after
 the request is completely processed?
 
 Please pardon my ignorance if made any wrong assumptions. I would
 appreciate any help. regards, Praveen
 
-- 
Mark Diggory
Software Developer
Harvard MIT Data Center
http://www.hmdc.harvard.edu

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



__
McAfee VirusScan Online from the Netscape Network.
Comprehensive protection for your entire computer. Get your free trial today!
http://channels.netscape.com/ns/computing/mcafee/index.jsp?promo=393397

Get AOL Instant Messenger 5.1 free of charge.  Download Now!
http://aim.aol.com/aimnew/Aim/register.adp?promo=380455

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



HTTP 404 response for directory listing

2003-11-23 Thread Atreya Basu
Hi,

I've been tackling this problem since September, I'm hoping someone can 
shed some light here.

I want a directory listing of my files e.g; 
http://www.somesite.com/directory/ --outputs a dir listing. 
I am using mod_jk2 with Apache 2.0.4x. 
If I comment out the LoadModule mod_jk2 I can get a directory listing.  
But if not, I get a 404 error in Apache and then I get a 404 error page 
generated by Tomcat.

I am using Tomcat 4.1.

Could someone please help me?

Thanks.

--

Developer
Greenfield Research Inc.
atreya(AT)greenfieldresearch(DOT)ca
(902)422-9426


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


HELP_About_tomcat4_mod_jk_apache_clustering

2003-11-23 Thread Ingmars Rubenis
Hello!

I have 3 tomcat instances on 1 computer.
I use tomcat 4.1.24 with mod_jk2 and apache 2.40

I have used clustering. It did not help.
(http://www.apache.org/~fhanik/ ,
http://www.javagroups.com/javagroupsnew/docs/papers.html).
Does anybody knows good clustering mechanism which works on tomcat
4.1.24
I have session problem . One time there is one session another time
theres is another from other tomcat, third time from tomcat3.
Does anybody has solution how to solve this on 1 machine?

 Thanks in advance!

 Best wishes Ingmars Rubenis



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: how to customize HTTPSession

2003-11-23 Thread Tim Funk
With the functionality you desire, stay away from the Session classes as 
defined in the servlet API. Any developer will be greatly confused if they 
try to read your code created by your description below since you are mixing 
well known terminology and assumptions.

Instead, look into Filters and HttpServletRequestWrapper and 
HttpServletResponse wrapper.

Ideally, you'd create some helper classes which do the gets and sets on the 
servletrequests and responses. How they get instantiated is up to you.

-Tim

[EMAIL PROTECTED] wrote:
Hi,

I am new to the java webapp development. I want to store some user data for my app in a client side cookie rather than as a server side object and referencing it with a sessionId. One of the main reasons for that is - we will be running multiple servers load balancing. Since the HTTPSessions are java container instance specific - I don't want to use them. I have read about distributed Session support - but it does involve complicated setup and seems to be a overkill when compared to the data that I want to store.

Anyway - in that aspect - I have these 2 questions :

1. Is there a way to override the HTTPSession and HTTPResponse provided by tomcat to save the contents of the Session as a cookie instead of just storing the sessionId ? 

2. If I implement my own Session class, and store it as a attribute in the HTTPRequest object, how can I write the contents of the session as a cookie right before I return the response ? The way I used to do it in other apps in C++ is to write a destructor for my session object, which will get called when the request is being terminated and I could write the cookie in the response. But the java equivalent to destructor finalize() is not gauranteed to be called until the GC wakes up. So how can I make sure I set the cookie after the request is completely processed?



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Tomcat cannot fine java classes

2003-11-23 Thread Werner Daum
Hi,

I have the following problem with tomcat 4.1.27:  my java classes cannot 
be found. When I request a JSP which uses a java class, I get messages 
like this:

File not found: 
'http://134.xxx.yyy.zzz:8080/learnweb/servlet/learnweb.module.admin.userinterface.web.AdminGroupServlet'

In this case the class name is AdminGroupServlet and the corresponding 
class file it is located in the directory 
/data/htdocs/learnweb/jakarta-tomcat-4.1.27/webapps/learnweb/WEB-INF/classes/learnweb/module/admin/userinterface/web, 
however tomcat doesn't seem to resolve the above URL correcotly.

I tried to request example JSPs which came with tomcat (in 
webapps/examples), and they worked, howewer I had no success with my own 
classes. When I call startup.sh, I get the following messages:

Using CATALINA_BASE:   /data/htdocs/learnweb/jakarta-tomcat-4.1.27
Using CATALINA_HOME:   /data/htdocs/learnweb/jakarta-tomcat-4.1.27
Using CATALINA_TMPDIR: /data/htdocs/learnweb/jakarta-tomcat-4.1.27/temp
Using JAVA_HOME:   /usr/local/j2sdk1.4.2_02
Using CLASSPATH: 
/usr/local/j2sdk1.4.2_02/lib/tools.jar:/data/htdocs/learnweb/jakarta-tomcat-4.1.27/bin/bootstrap.jar

I tried to add the path to my classes to CLASSPATH in catalina.sh, but 
after that I could not use tomcat at all. Any ideas, what I am doing wrong?

Thanks in advance,
Werner Daum


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Apache Tomcat connector FAQ admin?

2003-11-23 Thread Oscar Carrillo
Hi,

I have to move my tutorial listed on the Apache Tomcat Connector FAQ page.

I'm wondering who I should contact. I couldn't find the contact info on
the FAQ. I guess it's not Frequent enough:) I believe I remember Tim
Funk starting it, but maybe it's changed now. I don't have a new URL yet,
but will shortly. Just wanted to get a contact so it doesn't have down
time.

An email or web page that has the contact info would be great.

Thanks so much,
Oscar Carrillo
http://daydream.stanford.edu/tomcat/install_web_services.html


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: shared object cache

2003-11-23 Thread Christopher Schultz
Rob,

I have written a PersistenceManager class that handles all database
access and uses the SQLData interface to map java objects to
User Defined Types in the oracle database. Every request now
has to create a new instance of the persistencemanager so there is
no sharing whatsoever. I would like the persistencemanager to look
in the object cache first and if the object is not there retrieve it
from the database. I need a way to keep this cache in memory
so all requests can use the same cache.
I would do two things:

1) Put your PersistenceManager in the application scope, and re-use it 
all the time instead of doing new PersistenceManager for every request.

2) Have your PersistenceManager do its own cachine. One of my favorite 
object caching techniques is to simply use a java.util.WeakHashMap. The 
WeakHashMap works with WeakReferences, so you can fill it with data, and 
the GC will purge some of it for you if it needs some memory back.

It works just like any other Map, except that you aren't guarenteed to 
get your object back, later :)

This may sound sketchy, but it's a pretty good cache because it works 
the same all the time: if you have a cache miss, you go to the database.

Don't forget that caches are complicated: when data changes, you have to 
make sure that the cache gets updated. If you have multiple clients and 
a single database, this gets to be a real nightmare. Only cache things 
that don't need to be sync'd up-to-the-minute. For those things, 
*always* go back to the db.

-chris

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: Starting Tomcat as nobody...

2003-11-23 Thread Christopher Schultz
Tim,

% sudo -u nobody /path/to/startup.sh

This seems to work. Pros, Cons?
I don't have a ton of experience with sudo, but it seems like a good 
idea -- you can lock down the operations that a user is capable of 
doing, etc.

I have production machines that startup tomcat on boot, and I have 
something like this in the startup scripts:

su vch -p -c /usr/local/tomcat/startup.sh

Hope that helps a bit.

-chris

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


lame,encoding problem

2003-11-23 Thread bwasko
Hi
I have a strange problem. 
On my jsp pages use utf-8 encoding. Because of problems in my struts application I use 
the tomcat-example-encoding-filter and set it in web.xml to utf-8 and to processing 
all requests . It works , tomcat starts normally . When I submit a form i can get the 
request parameters properly encoded and properly write them with for example 
System.out.print().
But then when I do something with these parameters and my mysql database I get then 
them wrong encoded and all data read from mysql are wrong encoded .
What is wrong???
I use MS Windows XP and tomcat 4.1.29
My Locale is pl_PL.
Cheers Bartek Wako

Re: connect tomcat5.0.14 and oracle8i server problem

2003-11-23 Thread Christopher Schultz
I have install sucess fully tomcat5.0.14
and oracle8i server. but when I am going to connect
those two there was a problem (exception).
You have omitted the most important part of this question: the stack 
trace. Please submit that and we'll take a look.

-chris

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: Tomcat and Servlet Debugging

2003-11-23 Thread Christopher Schultz
Simon,

Can you tell me what the following means please:-

javax.management.InstanceNotFoundException: MBeanServer cannot find MBean
with ObjectName
What's the log message immediately before this? The log file usually 
says something like:

ServerLifecycleListener: Creating MBean for [Some Resource Section] 
fully.qualified.ClassName
javax.management.InstanceNotFoundException: MBeanServer cannot find 
MBean with ObjectName

This happened to me when I was using Tomcat 4.1.27 and 4.1.29 with a 
DataSourceRealm. I had to hand-edit the mbeans-descriptors.xml to 
include an MBean definition for the DataSourceRealm. :(

-chris

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: Workers.properties for 4.1.29

2003-11-23 Thread Christopher Schultz
Roeland,
does one exist and where can I get a example?

The version for 3.x has huge differences and my Tomcat 4.1.29 does not have
one (contrary to all the dox). I'm also following the IIS HOW-TO and finding
huge descrepencies.
The workers.properties file has more to do with the connector that you 
use to hook Apache (or some other web server) to Tomcat than with the 
version of Tomcat itself.

Check the version of the mod_jk/mod_jk2/mod_webapp, etc. that you are 
using for an example.

-chris

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: IIS is not supported in Tomcat 4.1.29.

2003-11-23 Thread Christopher Schultz
Roeland,

From an unrelated thread:

  You don't pretend to win the coveted Whiner Of The Month award
  with this, I hope. There's a lot of competition, you know.
I think this post gets my vote for this coveted award. Everyone: you 
have only 7 days left to submit your entries!

There are three section to this email; 
'General Complaints', 'IIS HOW-TO', and 'Workers HOW-TO'.
No, you have one section: complaining about everything. I mistakenly 
read the whole post, thinking that there woud, in fact, be an IIS 
HOWTO and Workers HOWTO contained somewhere within. Alas, there was not.

General complaints: (in no particular order)
I recognize that there are shortcomings in the documentation. You do 
realize that pretty much nobody gets paid to write this stuff, right? If 
you have spent a significant amount of time figuring something out, why 
not help out with the project and submit either a replacement document 
for IIS/Tomcat or a patch to any existing documentation?

IIS HOW-TO:

1) Obviously, all references to Workers HOW-TO
point to a defective document, as shown in the
section on the workers HOW-TO.

 [snip]

 Workers HOW-TO:

 This was obviously written for Tomcat 3 and never
 updated for Tomcat 4.1.29.
Do you mean this HOWTO:

http://jakarta.apache.org/tomcat/tomcat-4.1-doc/jk2/jk/iishowto.html

??

It specifically mentions the changes since Tomcat 3.3 (with respect to 
4.x and 5.x). Here's an example:


The ajp12  has been deprecated  with Tomcat 3.3.x and you should use 
instead ajp13  which is the only ajp protocol known by Tomcat 4.0.x, 
4.1.x and 5.

Of course Tomcat 3.2.x and 3.3.x also support ajp13 protocol.

 [I can't figure out workers, and I find the workers HOWTO to be
 worthless. By the way, what is a worker?]
I find that this document is very helpful for these types of questions:

http://jakarta.apache.org/tomcat/tomcat-4.1-doc/jk2/jk/workershowto.html

It explains pretty much every line of the workers.properties file.

 I hit 10 errors and
stopped logging. These indicate huge problems and
this document should have never been included in
the Tomcat 4.1.29 release. Not even as a guidline.
It is more misleading than useful.
I think it's a better guideline that the source code for the connector, 
don't you think?

1) Completely skips the obvious first steps: -
From the Worker HOWTO referenced eariler:


worker.list =a comma separated list of worker names

There's even an example!

Step 2:


After defining the workers you can also specify properties for them. 
Properties can be specified in the following manner:

worker.worker name.property=property value

(Before I go on, I'll mention that there's a complete example 
workers.prperties file included in the Worker HOWTO.

2) Introduction is completely accurate yet,
completely inadequate. What is the relationship of
a worker instance to a URL?
There is none. You have to map these yourself. You do this in the 
configuration for your specific web server. Check the IIS Howto 
(mentioned previously):


Adding a context to the ISAPI redirector is simple, all you need to do 
is to edit your uriworkermap.properties and to add a line that looks like:

/context/*=worker_name

 What is a Tomcat context?

You're kidding, right? You're trying to couple IIS to Tomcat and you 
need a Context tutorial?

Where is the referal to a document that
can explain these things ( the file Tomcat: A
Minimalistic User's Guide, is not found)?
RTFM: http://jakarta.apache.org/tomcat

4) Workers Type is almost meaningless in light
of item 3. Sometimes, stating the obvious, at
least once, is a good thing.
How about this for obvious: (from the Workers HOWTO)


worker . worker name . type =worker type Where worker name is the name 
assigned to the worker and the worker type is one of the four types 
defined in the table (a worker name may not contain any space (a good 
naming convention for queue named should follow the Java variable naming 
rules).

# Defines a worker named local that uses the ajpv12 protocol to
# forward requests to a Tomcat process.
worker.local.type=ajp12
# Defines a worker named remote that uses the ajpv13 protocol to
# forward requests to a Tomcat process.
worker.remote.type=ajp13
# Defines a worker named fast that uses JNI to forward requests to
# a Tomcat process.
worker.fast.type=jni
# Defines a worker named loadbalancer that loadbalances several
# Tomcat processes transparently.
worker.loadbalancer.type=lb

Looks pretty straightforward to me. Which style of connector do you want 
to use? JNI? LoadBalanced? Not sure? Well, remember back in the IIS HOWTO:


Who support ajp protocols ?
The ajp12 protocol is only available in Tomcat 3.2.x and 3.3.x.

The ajp12 has been deprecated with Tomcat 3.3.x and you should use 
instead ajp13 which is the only ajp protocol known by Tomcat 4.0.x, 
4.1.x and 5.

Of course Tomcat 3.2.x and 3.3.x also support ajp13 protocol.

That sounds like a great case for using the ajp13 type.


5) Setting Worker Properties Same 

Re: how to customize HTTPSession

2003-11-23 Thread Christopher Schultz
Tim,

With the functionality you desire, stay away from the Session classes as 
defined in the servlet API.
I completely agree.

Instead, look into Filters and HttpServletRequestWrapper and 
HttpServletResponse wrapper.

Ideally, you'd create some helper classes which do the gets and sets on 
the servletrequests and responses. How they get instantiated is up to you.
Yeah, the filter is the way to go. A Filter gets to execute both before 
and after your application code handles the request.

You can do some clever things like gather all the cookies from a request 
that match a certain pattern (regexp), convert them to objects, and 
shove them into request attribute (or perhaps a Map of name-value, with 
the whole map in the request). Then, have your app code handle the request.

After your app code executes, look for an attribute in the request 
(since response objects, unfortunately for your, can't have attributes) 
that should be converted back into cookies.

Let me know if you need some sample code. This seems interesting enough 
that I'd be willing to bang some simple stuff out for you :)

-chris

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: HTTP 404 response for directory listing

2003-11-23 Thread Christopher Schultz
Atreya,

I want a directory listing of my files.

I am using 
mod_jk2 with Apache 2.0.4x. If I comment out the LoadModule mod_jk2 I 
can get a directory listing.  But if not, I get a 404 error in Apache 
and then I get a 404 error page generated by Tomcat.
It looks like Tomcat is handling the request for the directory and 
refusing to generate a listing for you. I know that both Apache and 
Tomcat are both capable of doing this.

Why one would you prefer to generate the list for you? I'm a fan of 
Apache handling everything that it can, and only having Tomcat run my 
application code. In that case, you'll want to reduce the range of URLs 
that Apache forwards to Tomcat via JkMount directives in httpd.conf (or 
whatever you include into httpd.conf).

For example, instead of:

JkMount /myApp myWorker

Consider:

JkMount /myApp/*.jsp myWorker
JkMount /myApp/myServlet myWorker
JkMount /myApp/myOtherServlet myWorker
With this reduces URL space mapped to Tomcat, Apache will serve the 
directory listings.

-chris

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: HTTP 404 response for directory listing

2003-11-23 Thread Atreya Basu
That's the weird part.

My workers2.properties uri directive is just for .jsps.  It is as follows:

[uri:www.mysite.com/*.jsp]
group=ajp13:/usr/local/apache2/logs/jk2.socket
So I'm not sure why directory requests get forwarded to Tomcat.

Christopher Schultz wrote:

Atreya,

I want a directory listing of my files.


I am using mod_jk2 with Apache 2.0.4x. If I comment out the 
LoadModule mod_jk2 I can get a directory listing.  But if not, I get 
a 404 error in Apache and then I get a 404 error page generated by 
Tomcat.


It looks like Tomcat is handling the request for the directory and 
refusing to generate a listing for you. I know that both Apache and 
Tomcat are both capable of doing this.

Why one would you prefer to generate the list for you? I'm a fan of 
Apache handling everything that it can, and only having Tomcat run my 
application code. In that case, you'll want to reduce the range of 
URLs that Apache forwards to Tomcat via JkMount directives in 
httpd.conf (or whatever you include into httpd.conf).

For example, instead of:

JkMount /myApp myWorker

Consider:

JkMount /myApp/*.jsp myWorker
JkMount /myApp/myServlet myWorker
JkMount /myApp/myOtherServlet myWorker
With this reduces URL space mapped to Tomcat, Apache will serve the 
directory listings.

-chris

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

--

Developer
Greenfield Research Inc.
atreya(AT)greenfieldresearch(DOT)ca
(902)422-9426


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: lame,encoding problem

2003-11-23 Thread Christopher Schultz
Bartek,

But then when I do something with these
parameters and my mysql database I get then them wrong encoded and
all data read from mysql are wrong encoded .
Hmmm... if you use your Java code to insert some text into the DB, does 
it look okay when you read it back out using the mysql command-line 
tool? I'm wondering if the characters are being mangled on the way into 
of out of the database.

See... the UTF-8 encoding only comes into play when converting bytes 
from the request into Strings on which your Java code operates. Once 
you're in the Java world, everything should be okay. Again, when you 
write the data back out to the response, the UTF-8 comes into play as well.

However, when writing to the db, the strings also need to be converted 
to bytes by some character encoding. It's very possible that either the 
VM and/or MySQL are using incompatible character sets. Check to see what 
the value of the system property file.encoding is at runtime.

Then again... unless you really are using multibyte characters, you 
should be okay no matter what. The MySQL JDBC driver should be using the 
same encoding going both to and from the db. But, if it's an encoding 
that doesn't understand multibyte characters (like ISO-8859-1), then you 
might be permanently damaging those characters. Though I use MySQL/Java 
all the time, I'm not sure how to set the character encoding for the 
JDBC driver. Check the MySQL documentation, and let us know what you find.

Hope that helps,
-chris


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: Tomcat cannot fine java classes

2003-11-23 Thread Christopher Schultz
Werner,
I have the following problem with tomcat 4.1.27:  my java classes
cannot be found. When I request a JSP which uses a java class, I get
messages like this:
File not found:

'http://134.xxx.yyy.zzz:8080/learnweb/servlet/learnweb.module.admin.userinterface.web.AdminGroupServlet'

Can you post the relevant parts of your JSP file? Please include any %@
page include=... % sections that you have.
-chris

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: HTTP 404 response for directory listing

2003-11-23 Thread Christopher Schultz
Atreya,
That's the weird part.

My workers2.properties uri directive is just for .jsps.  It is as follows:

[uri:www.mysite.com/*.jsp]
group=ajp13:/usr/local/apache2/logs/jk2.socket
So I'm not sure why directory requests get forwarded to Tomcat.
Hmmm.. that *is* odd.

And you say that if you disable loading of the module altogether, it works?

What if you disable that single reclaration above? Is it possible that 
you have a more general declaration elsewhere in the workers2.properties 
file?

I don't have much experience with mod_jk2. Do you put anything in 
httpd.conf, or is it just a reference to the workers2.properties that 
mod_jk2 handles all by itself?

-chris

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: lame,encoding problem

2003-11-23 Thread David OBrien
The sun JDK 1.4.2 release mucks encoding up...
I went back to 1.4.1 and all was fine.
-Dave


At 07:45 PM 11/23/2003, bwasko wrote:
Hi
I have a strange problem.
On my jsp pages use utf-8 encoding. Because of problems in my struts 
application I use the tomcat-example-encoding-filter and set it in web.xml 
to utf-8 and to processing all requests . It works , tomcat starts 
normally . When I submit a form i can get the request parameters properly 
encoded and properly write them with for example System.out.print().
But then when I do something with these parameters and my mysql database I 
get then them wrong encoded and all data read from mysql are wrong encoded .
What is wrong???
I use MS Windows XP and tomcat 4.1.29
My Locale is pl_PL.
Cheers Bartek Wa¶ko


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: httpd 500s without tomcat 500s

2003-11-23 Thread Bill Barker

J D [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 I see quite a few httpd 500s in the httpd access.logs without
corresponding
 entries in the tomcat access.log. I am using Apache 2.0.42, mod_jk2, and
 Tomcat 4.1.24.

 Any suggestions on how I can debug these?


A lot of these are simply the user hitting the stop button before the page
is fully loaded.  With mod_jk, these are logged with whatever status code
Tomcat sent back.  In mod_jk2, these are logged as 500 errors.

This is one of the reasons I don't use mod_jk2 myself.


 Thanks

 _
 Groove on the latest from the hot new rock groups!  Get downloads, videos,
 and more here.  http://special.msn.com/entertainment/wiredformusic.armx




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: lame,encoding problem

2003-11-23 Thread Christopher Schultz
David,
The sun JDK 1.4.2 release mucks encoding up...
I went back to 1.4.1 and all was fine.
How does JDK 1.4.2 muck up the encoding? I'm using 1.4.2, my 
file.encoding appears to be UTF-8, and I have no problem with any of 
the text that I store in my MySQL database.

-chris

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


tomcat start and stopping

2003-11-23 Thread Tom Bartos
 
 
Does anyone have any scripts to start and stop tomcat during system boot
and shutdown?
 
Environment Solaris 8 sparc
Tomcat 4.1.29
Apache 1.3
 
Thanks
-Tom


Re: Severity less - DBCP not closing connection.

2003-11-23 Thread Antony Paul
Thanks a lot for the info.
I need more explanation. I thought that Tomcat creates a new thread to
serve the new request and continues execution of the current servlet thread
after a forward() or redirect(). Now you mean that only after the forward()
method is completed the control returns to the calling servlet.. If the
servlet to which it is forwareded takes lot of time to complete then what
will happen ?. This is not mentioned in any articles or books that I have
read.

Antony Paul.

- Original Message -
From: Christopher Schultz [EMAIL PROTECTED]
To: Tomcat Users List [EMAIL PROTECTED]
Sent: Friday, November 21, 2003 7:12 PM
Subject: Re: Severity less - DBCP not closing connection.


 Antony,
  I have seen DBCP not closing a connection if the request is
forwarded to
  same page in the try block before the request is forwarded. With
  sendRedirect no problem.

 If you execute a forward, then it acts just like a method call -- your
 connection will still be absent from the pool. When you forward, you
 exit your try/catch block before the browser makes the next request.

 You have to do your code like this:

 try
 {
 conn = ...;
 }
 catch (...)
 {
 }
 finally
 {
 conn.close();
 }

 requestDispatcher.forward(...);
 

 Otherwise you might deadlock your application.

  I work with one connection to test for connection leak and any
bottlenecks
  in code.

 This is a very good idea.

   It works fine if I put the forward() after the end of finally
  block. I want to know whether it is bug or config error or Tomcat
behaves
  so.

 This is a logic error - not a Tomcat bug or config error. You just have
 to write more careful code.

 -chris


 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: HTTP 404 response for directory listing

2003-11-23 Thread Atreya Basu
Hi,

In terms of URI directives that is the only one.  I don't have a 
specific directive in httpd.conf to include workers2.properties, that 
file gets loaded automatically when I load the jk2 module.
Also I don't have any JkMount directives in my httpd.conf file.

I wonder if anyone is able to reproduce this problem.

I am running RH 9 using jk2 and unix sockets.  Apache 2.0.47 and some 
version of Tomcat 4.1.

Maybe there is something wrong with the way mod_jk2 was compiled...?

Christopher Schultz wrote:

Hmmm.. that *is* odd.

And you say that if you disable loading of the module altogether, it 
works?

What if you disable that single reclaration above? Is it possible that 
you have a more general declaration elsewhere in the 
workers2.properties file?

I don't have much experience with mod_jk2. Do you put anything in 
httpd.conf, or is it just a reference to the workers2.properties that 
mod_jk2 handles all by itself?

-chris

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

--

Developer
Greenfield Research Inc.
atreya(AT)greenfieldresearch(DOT)ca
(902)422-9426


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


ScriptAlias equivalent in tomcat

2003-11-23 Thread Yochi Toledano
Hi,

I'm running tomcat version 4.X on HPUX system as a standalone server. I have read 
the CGI howto for tomcat and I have enabled CGI capability on the server.

My question is - How can I define additional directory that contains CGI scripts 
other than the default one that comes with the configuration.

On apache I would say something like:

ScriptAlias cgi-bin/myscripts /usr/local/myscript to link /usr/local/myscript to 
the cgi-bin/myscripts directive. How can this be done under tomcat?

Thanks in advance.

Yochy Toledano



Servlet Response Wrapper not able to get JSP data: how to control flush?

2003-11-23 Thread Vincent Chain
I thought I should not be the only one with this issue, but I searched the tomcat-user 
and tomcat-dev mailing lists and could not find a good answer. There are some changes 
made between tomcat4.0.4 and tomcat4.1.18 and I can see the exact discussions on the 
tomcat-dev list (under the thread Costin: reverted the fix), but I did not see an 
answer to as how this should work. Forgive me if I missed some obvious answers. Here 
is my issue
 
I have a Servlet 2.3 filter that encodes all jsp output. It works fine in tomcat 4.0.4 
and not any more if I move to tomcat 4.1.18 (I did not try earlier 4.1.x versions 
though, I tried 4.1.29 and the problem remains). My filter does this in a very typical 
way:
 
* before calling filterchain.doFilter it creates a response wrapper
* the response wrapper will return a outpustream/writer wrapper for wrapped 
servlet/jsp to use
* after filterchain.doFilter returns, the filter gets data out and do the encoding. 
then it writes the encoded data to the 'real' response (the response passed to it)
 
The problem is the implementation of PageContextImpl.release() has changed. Previously 
it will call flush() but now it calls flushBuffer(). the latter does not flush data to 
my OutputStream/Writer wrapper so when the filterchain.doFilter returns from the jsp 
service, I could not get the result of the jsp. I could not get handle of the 
JspWriter that was used in the jsp page to force a flush since that is not in my 
scope. 
 
I could surely add a 
 
out.flush() 
 
in every jsp i wrote, but that seems too ugly to me, and it does not feel quite right 
either.
 
Here is the comment put into PageContextImp.release()
 

// Do not flush the buffer even if we're not included (i.e.
// we are the main page. The servlet will flush it and close
// the stream.

 
However, since my fitler don't reference the jsp servlet I don't see how I could force 
the flush and close the stream. I see a followup email talking about 
 
* automatically generating out.flush at the end of the java code for a jsp
* implement a partial flush
 
And I could not see anything following up that.
 
I read the Sun servlet spec, and I could not see a clear definition on this. It seems 
with the wrapper, the sense of 'commit' is not what it meant to be previously: in this 
case, I do want the data to be flushed (committed) but it has nothing to do with 
flushing data to the end user.
 
I tried some popular CompressionFilter implementations and they fail on tomcat4.1.18 
for the same reasons. So what is the recommendation?
 
Thanks a lot
 
Vincent


-
Do you Yahoo!?
Free Pop-Up Blocker - Get it now

Re: Apache 2, Tomcat 5, and JK2.

2003-11-23 Thread John Bell
Hi,

Can anyone point me to a how-to please.

Regards,

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Production Issues

2003-11-23 Thread Arnab Chakravarty
Hi,

What do you use to balance the load between the apaches ?

-We are using the mod_jk to load balance between apaches. The load is not high during 
the other week days but only twice in a week.

Some things you have to keep in mind:
- mod_jk isn't perfect in balancing the load for one Apache
 The workers don't know enough of each other to do a good job.
- mod_jk is even worse in doing a good job in balancing the load
  on seperate apaches on different machines. The worker know even 
  less (or nothing) about the other workers in the other apache 
  instances.

-First of all, I need to know what are you basing your thoughts/conclusions on ? I 
need more details on why it isn't good enough. 

-How can we inform the each worker about other workers. It seems we need also the 
amount of sessions logged on each tomcats during this time. Any way to find this bare 
minimal changes, say with a jsp page ?

Do you use sticky sessions ?
When you see high load on the 2 instances do they have a proportional
number of sessions (or is each sessions causing more load than usual) ?

-Yes, we are using sticky sessions. Yes the 2 instances are proportional (not from the 
session count, but from the database connections each has and both are observed above 
400 connections)and other instances are cool enough this time. But, apache reach their 
max client connections and other tomcats are sitting their with not much load and 
seems that this load is directed to the already clogged up tomcats (Just a thought, 
not sure!!!) and site does not respond well under these conditions and lead us to kill 
these specific tomcats with high thread counts.

But my point is why direct all the load to a specific tomcat and not distribute it 
evenly ? Then, what worth is the load balancer for. This is not understood well from 
the load balancer settings or either mod_jk is not intelligent at all or better make 
it intelligent / replace it.

Comments???

Arnab Chakravarty

 -Original Message-
 From: Arnab Chakravarty [mailto:[EMAIL PROTECTED]
 Sent: Thursday, November 13, 2003 10:07 PM
 To: [EMAIL PROTECTED]
 Cc: [EMAIL PROTECTED]
 Subject: Production Issues
 
 
 4 Solaris boxes - Each Box has 1 Apache - 3 Tomcats making 4 
 apaches and 12 tomcats in all. Please see the enclosed image.
 Problem: On a given day of a week, there is lot load on 2 
 tomcats 4_3 and 1_1 and in this sequence. The load balancer 
 setting provided in the worker.properties is:
 For Apache 1 - 4_3, 4_2, , 1_2, 1_1 
 For Apache 2 - 1_1, 1_2, , 4_2, 4_3 
 For Apache 3 - 4_3, 4_2, , 1_2, 1_1 
 For Apache 4 - 1_1, 1_2, , 4_2, 4_3 

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]