Fastest method to serve dynamic java content

2009-02-16 Thread keenny

Hello all,

I'm currently working on a system that must be able to serve thousands of
requests per sec. The requests/responses contains only small amounts of data
(ajax XMLHTTPRequests) and are not long lived (connection keep). I'm using
java to generate the responses. Static content are served separately (by
lighttpd). I was just wondering if anybody has any opinions as to how this
can be done most effectively (highest throughput, low cpu consumption etc).
Some alternatives being:

lighttpd - mod_proxy - tomcat - application code
lighttpd - fastcgi - application code
tomcat - application code
asyncweb/mina - application code
-- 
View this message in context: 
http://www.nabble.com/Fastest-method-to-serve-dynamic-java-content-tp22034617p22034617.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: Deploying to a subfolder

2009-02-16 Thread mkalioby

I know it is late but I faced the same problem in Linux and successfully
solve it.

The WAR was deploying correctly at the first time and then when i restart
the server it didn't deploy again,

I SOLVED this by 

Deleting the context file in TOMCAT_HOME/conf/Catalina/localhost/APPNAME.xml
before the starting the server so that TomCat see the app as new app
everytime it starts and successfully deploy it.

I wish it works with you.

regards,
Mohamed M. El-Kalioby
Research Assistant 
Nile University
Cairo, Egypt

McEahern, Mark S wrote:
 
 I'm using Tomcat 6.0.18.  I'd like to deploy an application to the
 context; e.g.,
 
   /apps/myapp
 
 Here's what I've tried:
 
 1.  Rename the war file myapp.war -- apps#myapp.war.
 
 2.  Copy apps#myapps.war to the webapps folder.
 
 3.  Start Tomcat.
 
 The app is running after the first time I start the service.  However,
 on subsequent restarts (of Tomcat), the application is not running and
 when I try to start it in the manager, I get this message:
 
   FAIL - Application at context path /apps/myapp could not be started
 
 How do I deploy an application to a context of:
 
   /apps/myapp
 
 Thanks,
 
 
 
 Mark McEahern
 Lead Architect
 Division of Public Health Informatics and Surveillance
 Wisconsin State Lab of Hygiene
 
 
 -
 To start a new topic, e-mail: users@tomcat.apache.org
 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://www.nabble.com/Deploying-to-a-subfolder-tp19799666p22034895.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: Fastest method to serve dynamic java content

2009-02-16 Thread André Warnier

keenny wrote:

Hello all,

I'm currently working on a system that must be able to serve thousands of
requests per sec. The requests/responses contains only small amounts of data
(ajax XMLHTTPRequests) and are not long lived (connection keep). I'm using
java to generate the responses. Static content are served separately (by
lighttpd). I was just wondering if anybody has any opinions as to how this
can be done most effectively (highest throughput, low cpu consumption etc).
Some alternatives being:

lighttpd - mod_proxy - tomcat - application code
lighttpd - fastcgi - application code
tomcat - application code
asyncweb/mina - application code


I would think that a key factor not mentioned above is : once your java 
application gets the actual request, how long does it take it to 
generate the response (however small the response actually is) ?


To be more explicit : you mention thousands of requests per second.  To 
server these, if generating each response takes 1 second, you would need 
thousands of processes in order just to keep up.
There is also a question of bandwidth of course, even for small amounts 
of data, thousands of requests amount to quite a bit, so to speak.



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



Re: Apache2.2 pages won't render in FireFox

2009-02-16 Thread Juha Laiho
Martin Gainty wrote:
 All-
 
 Im discovering Firefox wont render Apache2.2 served pages from 
 Apache2.2/htdoc folder
 If I rollback to Apache2 ..Apache2/htdoc Pages the same pages are rendered 
 with no error
 
 Advice?

Could be an issue with file extension - MIME-type mapping .

If you right-click on such non-rendered page, and choose View Page Info,
what do you get as Type; is it text/plain or text/html?

If you're seeing text/plain, then apparently something is not recognizing
the file extension correctly in order to map it to some MIME type.
See Apache HTTPD documentation on the various ways to set MIME types
for served documents.
-- 
..Juha

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



Re: Fastest method to serve dynamic java content

2009-02-16 Thread André Warnier

keenny wrote:

Hello all,

I'm currently working on a system that must be able to serve thousands of
requests per sec. The requests/responses contains only small amounts of data
(ajax XMLHTTPRequests) and are not long lived (connection keep). 


Whenever I see a description like the above, my immediate thought is of 
some drop-down box a la Google, with suggested values that change while 
the user is typing.  Is that the kind of thing you`re talking about ?



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



Re: Fastest method to serve dynamic java content

2009-02-16 Thread keenny



awarnier wrote:
 
 keenny wrote:
 Hello all,
 
 I'm currently working on a system that must be able to serve thousands of
 requests per sec. The requests/responses contains only small amounts of
 data
 (ajax XMLHTTPRequests) and are not long lived (connection keep). I'm
 using
 java to generate the responses. Static content are served separately (by
 lighttpd). I was just wondering if anybody has any opinions as to how
 this
 can be done most effectively (highest throughput, low cpu consumption
 etc).
 Some alternatives being:
 
 lighttpd - mod_proxy - tomcat - application code
 lighttpd - fastcgi - application code
 tomcat - application code
 asyncweb/mina - application code
 
 I would think that a key factor not mentioned above is : once your java 
 application gets the actual request, how long does it take it to 
 generate the response (however small the response actually is) ?
 
 To be more explicit : you mention thousands of requests per second.  To 
 server these, if generating each response takes 1 second, you would need 
 thousands of processes in order just to keep up.
 There is also a question of bandwidth of course, even for small amounts 
 of data, thousands of requests amount to quite a bit, so to speak.
 
 
 -
 To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
 For additional commands, e-mail: users-h...@tomcat.apache.org
 
 
 

Good points. Generating responses does take some time (several hundred ms),
but this is mainly because it involves calling other services in the cluster
(not cpu-bound that is). To avoid thousands of sleeping threads asynchronous
i/o will be used (i understand tomcat 6 has support for this?). Therefore
the overall throughput will be high, but latency not that good (however
latency is not an issue due to the application characteristics). An added
equirement for my scenario is therefore that async handeling of requests
must be used.

-- 
View this message in context: 
http://www.nabble.com/Fastest-method-to-serve-dynamic-java-content-tp22034617p22035479.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: Fastest method to serve dynamic java content

2009-02-16 Thread keenny

Not in this case, but the requirements this poses on the back-end system is
similar. As explained above, the latency will be high, but so must the
throughput.


awarnier wrote:
 
 keenny wrote:
 Hello all,
 
 I'm currently working on a system that must be able to serve thousands of
 requests per sec. The requests/responses contains only small amounts of
 data
 (ajax XMLHTTPRequests) and are not long lived (connection keep). 
 
 Whenever I see a description like the above, my immediate thought is of 
 some drop-down box a la Google, with suggested values that change while 
 the user is typing.  Is that the kind of thing you`re talking about ?
 
 
 -
 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://www.nabble.com/Fastest-method-to-serve-dynamic-java-content-tp22034617p22035537.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



LifecycleException: No UserDatabase component found under key UserDatabase by Tomcat 6

2009-02-16 Thread thomas2004

Hi all,

I used to set the global data resource in GlobalNamingResources/ in Tomcat
5 as follow:

Resource auth=Container 
driverClassName=oracle.jdbc.OracleDriver
maxActive=20 maxIdle=10 maxWait=-1 
name=jdbc/MyDataSource
password=mypwd type=javax.sql.DataSource
url=jdbc:oracle:thin:@hostname:1521:MT
username=sa /


Since I use the Tomcat6, I got problem.

I read from internet that one has to add the following code in
/conf/context.xml, 

ResourceLink name=jdbc/MyDataSource global=jdbc/MyDataSource
type=javax.sql.DataSource /

but it doesn't help and I got excpetion LifecycleException:  No
UserDatabase component found under key UserDatabase. 

I have to move the Resource/ into the Context/, so it works. But in this
way, the dataresource is not global resource anymore.

Has someone idea?
-- 
View this message in context: 
http://www.nabble.com/LifecycleException%3A--No-UserDatabase-component-found-under-key-UserDatabase-by-Tomcat-6-tp22037058p22037058.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: Starting tomcat from jar file‏ (from another service)

2009-02-16 Thread dissection

I am still waiting for reply, please help! Thanks...


Hello all, I want to make a service program for windows that runs tomcat
standalone in it. I did a win32 .exe that creates service and runs jar file
with JNI code. Firstly I made my own jar file which writes to a file with
start command and it worked. Then I used this exe with tomcat's
bootstrap.jar and I used apache/org/catalina/startup/Bootstrap as class
path. However tomcat didn't work with this. On windows command line I
started tomcat with java -jar bootstrap.jar start. and it works. However
it doesn't work from my service. I am trying to do something like
procrun(tomcat6w.exe and tomcat6.exe). I searched for procrun code but it is
not up-to-date I think. I couldn't compile it with visual studio(gives
errors).
 
So I am searching for, how I can run tomcat from jar file in my service. 
Any help appreciated !
Thanks
Fatih.

-- 
View this message in context: 
http://www.nabble.com/Starting-tomcat-from-jar-file%E2%80%8F-%28from-another-service%29-tp21998265p22037428.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: LifecycleException: No UserDatabase component found under keyUserDatabase by Tomcat 6

2009-02-16 Thread Caldarale, Charles R
 From: thomas2004 [mailto:thomas200...@yahoo.de]
 Subject: LifecycleException: No UserDatabase component found
 under keyUserDatabase by Tomcat 6

 but it doesn't help and I got excpetion LifecycleException:  No
 UserDatabase component found under key UserDatabase.

Looks like you broke the existing Resource declaration for UserDatabase when 
you added your own.  Post your complete server.xml, not just a fragment.

 - Chuck


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

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



RE: LifecycleException: No UserDatabase component found under keyUserDatabase by Tomcat 6

2009-02-16 Thread thomas2004

Hi all,

I solve the problem now.





Caldarale, Charles R wrote:
 
 From: thomas2004 [mailto:thomas200...@yahoo.de]
 Subject: LifecycleException: No UserDatabase component found
 under keyUserDatabase by Tomcat 6

 but it doesn't help and I got excpetion LifecycleException:  No
 UserDatabase component found under key UserDatabase.
 
 Looks like you broke the existing Resource declaration for UserDatabase
 when you added your own.  Post your complete server.xml, not just a
 fragment.
 
  - 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
 
 
 

-- 
View this message in context: 
http://www.nabble.com/Problem-by-setting-%3CResources-%3E-in-%3CGlobalNamingResources-%3E-from-Tomcat-6-tp22037058p22038707.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: LifecycleException: No UserDatabase component found under keyUserDatabase by Tomcat 6

2009-02-16 Thread Pieter Temmerman
Would you mind telling us the solution?


-Mensaje original-
De: thomas2004 [mailto:thomas200...@yahoo.de]
Enviado el: lun 16/02/2009 15:55
Para: users@tomcat.apache.org
Asunto: RE: LifecycleException:  No UserDatabase component found under 
keyUserDatabase by Tomcat 6
 

Hi all,

I solve the problem now.





Caldarale, Charles R wrote:
 
 From: thomas2004 [mailto:thomas200...@yahoo.de]
 Subject: LifecycleException: No UserDatabase component found
 under keyUserDatabase by Tomcat 6

 but it doesn't help and I got excpetion LifecycleException:  No
 UserDatabase component found under key UserDatabase.
 
 Looks like you broke the existing Resource declaration for UserDatabase
 when you added your own.  Post your complete server.xml, not just a
 fragment.
 
  - 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
 
 
 

-- 
View this message in context: 
http://www.nabble.com/Problem-by-setting-%3CResources-%3E-in-%3CGlobalNamingResources-%3E-from-Tomcat-6-tp22037058p22038707.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: LifecycleException: No UserDatabase component found under keyUserDatabase by Tomcat 6

2009-02-16 Thread Pieter Temmerman
Didn't see this one. Suppose that was the problem.


-Mensaje original-
De: Caldarale, Charles R [mailto:chuck.caldar...@unisys.com]
Enviado el: lun 16/02/2009 15:26
Para: Tomcat Users List
Asunto: RE: LifecycleException:  No UserDatabase component found under  
keyUserDatabase by Tomcat 6
 
 From: thomas2004 [mailto:thomas200...@yahoo.de]
 Subject: LifecycleException: No UserDatabase component found
 under keyUserDatabase by Tomcat 6

 but it doesn't help and I got excpetion LifecycleException:  No
 UserDatabase component found under key UserDatabase.

Looks like you broke the existing Resource declaration for UserDatabase when 
you added your own.  Post your complete server.xml, not just a fragment.

 - 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




Running more than one application

2009-02-16 Thread Peter Flynn
I have been running Cocoon 2.1.11 successfully on its own for some time 
in Tomcat 5.5.23 under RHEL5 with Apache httpd 2.2.3 but I now need to 
add Lucene and some other apps.


The cocoon.war was unwrapped in webapps, and the only installation mods 
I made were to add the virtual host block to Apache's httpd.conf


VirtualHost *:80
DocumentRoot /var/www/xml
ProxyPreserveHost On
ProxyPass / ajp://localhost:8009/cocoon/
ProxyPassReverse / ajp://localhost:8009/cocoon/
ServerName my.server.name
/VirtualHost

and modified the sample Host element to match in server.xml

Host name=my.server.name appBase=webapps
  unpackWARs=true autoDeploy=true
  xmlValidation=false xmlNamespaceAware=false
  Context path= docBase=/var/www/xml/
   debug=9 crossContext=true/
  Context path=/ docBase=/var/www/xml/
   debug=9 crossContext=true/
...

(This may be suboptimal /var/www/xml/ is where my XML/XSLT files are, 
but it's unclear to me if this is actually needed at this level of the 
config.)


This worked fine to test what I am doing in Cocoon, although the server 
sticks in an unwanted /cocoon/ into the URI.  Now I need to add Lucene 
and several other apps (via .war files) but I am having difficulty 
understanding how to configure Tomcat to use multiple apps.


As far as I understand it:

a) I need to make Cocoon the default app, because that's what the bulk 
of the work will run through (but I'm happy to be told this is wrong). 
Comments in the mailing lists indicate that this will also get rid of 
the intrusive /cocoon in the URIs.


b) I then add the other apps in servlet-mappings in web.xml

I deleted the ROOT directory in webapps; renamed the cocoon directory to 
ROOT; removed the /cocoon from the httpd.conf; and added this to web.xml 
(and restarted tomcat5 and httpd)


servlet-mapping
  servlet-nameCocoon/servlet-name
  url-pattern/*/url-pattern
/servlet-mapping

But accessing any URI using the virtual hostname then brought up the 
Tomcat 404 error requested resource (/what/ever) is not available.


I have obviously misunderstood something vital here, but the docs don't 
seem to address this particular configuration, and my knowledge of Java 
isn't sufficient to dig into the innards of Tomcat.


///Peter

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



Re: tomcat admin console set values

2009-02-16 Thread Srinivas Jonnalagadda
Chris,

Thank you very much for the answer. This is really a nice help.

Srinivas Jonnalagadda

-Original Message-
From: Christopher Schultz ch...@christopherschultz.net
Sent: Feb 13, 2009 6:52 PM
To: Tomcat Users List users@tomcat.apache.org
Subject: Re: tomcat admin console set values

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Srinivas,

On 2/13/2009 12:21 PM, Srinivas Jonnalagadda wrote:
 Sorry for not mentioning. I am using tomcat 5.5.9 on a solaris
 machine and 5.5.27 on a windows machine. I tried to set the JnDi
 DataSource and i was successful on 5.5.27 windows version. I already
 had the same settings in my context.xml so got a [question] regarding
 location where the values i set thru admin console of Admin web app
 are persisted. For example in a properties file.

That's exactly the point: they are NOT PERSISTED AT ALL. No properties
file. No JNDI directory. No text file. No database. It's all in memory.
When you shut down Tomcat, it's gone.

Feel free to patch it yourself, but the TC devs have completely
abandoned the admin webapp. You should stick to editing the server.xml
file by hand.

Oh, and your JNDI resources are better-off in context.xml files, anyway.

- -chris

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

iEYEARECAAYFAkmWFc4ACgkQ9CaO5/Lv0PC5XwCdEpcc+34rJoo0FKyfsYOVh16Q
72sAn3WRhLRxIEUJwBC1N5vv2uf1MFex
=TmV/
-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: Tomcat 5.0.30 - Session Storage?

2009-02-16 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Chris,

On 2/11/2009 12:07 PM, memblin wrote:
 I see the PersistenceManager + Filestore/JDBCStore as an option but I see
 certain places that PersistenceManager is experimental and does not keep
 sessions completely up to date.

Note that  Tomcat 5.0.x is no longer supported. You should upgrade to
either 5.5 or 6.0. You may find that the PersistenceManager is more
robust and/or more reliable.

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

iEYEARECAAYFAkmZ1UAACgkQ9CaO5/Lv0PDk3QCeI1c5hNM9eP/vZWiKdPzPXl6c
I/gAn3W4ibvR5GIx3uclw+6GYf5425QL
=6NCo
-END PGP SIGNATURE-

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



Re: [OT] of the different methods to get a user-id

2009-02-16 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Chuck,

On 2/12/2009 10:27 PM, Caldarale, Charles R wrote:
 From: Christopher Schultz [mailto:ch...@christopherschultz.net]
 Subject: Re: [OT] of the different methods to get a user-id

 I don't understand that, either. I suppose this works differently in
 different languages, though:

 return i++;

 return (i++);
 
 Not any that I'm aware of; the value of the i++ expression is the same, 
 regardless of the number of parentheses you wrap it in.

But sometimes the value is surprising.

For instance.

i = i++

yields different results depending on what language you are using. C and
Java produce different outputs (which really surprised me!).

 What I also don't understand is why userPrincipal is used directly
 instead of this.getUserPrincipal, which would allow some measure of
 extensibility of the class.
 
 Since the userPrincipal field is protected, not private, the subclass
 can just use it to store its Principal object, so I don't see a real
 problem.

I'm not saying it's not legal, I'm just saying it's not extensible. If a
superclass wants to override getUserPrincipal for some reason, the
subclass doesn't benefit (or doesn't work, in certain situations). Thsi
is one of the reasons I hate using protected members: members become
part of the interface, which is ... weird.

- -chris

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

iEYEARECAAYFAkmZ1jkACgkQ9CaO5/Lv0PAu7ACeKb+mqxYgZbHC8VDd+PRQAsvZ
B4MAnRYVo2/2eMA5ILWXGWvZik/2lJDo
=5EcI
-END PGP SIGNATURE-

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



Re: [OT] of the different methods to get a user-id

2009-02-16 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

André,

What the hell.. let's start a holy war?!

On 2/13/2009 10:25 AM, André Warnier wrote:
 Their merit is all the greater since
 they work in the obscure non-graphical background, they never get any of
 the attention, and they have to share machines with some Java programs,
 which means they get only the usage of a tiny fraction of the RAM and
 CPU cycles, although they do most of the real work and have to do it
 with a single thread each.

Hear, hear!

 Even some of the old-school programmers, mostly in their later years,
 succumb to the what-the-heck syndrome and come to appreciate the sense
 of security and comfort provided by strongly-typed and rigidly
 object-oriented languages

Heck, lots of folks on this list won't even use cron to schedule jobs.
Instead, they write web applications wrapped around Quartz because it's
just easier to deploy or some other such nonsense. IMHO, you either
have control of your production environment yourself (and can do
whatever you want) or you have an ops team with complete control of your
production environment (and they ought to be able to handle scary stuff
like scheduling cron jobs and running shell scripts) or you have no
control whatsoever and therefore do not have a production environment.
There, I said it. :p

On the other hand, seeing object-oriented perl really makes me queasy.

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

iEYEARECAAYFAkmZ2FIACgkQ9CaO5/Lv0PDOQgCeJno3T9D2GnoWpTFswcvInUCn
zpcAnijMpytndgIfPe6knYmum47WOj56
=QFoD
-END PGP SIGNATURE-

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



Tutorial: Load Balancing Tomcat with Apache

2009-02-16 Thread GF
Hello everyone
I wrote a tutorial about load balancing Tomcat with Apache Proxy Module.

This is the url:
http://www.zulutown.com/blog/2009/02/16/java-ee-load-balancing-with-tomcat-and-apache/
Any feedback will be really appreciated.

Thank You.

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



Re: ssl connector

2009-02-16 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Ryan,

On 2/13/2009 12:09 AM, epicwin...@hotmail.com wrote:
 The application I
 am developing uses tomcat on the back end and a swing client on the
 front with the Spring HttpInvoker.
 
 So first I got it working without apr.  After I set up the connector
 I changed it so when i ran my java client using this vm parameter 
 -Djavax.net.ssl.trustStore=keystore.jks

If you are using a self-signed certificate, I suspect you will need to
set the trustStore no matter what server-side configuration you have.

 Tomcat starts and acknowledges that apr is working without a problem.
 I thought that with apr I could just run the client without the
 trustStore parameter set.

Why?

 But i get this error: Caused by:
 javax.net.ssl.SSLHandshakeException:
 sun.security.validator.ValidatorException: PKIX path building failed:
 sun.security.provider.certpath.SunCertPathBuilderException: unable to
 find valid certification path to requested target
 
 So how do I tell the client about the cert?  I tried the
 trustStore=pathtocert but that didn't work.

What about trustStore=keystore.jks like you did above? Are you
possibly confusing what files are on the client versus which are on the
server?

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

iEYEARECAAYFAkmZ2S8ACgkQ9CaO5/Lv0PCwhACgiZNhJ4o5XwVa7xlGhko8ciWs
7F4AniQM6x4KItjPJN1RNme6Nrb0Gg4s
=A4xI
-END PGP SIGNATURE-

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



Re: accepting requests from outside the host?

2009-02-16 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Chuck,

On 2/14/2009 9:49 AM, Caldarale, Charles R wrote:
 From: Frank D. Greco [mailto:fgr...@crossroadstech.com]
 Subject: RE: accepting requests from outside the host?

 I had the Server port set to 8080
 
 ??? The port attribute in the Server element is the one Tomcat uses
 to listen for shutdown requests on 127.0.0.1; it *must not* be the same
 as the Connector port.

Strictly speaking, they can be the same port, as long as the Connector
isn't bound to 127.0.0.1. Practically speaking, they should not be the sa,e.

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

iEYEARECAAYFAkmZ2hYACgkQ9CaO5/Lv0PDAGACdF/27/+YXwbQWCV5El3bOLtAD
xsUAoIkqa0Ti9MH0Q5a0Ifs4DloORof5
=0ODR
-END PGP SIGNATURE-

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



RE: accepting requests from outside the host?

2009-02-16 Thread Caldarale, Charles R
 From: Christopher Schultz [mailto:ch...@christopherschultz.net]
 Subject: Re: accepting requests from outside the host?

 Strictly speaking, they can be the same port, as long
 as the Connector isn't bound to 127.0.0.1.

True, as long as you don't expect anything useful from pointing a browser to 
localhost:port.

 - Chuck


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

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



Re: [OT] of the different methods to get a user-id

2009-02-16 Thread Alan Chaney

Chris,

I offer my opinions here as a real grey beard (literally). I certainly 
agree with you that people should have

a breath of skills allowing them to use the right tool at the right time.

However, notwithstanding the fact that the other day I worked out that I 
have actually used about 15 different programming languages in anger 
(that is, part of code used by other people) I have to admit that my 
occasional brush with Perl has been unrewarding (for both me and the 
language...)


My biggest problem is that I've never seen a little bit of typing as a 
big issue, but reading and trying to understand something a few 
weeks/months/years later is always fraught with difficulties. The main 
problem with perl is that I can never remember exactly what #...@!$% means 
whereas something like getUserPrincipal() works for me!


Regards

Alan Chaney


Christopher Schultz wrote:

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

André,

What the hell.. let's start a holy war?!

On 2/13/2009 10:25 AM, André Warnier wrote:
  

Their merit is all the greater since
they work in the obscure non-graphical background, they never get any of
the attention, and they have to share machines with some Java programs,
which means they get only the usage of a tiny fraction of the RAM and
CPU cycles, although they do most of the real work and have to do it
with a single thread each.



Hear, hear!

  

Even some of the old-school programmers, mostly in their later years,
succumb to the what-the-heck syndrome and come to appreciate the sense
of security and comfort provided by strongly-typed and rigidly
object-oriented languages



Heck, lots of folks on this list won't even use cron to schedule jobs.
Instead, they write web applications wrapped around Quartz because it's
just easier to deploy or some other such nonsense. IMHO, you either
have control of your production environment yourself (and can do
whatever you want) or you have an ops team with complete control of your
production environment (and they ought to be able to handle scary stuff
like scheduling cron jobs and running shell scripts) or you have no
control whatsoever and therefore do not have a production environment.
There, I said it. :p

On the other hand, seeing object-oriented perl really makes me queasy.

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

iEYEARECAAYFAkmZ2FIACgkQ9CaO5/Lv0PDOQgCeJno3T9D2GnoWpTFswcvInUCn
zpcAnijMpytndgIfPe6knYmum47WOj56
=QFoD
-END PGP SIGNATURE-

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



!DSPAM:4999da4713771562881678!

  



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



Re: catalina.out

2009-02-16 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Mohit,

On 2/15/2009 11:57 AM, Mohit Anchlia wrote:
 Thanks. There doesn't seem to be mention of catalina.out. Only one
 line that it has referes to other catalina.date file that tomcat
 creates
 
 1catalina.org.apache.juli.FileHandler.prefix = catalina.

That's a different log file (something like catalina.2009-02-16.log).
Tomcat redirects standard output and standard error in catalina.sh to
catalina.out to capture any output that goes to stdout/stderr.

The configuration for this is in logging.properties, here:

java.util.logging.ConsoleHandler.level = FINE
java.util.logging.ConsoleHandler.formatter =
java.util.logging.SimpleFormatter

The ConsoleHandler writes log messages to the console (aka stdout).
This is what ends up in catalina.out.

Chuck's suggestion that Tomcat does not write to stdout is not
entirely true. Tomcat's code definitely contains portions which write
directly to System.out. Mostly, these are special situations (startup
errors, etc.). On the other hand, Tomcat makes heavy use of logging, and
comes pre-configured to write some of those logs to the console, which
is the same thing as System.out or stdout.

I hope that clears up some of the confusion.

- -chris

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

iEUEARECAAYFAkmZ3GMACgkQ9CaO5/Lv0PDVcQCVHwdTbuB9zZpphS8M3ZbExSXw
sgCfePsAG5Mw4ZcfdsqjcRLITZoEn7M=
=2ysD
-END PGP SIGNATURE-

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



Re: Resource JDBC connection pooling USING LDAP

2009-02-16 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Tim,

On 2/13/2009 5:02 PM, trames wrote:
 My goal is to NOT embed the database connection user name, password, or even
 server url like it is shown below.   I have the ApacheDS LDAP server set up,
 and would like to retrieve the credentials/server from that.

I don't believe Tomcat has anything built-in that can do that.

 Is there a way to get the entire URL string from LDAP? Is there some other
 way to do what I would like to do? Would I have to write my own Resource
 Factory?

I believe you will have to write your own ResourceFactory.

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

iEYEARECAAYFAkmZ3mQACgkQ9CaO5/Lv0PD8lQCfYaV1e3nw9xyOqxm4KGtW9/RP
f6sAn35DIZ54DC5li+bnxCowMufIeHLW
=mRq5
-END PGP SIGNATURE-

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



Re: filter debugging or logging?

2009-02-16 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Brad,

On 2/13/2009 7:34 PM, Brad Whitaker wrote:
 Is there a logger that can emit information about when servlet filters are
 invoked?

Not a logger per-se, but there is an internal event fired and can
presumably be listened-to. See the source for
java/org/apache/catalina/core/ApplicationFilterChain.java, specifically
the internalDoFilter method. You can see these two events reported:

support.fireInstanceEvent(InstanceEvent.BEFORE_FILTER_EVENT,
  filter, request, response);

...

support.fireInstanceEvent(InstanceEvent.AFTER_FILTER_EVENT,
  filter, request, response);


I'm not sure what the best way is to listen to these events.
org.apache.catalina.util.InstanceSupport is the class for the 'support'
reference above. That class has methods for registering event listeners,
but I'm not sure what the best way is to get the instance of
InstanceSupport that is being used by Tomcat. JMX might work to grab
that object from Tomcat.

 I have multiple filters
 that have been provided by 3rd party libraries and it is very difficult to
 know when they are invoked, and in what order.

They should be invoked in the order in which they are declared in
web.xml. Is this not the behavior you are observing? What version of
Tomcat are you running?

 I'd primarily
 like to know when doFilter() is invoked (along with the name of the filter).
 I think this would be enough to follow the chains.

You could write a trivial filter that does something like this:

public class OrderingFilter
 implements Filter
{
   private String _name;
   public void init(FilterConfig config)
   {
  _name = config.getInitParameter(name);
   }

   public void doFilter(ServletRequest request,
ServletResponse response,
FilterChain chain)
  throws IOException, ServletException
   {
   System.out.println(Running  + _name);

   chain.doFilter(request, response);

   System.out.println(Finished running  + _name);
   }
}

Then, configure this filter to run in between every filter you have
configured. Something like this:

Filter A
OrderingFilter[name='after A']
Filter B
OrderingFilter[name='after B']
Filter C
OrderingFilter[name='after C']
Filter D
OrderingFilter[name='after D']
Filter E
OrderingFilter[name='after E']
...

This gives you a crude yet non-invasive debugging mechanism. Just make
sure that you have all your url-mappings set up to mirror those of the
original filters.

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

iEYEARECAAYFAkmZ5QgACgkQ9CaO5/Lv0PDVFwCfYh9Mf0R6xUhi8gorM3sWnBgA
D64AoL7sBsxNRh8MNSW09vfoJ70BmjJK
=3fLv
-END PGP SIGNATURE-

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



RE: [OT] of the different methods to get a user-id

2009-02-16 Thread Caldarale, Charles R
 From: Christopher Schultz [mailto:ch...@christopherschultz.net]
 Subject: Re: [OT] of the different methods to get a user-id

 For instance.
 i = i++

 yields different results depending on what language
 you are using. C and Java produce different outputs
 (which really surprised me!).

Java explicitly defines the behavior of the above statement, whereas the C 
standard does not, and leaves it up to the implementation to decide what to do. 
 However, on almost every platform I have access to right at this moment 
(Windows, Linux, proprietary), printing the value of i after your test 
statement in both C and Java displayed the original value of i (as expected), 
not the increment thereof.  The one problematic environment that gave the 
unexpected answer was Visual C++ 6.0 on Windows (gee, Microsoft ignores 
standard practice? who would a-thunk it); gcc on Windows worked properly.

 - Chuck


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

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



Re: Tutorial: Load Balancing Tomcat with Apache

2009-02-16 Thread Ben Stringer
Hi,

Nice work on the tutorial. I have some feedback.

1) I would mention the version of the httpd and tomcat that you are using.
For instance, the load balancing mechanism you are using in httpd is only
supported by Apache Httpd 2.2

2) I don't see why you need to create a virtual host in httpd, unless you
are using the same httpdto host other sites. Otherwise, this just
complicates the httpd configuration.

Cheers, Ben

 Hello everyone
 I wrote a tutorial about load balancing Tomcat with Apache Proxy Module.

 This is the url:
 http://www.zulutown.com/blog/2009/02/16/java-ee-load-balancing-with-tomcat-and-apache/
 Any feedback will be really appreciated.

 Thank You.

 -
 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: Apache2.2 pages won't render in FireFox

2009-02-16 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Martin,

On 2/15/2009 11:13 AM, Martin Gainty wrote:
 Im discovering Firefox wont render Apache2.2 served pages from 
 Apache2.2/htdoc folder
 If I rollback to Apache2 ..Apache2/htdoc Pages the same pages are rendered 
 with no error

Not to be too cheeky, but this site seems to render just fine:

http://httpd.apache.org/

Apache2/htdoc... maybe htdocs instead?

Apache 2.2 certainly does work. Your configuration must have something
causing some weirdness. Care to share more details?

- -chris

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

iEYEARECAAYFAkmZ5ooACgkQ9CaO5/Lv0PCYCgCgwxuk7AfXKOxS5mLcZ3nz473O
uEcAn2xd5LeJzstFA/n4q/0FRInEKRNX
=d5Aw
-END PGP SIGNATURE-

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



Re: Fastest method to serve dynamic java content

2009-02-16 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Keeny,

On 2/16/2009 5:15 AM, keenny wrote:
 I'm currently working on a system that must be able to serve thousands of
 requests per sec. The requests/responses contains only small amounts of data
 (ajax XMLHTTPRequests) and are not long lived (connection keep). I'm using
 java to generate the responses. Static content are served separately (by
 lighttpd). I was just wondering if anybody has any opinions as to how this
 can be done most effectively (highest throughput, low cpu consumption etc).
 Some alternatives being:
 
 lighttpd - mod_proxy - tomcat - application code
 lighttpd - fastcgi - application code
 tomcat - application code
 asyncweb/mina - application code

I'm not sure how fastcgi would run your Java application code.

I think this all depends upon the types of requests you expect to get.

lighttpd is presumably faster than Tomcat for static content. Tomcat
itself is pretty fast as a static HTML server, so you might not want to
discount your 3rd option there. If you don't expect a lot in the way of
static content requests, then you should probably eliminate the extra
processing that will have to be done with all your dynamic requests
being forwarded through mod_proxy or some other communication channel.

Apache mina doesn't appear to be an HTTP server. I'm sure you could
re-build all that HTTP infrastructure on top of mina, but is it worth
it? The same can be said of the Servlet API. If you're starting from
scratch, the Servlet API might not be much of a concern. If you're
looking to re-deploy an existing application, you might want to consider
other options (such as mina). I think the use of XMLHttpRequest is going
to be your limiting factor because they you /must/ use HTTP for
communication.

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

iEYEARECAAYFAkmZ6N0ACgkQ9CaO5/Lv0PCTygCghkzi6Yfqkm4w4wL3RqoqpO/7
oiEAnjvJokCgtr6ggMofCtdQRQhkfA/w
=V1bm
-END PGP SIGNATURE-

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



Re: [OT] of the different methods to get a user-id

2009-02-16 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Chuck,

On 2/16/2009 5:19 PM, Caldarale, Charles R wrote:
 From: Christopher Schultz [mailto:ch...@christopherschultz.net]
 Subject: Re: [OT] of the different methods to get a user-id

 For instance.
 i = i++

 yields different results depending on what language
 you are using. C and Java produce different outputs
 (which really surprised me!).
 
 Java explicitly defines the behavior of the above statement, whereas
 the C standard does not, and leaves it up to the implementation to
 decide what to do. However, on almost every platform I have access to
 right at this moment (Windows, Linux, proprietary), printing the value
 of i after your test statement in both C and Java displayed the original
 value of i (as expected), not the increment thereof.

$ java -version
java version 1.5.0_13
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_13-b05)
Java HotSpot(TM) Client VM (build 1.5.0_13-b05, mixed mode)

$ javac PostIncrementTest.java (see below)
$ java PostIncrementTest
0
0
0
$ cc --version
gcc (GCC) 4.1.2 (Gentoo 4.1.2 p1.1)
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

$ cc -o post_increment_test post_increment_test.c  (see below)
$ ./post_increment_test
0 0 1
$

I'm not sure what to say. Here are the sources:

post_increment_test.c:
#include stdio.h

int main() {
  printf(%d %d %d\n, test1(), test2(), test3());

  return 0;
}

int test1() {
  int i = 0;

  return i++;
}

int test2() {
  int i = 0;

  return (i++);
}

int test3() {
  int i = 0;

  i = i++;

  return i;
}

PostIncrementTest.java:
public class PostIncrementTest
{
public static void main(String[] args)
{
System.out.println(test1());
System.out.println(test2());
System.out.println(test3());
}

public static int test1()
{
int i=0;

return i++;
}

public static int test2()
{
int i=0;

return (i++);
}


public static int test3()
{
int i=0;

i = i++;

return i;
}
}

 The one problematic environment that gave the unexpected answer was
 Visual C++ 6.0 on Windows (gee, Microsoft ignores standard practice?
 who would a-thunk it); gcc on Windows worked properly.

Do you mean gcc on win32 worked as you expected? As you said, C does not
define this behavior, so proper is in the eye...

- -chris

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

iEYEARECAAYFAkmZ6l4ACgkQ9CaO5/Lv0PB+RQCffUOOV9Lv6tuBfSoG1e5mcvmm
YA4AoJoFhjoMaIbxCwqe6nxyPfh7fhcX
=0Dpi
-END PGP SIGNATURE-

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



RE: [OT] of the different methods to get a user-id

2009-02-16 Thread Caldarale, Charles R
 From: Christopher Schultz [mailto:ch...@christopherschultz.net]
 Subject: Re: [OT] of the different methods to get a user-id

 Do you mean gcc on win32 worked as you expected?

Yes, it produced the same results as Java.

 - Chuck


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

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



Re: Running more than one application

2009-02-16 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Peter,

On 2/16/2009 10:29 AM, Peter Flynn wrote:
 and modified the sample Host element to match in server.xml
 
 Host name=my.server.name appBase=webapps
   unpackWARs=true autoDeploy=true
   xmlValidation=false xmlNamespaceAware=false
   Context path= docBase=/var/www/xml/
debug=9 crossContext=true/
   Context path=/ docBase=/var/www/xml/
debug=9 crossContext=true/

Yuk:

#1 Context elements are best left in META-INF/context.xml files within
each application's WAR file (or exploded WAR file).

#2 Context elements should not set their paths (except in server.xml;
please see #1)

#3 Context elements should never set the path to /, as this is
confusing to the reader and, I suspect, impossible to reach once
started. Tomcat uses Context path= for the root web application.
Context path=/ doesn't make any sense.

#4 You are deploying the same application (/var/www/xml) twice. It
doesn't sound like this is really what you want to do.

#5 It looks like you are trying to deploy the same application twice to
the ROOT context (see #3 and #4).

Please see http://tomcat.apache.org/tomcat-6.0-doc/config/context.html

 (This may be suboptimal /var/www/xml/ is where my XML/XSLT files are,
 but it's unclear to me if this is actually needed at this level of the
 config.)
 
 This worked fine to test what I am doing in Cocoon, although the server
 sticks in an unwanted /cocoon/ into the URI.  Now I need to add Lucene
 and several other apps (via .war files) but I am having difficulty
 understanding how to configure Tomcat to use multiple apps.

Let's take it one step at a time. Do you have a WAR file you are trying
to deploy, or is everything in /var/www/xml?

 As far as I understand it:
 
 a) I need to make Cocoon the default app, because that's what the bulk
 of the work will run through (but I'm happy to be told this is wrong).
 Comments in the mailing lists indicate that this will also get rid of
 the intrusive /cocoon in the URIs.

The default app is really a vague term. If you mean that the web
application hosting Cocoon should get requests to http://host/, then
that is called the ROOT web application. The ROOT webapp also gets all
requests that don't get mapped to some other webapp, too (such as
http://host/webappB/foo/bar when webappB doesn't map to a running webapp).

 b) I then add the other apps in servlet-mappings in web.xml

Application != servlet. web.xml declares and maps servlets. If you truly
have a separate application, you should have a separate WAR file or a
separate directory with all your webapp stuff.

 [stop][rewind][play]
 The cocoon.war was unwrapped in webapps
 [stop][fast-forward][play]

 I deleted the ROOT directory in webapps; renamed the cocoon directory to
 ROOT; removed the /cocoon from the httpd.conf

This is exactly what you should have done. cocoon.war will be deployed
to /cocoon. Re-naming it to ROOT.war will deploy it to /.

 and added this to web.xml
 (and restarted tomcat5 and httpd)
 
 servlet-mapping
   servlet-nameCocoon/servlet-name
   url-pattern/*/url-pattern
 /servlet-mapping

I believe Cocoon's configuration already maps Cocoon to all incoming
URLs. This shouldn't have been necessary.

 But accessing any URI using the virtual hostname then brought up the
 Tomcat 404 error requested resource (/what/ever) is not available.

Do this:
* Stop Tomcat if it's running
* Remove all Context elements from your server.xml file.
* Leave cocoon.war exploded into webapps/ROOT
* Remove everything else from the webapps directory (maybe move
  everything somewhere else in case you need it back)
* Delete everything in work/ and logs/
* Start Tomcat
* Check all logs in logs/*
* Come back and tell us how things went

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

iEYEARECAAYFAkmZ7bgACgkQ9CaO5/Lv0PDaXQCdHWSv7olIkRzfwNbHYFcwSesq
52EAn2V4Ld0xDzpwolSjUnXrtMo29+oi
=TCMJ
-END PGP SIGNATURE-

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



Re: Tutorial: Load Balancing Tomcat with Apache

2009-02-16 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

To whom iy may concern,

On 2/16/2009 4:21 PM, GF wrote:
 I wrote a tutorial about load balancing Tomcat with Apache Proxy Module.
 
 This is the url:
 http://www.zulutown.com/blog/2009/02/16/java-ee-load-balancing-with-tomcat-and-apache/
 Any feedback will be really appreciated.

This is less of a tutorial and more of a single example. A few things
that you don't really describe too well:

1. Why use different port numbers for each backend server?
   This is probably appropriate if you are playing with a clustered
   configuration on a single box just to test the config, but
   a production cluster is likely to have all the same port numbers
   being used in Connectors. You mention same IP/port but don't say
   why that would be a good or bad idea.

2. Why is ProxyPass defined within a Location element?

3. Why aren't you using ProxyPassReverse?

4. Why don't you explain the use of the 'retry' parameter? Why are you
   explicitly defining it to be it's default (60)?

Also, why wouldn't you include a link to the official documentation
(http://httpd.apache.org/docs/2.2/mod/mod_proxy_balancer.html) and
(http://tomcat.apache.org/tomcat-6.0-doc/cluster-howto.html)? The
official documentation contains working examples, too.

About the only thing you needed to add to the official documentation was
to talk about the stickysession and route parameters and how they
connect-up to the Tomcat configuration.

Presumably, your audience is already familiar with setting up Tomcat and
possibly Apache httpd. I think you spend too much time on those
configurations and too little explaining how to wire the sticky sessions
and jvm routes. Sure, you cover them, but it gets lost in all the other
stuff.

Don't get me wrong: I'm glad people are writing blog entries like this
and trying to publish good information, but I have seen way too many
howtos, tutorials, etc. that end up publishing The Way To Do It™ and
none of the readers end up learning anything. The result is that folks
come to the list and say I read this guy's tutorial and now my
configuration doesn't work. The problem is that they've been given an
example configuration with no background information. No depth.

You don't cover anything about the implications of load-balancing across
multiple stateful servers. This gets into clustering, which you only
really mention once. The reader is left to either a) wonder what a
cluster is or b) come to the mistaken conclusion that a cluster is a
group of servers being load-balanced.

I would recommend making this a series of articles, and go into further
depth in later installments. This first one should have been titled
this configuration works; more to come later.

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

iEYEARECAAYFAkmZ8v8ACgkQ9CaO5/Lv0PDMCgCgiZoqn2FDLp/7qQMch/UZGn1u
EYcAniZImGWytuor6UqrzX2L7veGtOiV
=4CpF
-END PGP SIGNATURE-

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



Re: AJP13 Connector and JKOptions]

2009-02-16 Thread Pete Helgren

Andre,

Thanks.  This Apache instance is running on Windows Server 2003 and 
already has several web sites running at port 80.  Some static, some 
PHP.  I am a Java guy so a Tomcat servlet was my natural way of writing 
the app.  To my knowledge I can't have more than one web server 
listening on port 80 on this IP so my solution was to install Tomcat 
5.5.27 and use AJP13 to serve the pages back to Tomcat.  Is there a 
better way?


The services panel in Windows Server 2003 says this:

Apache/2.2.11 (Win32) DAV/2 mod_jk/1.2.27 mod_ssl/2.2.11 OpenSSL/0.9.8i

This isn't my server, just my app.  Since I can run this successfully on 
my Windows server 2003, Apache 2.2 and Tomcat 5.5 I figured this would 
be the easiest way to approach it. 


I can tell that I am close, I am just missing something subtle.

Thanks



- Original Message - From: André Warnier a...@ice-sa.com
To: Tomcat Users List users@tomcat.apache.org
Sent: Saturday, February 14, 2009 3:26 AM
Subject: Re: AJP13 Connector and JKOptions


Pete Helgren wrote:
[...]
Hi.
Maybe start at the beginning and let us know :
- which version of Tomcat you are running
- on what kind of box (the OS)
- with which version of Apache

Then,
- do you have any reason to be using an Apache front-end, other than 
wanting to get rid of the :8080 in your URL links ?

Because if not, then you do not need an Apache front-end to do that.
Just change the port=8080 to port=80 in the HTTP Connector element 
of your Tomcat's server.xml file, and restart Tomcat.

(But stop Apache first, otherwise they will fight for port 80).

If you have another reason to configure an Apache, then it is a bit more 
complicated. But please then provide the requested information first.


-
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: Apache/mod_jk serves random files from tomcat

2009-02-16 Thread dave smith
Sorry for not providing an update sooner.  I disabled the APR and the
problem went away.

On 2/12/09, Christopher Schultz ch...@christopherschultz.net wrote:
 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA1

 Yuval,

 On 2/12/2009 3:12 AM, Yuval Perlov wrote:
 I actually upgraded from mod_jk 1.2.26 to 27 to try and make the problem
 go away.

 Ha! Okay. Sorry for a bad tip. ;)

 So, I'm definitely not going to be able to help you from here on out,
 but I know that folks like Rainer and Mladen could use some more
 information, so I'll go ahead and ask for some.

 The mixup occurs only in tomcat originated data - the static stuff
 coming from httpd stays fine.

 Good to know.

 Moreover, in the past I had it setup so the static stuff came from
 tomcat as well. This naturally resulted in significantly more hits
 between apache and tomcat which made the problem appear much faster
 (hence my theory that some resource is being depleted over time).

 Is this something you can reproduce reliably in a test environment? Does
 it require heavy load in order for this behavior to manifest itself? Or,
 is it just after 5M requests everything goes to hell? I'm wondering if
 concurrency is the problem or maybe something silly like logging or
 maintaining worker status that somehow corrupts something.

 It's very odd that responses would be crossed. I don't think any of that
 stuff is shared between threads/processes in mod_jk/httpd, but I suppose
 when you overwrite memory (which is the only explanation I can think
 of), you can't really expect the program to operate properly.

 Oh, are you using worker or prefork MPM?

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

 iEYEARECAAYFAkmUplsACgkQ9CaO5/Lv0PANwQCeM7IEsDUu+o8cKjZP3kxAZgXP
 7g4AoLyLW2cvmLC7AGGJnEf8jHBzNBvM
 =E4BT
 -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: filter debugging or logging?

2009-02-16 Thread Brad Whitaker

Thanks for the response. I wanted to know about the order primarily because I
thought I might be having a problem with dispatcher configuration, i.e. I
was concerned that some filters might or might not be firing on ERROR and
REDIRECT. I've done enough debugging at this point to determine this is not
my problem. (My problem seems to be that Tomcat 6 is not sending a redirect
when I invoke HttpServletResponse.sendRedirect(redirectUrl) but I'll put
that in a separate topic.)



Christopher Schultz-2 wrote:
 
 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA1
 
 Brad,
 
 On 2/13/2009 7:34 PM, Brad Whitaker wrote:
 Is there a logger that can emit information about when servlet filters
 are
 invoked?
 
 Not a logger per-se, but there is an internal event fired and can
 presumably be listened-to. See the source for
 java/org/apache/catalina/core/ApplicationFilterChain.java, specifically
 the internalDoFilter method. You can see these two events reported:
 

 support.fireInstanceEvent(InstanceEvent.BEFORE_FILTER_EVENT,
   filter, request, response);
 
 ...
 

 support.fireInstanceEvent(InstanceEvent.AFTER_FILTER_EVENT,
   filter, request, response);
 
 
 I'm not sure what the best way is to listen to these events.
 org.apache.catalina.util.InstanceSupport is the class for the 'support'
 reference above. That class has methods for registering event listeners,
 but I'm not sure what the best way is to get the instance of
 InstanceSupport that is being used by Tomcat. JMX might work to grab
 that object from Tomcat.
 
 I have multiple filters
 that have been provided by 3rd party libraries and it is very difficult
 to
 know when they are invoked, and in what order.
 
 They should be invoked in the order in which they are declared in
 web.xml. Is this not the behavior you are observing? What version of
 Tomcat are you running?
 
 I'd primarily
 like to know when doFilter() is invoked (along with the name of the
 filter).
 I think this would be enough to follow the chains.
 
 You could write a trivial filter that does something like this:
 
 public class OrderingFilter
  implements Filter
 {
private String _name;
public void init(FilterConfig config)
{
   _name = config.getInitParameter(name);
}
 
public void doFilter(ServletRequest request,
 ServletResponse response,
 FilterChain chain)
   throws IOException, ServletException
{
System.out.println(Running  + _name);
 
chain.doFilter(request, response);
 
System.out.println(Finished running  + _name);
}
 }
 
 Then, configure this filter to run in between every filter you have
 configured. Something like this:
 
 Filter A
 OrderingFilter[name='after A']
 Filter B
 OrderingFilter[name='after B']
 Filter C
 OrderingFilter[name='after C']
 Filter D
 OrderingFilter[name='after D']
 Filter E
 OrderingFilter[name='after E']
 ...
 
 This gives you a crude yet non-invasive debugging mechanism. Just make
 sure that you have all your url-mappings set up to mirror those of the
 original filters.
 
 - -chris
 -BEGIN PGP SIGNATURE-
 Version: GnuPG v1.4.9 (MingW32)
 Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
 
 iEYEARECAAYFAkmZ5QgACgkQ9CaO5/Lv0PDVFwCfYh9Mf0R6xUhi8gorM3sWnBgA
 D64AoL7sBsxNRh8MNSW09vfoJ70BmjJK
 =3fLv
 -END PGP SIGNATURE-
 
 

-- 
View this message in context: 
http://www.nabble.com/filter-debugging-or-logging--tp22007573p22049002.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



HttpServletResponse.sendRedirect() not working?

2009-02-16 Thread Brad Whitaker

I'm having a problem with Tomcat 6.0.18 that I don't understand. I'm invoking
HttpServletResponse.sendRedirect() but no redirect is being sent to the
browser. Is there a valid reason why this might occur, or is this likley a
bug in Tomcat?

My code has thrown an exception prior to invoking the redirect but I can't
find anything in the Servlet spec that would indicate this is a problem. The
HttpServletResponse.sendRedirect() is within a try/catch block and no
exception is being thrown in response to sendRedirect(). My app is built on
Grails (which in turn is built on top of Spring) and I don't fully
understand the exception resolution process used by my frameworks, but I
have verified that sendRedirect() is being executed and not throwing an
exception. This same code is working as desired when executed on Jetty (i.e.
the desired redirect is received by the browser) but when executed in Tomcat
I see the default Tomcat error page displayed rather than the redirect.

Any advice or suggestions would be appreciated.
-- 
View this message in context: 
http://www.nabble.com/HttpServletResponse.sendRedirect%28%29-not-working--tp22049004p22049004.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: HttpServletResponse.sendRedirect() not working?

2009-02-16 Thread Martin Gainty

if you were forwarding..that would be a TC error

a redirect sends response back to browser-client  
its up to browser-client to then accept the response and re-direct the client 
Request to new url

//an alternative strategy would be to build the URL consisting of URL and 
http-get parameters e.g.
String url_string =http://somehost.com+parm1=value1parm2=value2;;
//call the URL directly (essantially a forward as the session is preserved)
java.net.URL url = new java.net.URL(url_string);
//read the response from url into Buffered Reader
BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));

HTH
Martin 
__ 
Disclaimer and confidentiality note 
Everything in this e-mail and any attachments relates to the official business 
of Sender. This transmission is of a confidential nature and Sender does not 
endorse distribution to any party other than intended recipient. Sender does 
not necessarily endorse content contained within this transmission. 




 Date: Mon, 16 Feb 2009 17:55:09 -0800
 From: dbw...@yahoo.com
 To: users@tomcat.apache.org
 Subject: HttpServletResponse.sendRedirect() not working?
 
 
 I'm having a problem with Tomcat 6.0.18 that I don't understand. I'm invoking
 HttpServletResponse.sendRedirect() but no redirect is being sent to the
 browser. Is there a valid reason why this might occur, or is this likley a
 bug in Tomcat?
 
 My code has thrown an exception prior to invoking the redirect but I can't
 find anything in the Servlet spec that would indicate this is a problem. The
 HttpServletResponse.sendRedirect() is within a try/catch block and no
 exception is being thrown in response to sendRedirect(). My app is built on
 Grails (which in turn is built on top of Spring) and I don't fully
 understand the exception resolution process used by my frameworks, but I
 have verified that sendRedirect() is being executed and not throwing an
 exception. This same code is working as desired when executed on Jetty (i.e.
 the desired redirect is received by the browser) but when executed in Tomcat
 I see the default Tomcat error page displayed rather than the redirect.
 
 Any advice or suggestions would be appreciated.
 -- 
 View this message in context: 
 http://www.nabble.com/HttpServletResponse.sendRedirect%28%29-not-working--tp22049004p22049004.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
 

_
See how Windows connects the people, information, and fun that are part of your 
life.
http://clk.atdmt.com/MRT/go/msnnkwxp1020093175mrt/direct/01/

Re: HttpServletResponse.sendRedirect() not working?

2009-02-16 Thread Qiao Jin
What's after the sendRedirect() call in your code? And what's in the final?
Can you post a simple code sample that would demonstrate the problem?

On Mon, Feb 16, 2009 at 5:55 PM, Brad Whitaker dbw...@yahoo.com wrote:


 I'm having a problem with Tomcat 6.0.18 that I don't understand. I'm
 invoking
 HttpServletResponse.sendRedirect() but no redirect is being sent to the
 browser. Is there a valid reason why this might occur, or is this likley a
 bug in Tomcat?

 My code has thrown an exception prior to invoking the redirect but I can't
 find anything in the Servlet spec that would indicate this is a problem.
 The
 HttpServletResponse.sendRedirect() is within a try/catch block and no
 exception is being thrown in response to sendRedirect(). My app is built on
 Grails (which in turn is built on top of Spring) and I don't fully
 understand the exception resolution process used by my frameworks, but I
 have verified that sendRedirect() is being executed and not throwing an
 exception. This same code is working as desired when executed on Jetty
 (i.e.
 the desired redirect is received by the browser) but when executed in
 Tomcat
 I see the default Tomcat error page displayed rather than the redirect.

 Any advice or suggestions would be appreciated.
 --
 View this message in context:
 http://www.nabble.com/HttpServletResponse.sendRedirect%28%29-not-working--tp22049004p22049004.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: HttpServletResponse.sendRedirect() not working?

2009-02-16 Thread Brad Whitaker

There's a lot of processing after the sendRedirect(). The sendRedirect() is
contained in Grails platform code and I confess that I don't fully
understand the motivation behind all of the processing. The sendRedirect()
has occurred after an application defined exception has been thrown. A
Spring exception resolver has forwarded the request after the exception has
been thrown. sendRedirect() occurs after the forward.

Here is the code that sends the redirect. It is Grails code except that I
added some of the verbose logging statements and the catch (Exception ex)
just to be sure I wasn't missing an exception:

private Object redirectResponse(String actualUri, HttpServletResponse
response) {
if(LOG.isDebugEnabled()) {
LOG.debug(Dynamic method [redirect] forwarding request to
[+actualUri +]);
}

try {

if(LOG.isDebugEnabled()) {
LOG.debug(Executing redirect with response
[+response+]);
}
String redirectUrl = response.encodeRedirectURL(actualUri);
response.sendRedirect(redirectUrl);

} catch (IOException e) {
throw new ControllerExecutionException(Error redirecting
request for url [+actualUri +]:  + e.getMessage(),e);
} catch (Exception ex) {
LOG.error(redirectResponse: caught Exception= + ex);
throw new ControllerExecutionException(Error redirecting
request for url [ + actualUri + ]:  + ex.getMessage(), ex);
}
return null;
}


I'm certain that the redirect is never sent to the browser. I've been using
Firebug and HttpWatch to monitor each request and response. When I execute
this code on Jetty I do see the redirect sent to the browser.

I took a look at the Error Handling sections of the Servlet spec and it
wasn't clear to me if perhaps the redirect is not permitted after an
exception has been thrown.

Any suggestions would be appreciated.


Qiao Jin wrote:
 
 What's after the sendRedirect() call in your code? And what's in the
 final?
 Can you post a simple code sample that would demonstrate the problem?
 
 On Mon, Feb 16, 2009 at 5:55 PM, Brad Whitaker dbw...@yahoo.com wrote:
 

 I'm having a problem with Tomcat 6.0.18 that I don't understand. I'm
 invoking
 HttpServletResponse.sendRedirect() but no redirect is being sent to the
 browser. Is there a valid reason why this might occur, or is this likley
 a
 bug in Tomcat?

 My code has thrown an exception prior to invoking the redirect but I
 can't
 find anything in the Servlet spec that would indicate this is a problem.
 The
 HttpServletResponse.sendRedirect() is within a try/catch block and no
 exception is being thrown in response to sendRedirect(). My app is built
 on
 Grails (which in turn is built on top of Spring) and I don't fully
 understand the exception resolution process used by my frameworks, but I
 have verified that sendRedirect() is being executed and not throwing an
 exception. This same code is working as desired when executed on Jetty
 (i.e.
 the desired redirect is received by the browser) but when executed in
 Tomcat
 I see the default Tomcat error page displayed rather than the redirect.

 Any advice or suggestions would be appreciated.
 --
 View this message in context:
 http://www.nabble.com/HttpServletResponse.sendRedirect%28%29-not-working--tp22049004p22049004.html
 
 
 

-- 
View this message in context: 
http://www.nabble.com/HttpServletResponse.sendRedirect%28%29-not-working--tp22049004p22051065.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