Error registering RequestProcessor

2005-01-13 Thread John Sidney-Woollett
We're using Tomcat 5.0.28 which is fronted by Apache 1.3.29 + modjk 1.2.6
We're seeing this error message in the logs occasionally. The error 
occurs at any time interval AFTER tomcat has been started up - two hours 
was the last time it occured after startup.

This server is one of two in a (jk) load balanced configuration - they 
do not use or share sessions and act purely as image servers (from a db 
+ file system).

13-Jan-2005 17:27:36 org.apache.commons.modeler.Registry registerComponent
SEVERE: Error registering 
Catalina:type=RequestProcessor,worker=jk-8009,name=JkRequest129
javax.management.InstanceAlreadyExistsException: 
Catalina:type=RequestProcessor,worker=jk-8009,name=JkRequest129
at mx4j.server.MBeanServerImpl.register(MBeanServerImpl.java:1123)
at 
mx4j.server.MBeanServerImpl.registerImpl(MBeanServerImpl.java:1054)
at 
mx4j.server.MBeanServerImpl.registerMBeanImpl(MBeanServerImpl.java:1002)
at 
mx4j.server.MBeanServerImpl.registerMBean(MBeanServerImpl.java:978)
at 
org.apache.commons.modeler.Registry.registerComponent(Registry.java:871)
at 
org.apache.jk.common.ChannelSocket.registerRequest(ChannelSocket.java:436)
at 
org.apache.jk.common.HandlerRequest.decodeRequest(HandlerRequest.java:443)
at 
org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:352)
at 
org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:743)
at 
org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:675)
at 
org.apache.jk.common.SocketConnection.runIt(ChannelSocket.java:866)
at 
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
at java.lang.Thread.run(Thread.java:534)
13-Jan-2005 17:27:36 org.apache.jk.common.ChannelSocket registerRequest
WARNING: Error registering request

Does anyone know if this is this serious? And do you think that this TC 
instance is still able to serve requests. (Because this is our 
production environment we can't do much testing with these servers and 
haven't seen the error on our development servers).

Thanks for any insight or help.
John Sidney-Woollett

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


Re: Apache, Tomcat, WebDAV, and Web Folders... Oh, my!

2005-01-11 Thread John Sidney-Woollett
I've also written a custom webdav servlet because we need to work with a 
custom/virtualised file store. Our servlet works fine for everything 
except some flavours of M$shite Windows - the symptoms I get are 
identical to the ones you describe.

Like you our server is not running on localhost, and the user's 
directory is not the root, and the user has to authenticate (using basic 
authentication)...

As yet I have not been able to work out a solution, although I know it 
exists because sites like sharemation.com have somehow worked around the 
problem - I just haven't figured out how they do it.

If you find a solution to this problem can you let me know - it has 
driven us mad for months before we finally gave up...

We recommend users install webdrive - it works great but costs US$30 a pop!
Thanks for any help (if you find a solution)
John Sidney-Woollett
ps Here is another document that may help you:
http://support.microsoft.com/default.aspx?scid=kb;EN-US;269681
And some specific instructions that work (sometimes) but I don't want my 
users to have to play around with their OS installs:

quote
The problem is a conflicting Office Installation (since Office 2002) 
which changes the webdav components of Windows XP. To change them back 
(to the working one) you need to follow these steps:

1. You will find a file called webfldrs.msi (Normally under
\WINDOWS\SYSTEM32\webfldrs.msi - if you installed Windows XP Servicepack 1
you will find it under \WINDOWS\ServicePackFiles\i386\webfldrs.msi).
2. Start the installation with double-click or right-click - webfldrs.msi.
3. Now you have to click on Select reinstall mode.
4. Uncheck Repair all detected reinstall problems.
Check Force all files to be reinstalled, regardless of checksum or
version. Check Verify that required user registry entries are present.
Check Verify that required machine registry entries are present. Check
Validate shortcuts.
5. Press OK and REINSTALL
6. Normally no reboot is required and now everything goes fine.
/quote
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Prevent session creation by DefaultServlet

2004-11-21 Thread John Sidney-Woollett
Is there any way on tomcat 5.0.x to prevent tomcat/defaultServlet 
creating a session when serving static image files (*.jpg, *.gif, *.png)?

This is only an issue if the browser has cookies switched off (and some 
users do).

I know you can prevent the creation of a session in a JSP with (%@ page 
session=false %), but is there a way of doing this for other 
resources (like images)?

We log all new sessions in a database, but we're finding when a browser 
has cookies switched off the defaultservlet/tomcat is generating a new 
session to serve each graphic elements on the page and it's clogging up 
our session monitor/logger (which implements HttpSessionListener).

Also it's hard to distinguish these sessions from real user sessions - 
although we can if we use a filter to check the request URL to see what 
resource was requested, and then ignore the image requests.

Any ideas?
John Sidney-Woollett
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


http-https url rewrite bug TC 5.0.28?

2004-11-15 Thread John Sidney-Woollett
I'm not sure if this is a bug or a misunderstaning on my part - and I've 
been searching the archives and googling for most of the day without 
success...

I've got a problem where URL rewriting is failing to correctly encode 
the URL when switching from an insecure (non-ssl) connection to a secure 
ssl connection FOR THE SAME DOMAIN and where the session already exists 
for the insecure connection and COOKIES ARE DISABLED in the browser. I 
can reproduce this behaviour with different browsers.

An action servlet receives the non-ssl request and redirects to 
another secure action servlet. The call for the redirect should encode 
the URL as follows in the first servlet's service(request, response) method:

[snip]
if (gotoCheckout)
{
//goto the checkout
//this generates the URL
//https://www.mytestsite.com/CheckoutAction?action=start
String url = CheckoutAction.getCheckoutActionStartURL(request);
//make sure the JSESSIONID is appended for non-cookie browsers
url = response.encodeRedirectURL(url);
response.sendRedirect(url);
return;
}
[snip]
Looking at the headers, you can see that the JSESSIONID is not appended 
to the redirect URL when the protocol switches from http to https:

REQUEST
===
POST 
http://www.mytestsite.com/BasketAction;jsessionid=9E490ADF8FB268E3F6BC5FA2FD61E8CF 
HTTP/1.1
Host: www.mytestsite.com
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.5a) 
Gecko/20030728 Mozilla Firebird/0.6.1
Accept: 
text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,video/x-mng,image/png,image/jpeg,image/gif;q=0.2,*/*;q=0.1
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Proxy-Connection: keep-alive
Referer: 
http://www.mytestsite.com/basket;jsessionid=9E490ADF8FB268E3F6BC5FA2FD61E8CF
Content-Type: application/x-www-form-urlencoded
Content-Length: 66
ret=%2Fimage%2F6503740500223action=updbutaction=checkoutqty_0=1

RESPONSE

HTTP/1.x 302 Moved Temporarily
Date: Mon, 15 Nov 2004 13:38:23 GMT
Server: Apache/1.3.29
Location: https://www.mytestsite.com/CheckoutAction?action=start
Content-Length: 0
Content-Type: text/plain
Connection: close
Setup
Apache 1.3.29 + mod_ssl + mod_jk + tomcat 5.0.28 (unix)
Apache is configured with two virtual directives; one for port 80 and 
one for post 443 and the requests are forwarded by mod_jk to tomcat 
which has the following in its server.xml config:

[snip]
Host name=www.mytestsite.com appBase=/ef02/tc/www.mytestsite.com
 Context path= docBase=ROOT debug=0 reloadable=false
  ResourceLink name=jdbc/D1DB global=jdbc/D1DB 
type=javax.sql.DataSource/
 /Context
/Host
[snip]

Tomcat possibly nevers sees that the request is secure because the SSL 
part of the transaction is handled by mod_SSL, and I don't know if this 
has a bearing on the issue?

My question, should the JSESSIONID be appended in the encoded redirect - 
I think so?

And if it should, am I doing something wrong. Or is there a bug?
If there is a bug, should I manually append the ;jsessionid=xxx to 
the URL to workaround the problem.

Can anyone shed any light on this?
Many thanks
John Sidney-Woollett
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: http-https url rewrite bug TC 5.0.28?

2004-11-15 Thread John Sidney-Woollett
I should have mentioned that the problem I'm seeing is causing a new 
session to be created after the redirect when in fact I want the 
original session data prior to the redirect...

John Sidney-Woollett
John Sidney-Woollett wrote:
I'm not sure if this is a bug or a misunderstaning on my part - and I've 
been searching the archives and googling for most of the day without 
success...

I've got a problem where URL rewriting is failing to correctly encode 
the URL when switching from an insecure (non-ssl) connection to a secure 
ssl connection FOR THE SAME DOMAIN and where the session already exists 
for the insecure connection and COOKIES ARE DISABLED in the browser. I 
can reproduce this behaviour with different browsers.

An action servlet receives the non-ssl request and redirects to 
another secure action servlet. The call for the redirect should encode 
the URL as follows in the first servlet's service(request, response) 
method:

[snip]
if (gotoCheckout)
{
//goto the checkout
//this generates the URL
//https://www.mytestsite.com/CheckoutAction?action=start
String url = CheckoutAction.getCheckoutActionStartURL(request);
//make sure the JSESSIONID is appended for non-cookie browsers
url = response.encodeRedirectURL(url);
response.sendRedirect(url);
return;
}
[snip]
Looking at the headers, you can see that the JSESSIONID is not appended 
to the redirect URL when the protocol switches from http to https:

REQUEST
===
POST 
http://www.mytestsite.com/BasketAction;jsessionid=9E490ADF8FB268E3F6BC5FA2FD61E8CF 
HTTP/1.1
Host: www.mytestsite.com
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.5a) 
Gecko/20030728 Mozilla Firebird/0.6.1
Accept: 
text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,video/x-mng,image/png,image/jpeg,image/gif;q=0.2,*/*;q=0.1 

Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Proxy-Connection: keep-alive
Referer: 
http://www.mytestsite.com/basket;jsessionid=9E490ADF8FB268E3F6BC5FA2FD61E8CF 

Content-Type: application/x-www-form-urlencoded
Content-Length: 66
ret=%2Fimage%2F6503740500223action=updbutaction=checkoutqty_0=1
RESPONSE

HTTP/1.x 302 Moved Temporarily
Date: Mon, 15 Nov 2004 13:38:23 GMT
Server: Apache/1.3.29
Location: https://www.mytestsite.com/CheckoutAction?action=start
Content-Length: 0
Content-Type: text/plain
Connection: close
Setup
Apache 1.3.29 + mod_ssl + mod_jk + tomcat 5.0.28 (unix)
Apache is configured with two virtual directives; one for port 80 and 
one for post 443 and the requests are forwarded by mod_jk to tomcat 
which has the following in its server.xml config:

[snip]
Host name=www.mytestsite.com appBase=/ef02/tc/www.mytestsite.com
 Context path= docBase=ROOT debug=0 reloadable=false
  ResourceLink name=jdbc/D1DB global=jdbc/D1DB 
type=javax.sql.DataSource/
 /Context
/Host
[snip]

Tomcat possibly nevers sees that the request is secure because the SSL 
part of the transaction is handled by mod_SSL, and I don't know if this 
has a bearing on the issue?

My question, should the JSESSIONID be appended in the encoded redirect - 
I think so?

And if it should, am I doing something wrong. Or is there a bug?
If there is a bug, should I manually append the ;jsessionid=xxx to 
the URL to workaround the problem.

Can anyone shed any light on this?
Many thanks
John Sidney-Woollett
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


RE: http-https url rewrite bug TC 5.0.28?

2004-11-15 Thread John Sidney-Woollett
Yoav
Either you're wrong or Tomcat 5.0.x may be broken...
With cookies enabled you can transfer the session from a non-secure 
connection to a secure connection for the same domain/webapp. Tomcat 
does NOT generate a new (secure) session.

The problem is that TC 5.0.28 does not exhibit the same behaviour when 
cookies are disabled. In this case, Tomcat does in fact generate a new 
(secure) session.

So what we have here appears to be non-consistant behaviour from Tomcat 
based on client behaviour beyond the control of the web app developer... :(

And all because response.encodeRedirectURL(url) did not append the 
jsessionid to the URL when switching protocols. If encodeRedirectURL 
appended the session id, then you would have consistant behaviour from 
Tomcat.

Now it could be that using response.encodeRedirectURL(url) is not the 
correct way to pass the session from an http to https connection. And in 
fact the only way to guarantee that the non-secure session data is 
passed to the secure connection is using the following hack:

url = url + ;jsessionid= + session.getId()
when cookies are disabled.
My personal preference is to create a new static method which takes the 
current request and the new request URL and generates a correctly 
rewritten URL (based on the fact that I want the non-secure session 
passed to the secure pages). And to use that whereever I have been using 
response.encodeRedirectURL(url) and response.encodeURL(url)

I still that Tomcat is broken/inconsistant on this point...
Any other thoughts or solutions, anyone?
John Sidney-Woollett
Yoav Shapira wrote:
 Hi,
 Not a bug.  You can't share a session that way, whether using cookies 
 or URL-rewriting.

 Yoav Shapira http://www.yoavshapira.com

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


Re: http-https url rewrite bug TC 5.0.28?

2004-11-15 Thread John Sidney-Woollett
Tomcat still seems broken to me because it does in fact share the 
session from a non-secure connection to a secure connection when cookies 
are enabled, but not when they are not.

But you've given me some inkling as to what is going on.
I can't believe that there isn't a standard solution for dealing with 
this issue.

ie, non-ssl when adding things to your basket, switch to SSL going 
through the checkout stages, then back to non-ssl after completing the 
order.

Thanks for the extra info.
John
Scott Ahten wrote:
To clarify Yoav's response, this is not a bug but by design.
Tomcat does not allow session data to be shared between secure and  
non-secure pages. This is to prevent someone from gaining access to  
session data that was submitted via a secure page by using a non-SSL  
URL and the user's session id, observed during the initial unencrypted  
connection.

You will need to either collect all necessary information via SSL or  
persist data from the non-secure session (database, serialization,  
etc.) for retrieval by the secure session when you make the switch.

- Scott
On Nov 15, 2004, at 10:24 AM, Shapira, Yoav wrote:
Hi,
Not a bug.  You can't share a session that way, whether using cookies  or
URL-rewriting.
Yoav Shapira http://www.yoavshapira.com

-Original Message-
From: John Sidney-Woollett [mailto:[EMAIL PROTECTED]
Sent: Monday, November 15, 2004 10:21 AM
To: [EMAIL PROTECTED]
Subject: http-https url rewrite bug TC 5.0.28?
I'm not sure if this is a bug or a misunderstaning on my part - and
I've
been searching the archives and googling for most of the day without
success...
I've got a problem where URL rewriting is failing to correctly encode
the URL when switching from an insecure (non-ssl) connection to a
secure
ssl connection FOR THE SAME DOMAIN and where the session already  exists
for the insecure connection and COOKIES ARE DISABLED in the browser. I
can reproduce this behaviour with different browsers.
An action servlet receives the non-ssl request and redirects to
another secure action servlet. The call for the redirect should
encode
the URL as follows in the first servlet's service(request, response)
method:
[snip]
if (gotoCheckout)
{
//goto the checkout
//this generates the URL
//https://www.mytestsite.com/CheckoutAction?action=start
String url = CheckoutAction.getCheckoutActionStartURL(request);
//make sure the JSESSIONID is appended for non-cookie browsers
url = response.encodeRedirectURL(url);
response.sendRedirect(url);
return;
}
[snip]
Looking at the headers, you can see that the JSESSIONID is not  appended
to the redirect URL when the protocol switches from http to https:
REQUEST
===
POST
http://www.mytestsite.com/BasketAction; jsessionid=9E490ADF8FB268E3F6BC5
FA2F
D61E8CF
HTTP/1.1
Host: www.mytestsite.com
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.5a)
Gecko/20030728 Mozilla Firebird/0.6.1
Accept:
text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/ pla
in;q
=0.8,video/x-mng,image/png,image/jpeg,image/gif;q=0.2,*/*;q=0.1
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Proxy-Connection: keep-alive
Referer:
http://www.mytestsite.com/basket; jsessionid=9E490ADF8FB268E3F6BC5FA2FD6
1E8C
F
Content-Type: application/x-www-form-urlencoded
Content-Length: 66
ret=%2Fimage%2F6503740500223action=updbutaction=checkoutqty_0=1
RESPONSE

HTTP/1.x 302 Moved Temporarily
Date: Mon, 15 Nov 2004 13:38:23 GMT
Server: Apache/1.3.29
Location: https://www.mytestsite.com/CheckoutAction?action=start
Content-Length: 0
Content-Type: text/plain
Connection: close
Setup
Apache 1.3.29 + mod_ssl + mod_jk + tomcat 5.0.28 (unix)
Apache is configured with two virtual directives; one for port 80 and
one for post 443 and the requests are forwarded by mod_jk to tomcat
which has the following in its server.xml config:
[snip]
Host name=www.mytestsite.com appBase=/ef02/tc/www.mytestsite.com
 Context path= docBase=ROOT debug=0 reloadable=false
  ResourceLink name=jdbc/D1DB global=jdbc/D1DB
type=javax.sql.DataSource/
 /Context
/Host
[snip]
Tomcat possibly nevers sees that the request is secure because the
SSL
part of the transaction is handled by mod_SSL, and I don't know if  this
has a bearing on the issue?
My question, should the JSESSIONID be appended in the encoded redirect
-
I think so?
And if it should, am I doing something wrong. Or is there a bug?
If there is a bug, should I manually append the ;jsessionid=xxx
to
the URL to workaround the problem.
Can anyone shed any light on this?
Many thanks
John Sidney-Woollett
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


This e-mail, including any attachments, is a confidential business  
communication, and may contain information that is confidential,  
proprietary and/or privileged

java environment + cron issue

2004-09-01 Thread John Sidney-Woollett
On a unix RH8 box starting and stopping TC 5.0.18 under the root account
using the following script:
#!/bin/sh
# This script stops tomcat for (about) 1 minute, and then restarts it
# it is run at the same time as the script to backup the
# database (which is shutdown, and a file level copy made)
echo Stopping Tomcat at `date`
/usr/local/jakarta-tomcat-5.0.18/bin/shutdown.sh
echo Tomcat shutdown at `date`
sleep 15
echo Starting Tomcat at `date`
/usr/local/jakarta-tomcat-5.0.18/bin/startup.sh
stops and starts TC as expected, and after TC is restarted all my JSP's
correctly render UTF-8 strings.
However if the script is invoked from cron, the JSPs render all
non-standard ASCII characters (like accented ones) as a ? (question
mark), until TC is restarted again by executing the above script under
the root account.
Does anyone know what the cause of the problem is, and how to fix it?
(We will be upgrading to TC 5.0.28 shortly, but I don't think the TC
version is the issue). There must be some kind of enviroment issue going
on that I don't understand.
Thanks
John Sidney-Woollett
ps here is the cron entry (created using crontab -e from the root account).
# crontab -l
# DO NOT EDIT THIS FILE - edit the master and reinstall.
# (/tmp/crontab.11679 installed on Fri Aug 20 07:12:03 2004)
# (Cron version -- $Id: crontab.c,v 2.13 1994/01/17 03:20:37 vixie Exp $)
45 3 * * * /bin/nice /usr/bin/rsync-backup-client / [EMAIL PROTECTED]:/
# Pause tomcat for database backup, make sure this job is run
# at the same time as the db backup job on ddgfe1a
5 5 * * * /usr/local/bin/pauseTC.sh

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


Re: java environment + cron issue

2004-09-01 Thread John Sidney-Woollett
 You might try compare results of /usr/bin/env executed from cron
 and command-line.
 You may need to set some environment variables, LANG for example,
 to make JVM works as you expected.
You're right - when the script is run by cron the LANG environment 
variable is undefined.

I will modify the script to set the variable and see what happens tomorrow.
Thanks for the answer!
John Sidney-Woollett
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: JSP WhiteSpace

2004-08-23 Thread John Sidney-Woollett
 I've used a Filter to strip out redundant whitespace from text/html
 output. I wrapped the ServletResponse so that a custom
 ServletOutputStream filters out empty and recurring linefeeds. Works
 pretty well.
One downside to this approach is that the filter is being called for 
every request which may cause you a performance problem down the line.

A better approach would be a flag that the jasper compiler could locate 
to automatically strip redundant/duplicated C/Rs and TABs from the 
source when compiling so that statements like this:

out.write(\r\n\t\t\t\ttd );
become
out.write(td );
eg
% // NOWHITESPACE %
\t\t\t\ttd %=bgColor%width=10 valign=topinput type=checkbox 
name=id value=%=String.valueOf(ff.getEncodedRef())%/td\r
\t\t\t\ttd %=bgColor% width=18 valign=middlea 
href=%=gotoURL%%=icon%/a/td\r
% // /NOWHITESPACE %

becomes
td %=bgColor%width=10 valign=topinput type=checkbox name=id 
value=%=String.valueOf(ff.getEncodedRef())%/tdtd %=bgColor% 
width=18 valign=middlea href=%=gotoURL%%=icon%/a/td

prior to compilation.
In fact this is the approach that I'm going to take. I'm going to write 
a source file pre-processor (maybe even as part of the Ant web-app build 
process) which will remove all redundant whitespace from the source file 
prior to compilation. It will only be used on a COPY of the orginal 
source files (prior to deployment)

Note that sometimes you need the whitespace - perhaps in javascript 
sections of the JSP page which is why you need to be able to switch 
on/off the whitespace removal.

If the jasper compiler could do this automatically then that would be 
great. On average you can see a 10% reduction in file size. We also use 
mod_deflate with Apache to reduce the data transmission costs even further.

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


Re: Strange behavious with session creation on http and https

2004-06-08 Thread John Sidney-Woollett
Ismael Blesa Part said:

 I have set two connectors http and https. I have my webapp that is
 served by these two connectors.

[snip]

 However, If I connect first to https and then I change to http, I will
 have two sessions, one for https and the other one to http.

I believe that this is normal.

If you ensure that the session is created using a non secure page first
(you can always redirect from a non-secure to a secure page after creating
the session), then the problem will go away.

John Sidney-Woollett

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



Re: Strange behavious with session creation on http and https

2004-06-08 Thread John Sidney-Woollett
Ismael Blesa Part said:
 I would like to have different sessions for different schemas, that is,
 If you connect to http and then to https then TWO DIFFERENT sessions are
 created.
 But I have not found how to do this.

 My fear is that on different application servers the behaviour is
 different.

If this is the behaviour that you want, then you only have to worry about
the case when the user goes from http to https (because you want a new
session instead of the old one).

One way to do this would be to record the type of connection (secure or
not) in the session when it is created, and then when you go to a secure
connection, check the value you stored (in the session).

If it indicates that the session was not originally created by a secure
requested, invalidate that session, and create a new one.

I think that will probably work.

John Sidney-Woollett

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



Re: jk connector build / configure failure

2004-04-16 Thread John Sidney-Woollett
Christoph P. Kukulies said:
 On Fri, Apr 16, 2004 at 07:31:40AM +0800, Eric Noel wrote:
 On 4/15/2004 10:28 PM, C. Kukulies wrote:
 In the vein of getting tomcat 5 apache 1.3.29 integration working
 I'm now at the point where I came to the conclusion that I need to
 build
 jakarta-tomcat-connectors-jk-1.2.5-src/jk/native
 
 Correct me if I'm wrong but I came there by reading and skimming the
 web.
 Noone could help me in this list so far. Maybe because everyone is
 using
 apache2, don't know.

We're using Apache 1.3 + mod-ssl + mod_deflate + mod_accel + modJK1.2.5 +
Tomcat 5.0.18, and it works great (especially mod_deflate!).

Basically when you build Apache (from source on Linux), make sure you
build it with so support, eg

./configure --prefix=/usr/local/apache --enable-module=ssl --enable-module=so
make; make install;

Then get mod_jk source from jakarta.apache.org, and unpack, and build as
follows (in the unpacked dir):

./buildconf.sh

./configure --with-apxs=/usr/local/apache/bin/apxs --enable-EAPI

If you don't yet have a modules directory, then

mkdir /usr/local/apache/modules
cp apache-1.3/mod_jk.so /usr/local/apache/modules

You still have to create a workers.properties file, and add the JKxx
settings into your Apache httpd.conf file, to get the two to talk
together.

I know this instructions are vague, but hopefully in conjunction with
others docs, you will be able to get Apache and Tomcat connected using JK.

They do work really well together (with Apache frontending your SSL
transactions, fielding static resources, compressing responses, and load
balancing between two or more TC servers) - it is worth perservering.

Good luck.

John Sidney-Woollett

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



Re: Virtual Hosting Revisited - Apache serving static pages..???

2004-04-15 Thread John Sidney-Woollett
John B. Moore said:
 Thanks for responding.. And yes, I keep hearing that one can do this

... But...G  I'm slow I guess, because that still does not give me
 a hint as to HOW that is to be configured.. Do you have some virtual
 host directives that do this that I can use as examples..

 Maybe my problem is that I  am thinking I could have the static
 pages located under Apache/htdocs and the jsp pages under
 Tomcat/webapps..   I can't find and example that combines the standard
 Apache virtual host directives with what is needed to also direct the
 jsp to Tomcat..  I can easily to each separately, but have yet to find a
 way to do both

Here you go...

# External IP Address: xxx.xxx.xxx.xxx
VirtualHost 192.168.1.111:80
ServerName test.mydomain.com
ServerAdmin [EMAIL PROTECTED]
DocumentRoot /var/www/test.mydomain.com
ErrorLog /var/log/httpd/test.mydomain.com/error_log
CustomLog /var/log/httpd/test.mydomain.com/access_log combined
JkMount /someurl/MySpecialServlet worker1
JkMount /admin/* worker1
JkMount /manager/* worker1
JkMount /*.jsp worker1
/VirtualHost

Create as many JKMount entries as you need to map all your servlets and
JSPs. Whatever doesn't match any of the JkMount entries will be handled by
Apache from the document root (/var/www/test.mydomain.com in this
example).

You can even route the different servlet/jsp requests to different tomcat
workers (if that is needed or works for you).

Hope that helps.

John Sidney-Woollett


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



Re: session affinity with loadbalancing (apache2, mod_jk, tomcat5 on linux 9, jdk1.4.2)

2004-04-15 Thread John Sidney-Woollett
Hi

Don't you also have to provide the properties for the loadbalancer worker?

eg

# properties for load balanced workers
worker.loadbalancer.type=lb
worker.loadbalancer.balanced_workers=tomcat1,tomcat2

and then add the extra properties you require (to worker.loadbalancer.XXX)?

Hope that helps.

John Sidney-Woollett

ian said:
 I've read in the Workers How To of apache that the property
 sticky_session for lb worker properties enables / disables session
 affinity for the load balancer. When I tried it on my system the session
 doesn't seem to be retained often resulting to a session timed out or a
 not logged in error. Below is my worker.properties configuration.

 # 
 # worker.properties
 # 

 # In Unix, we use forward slashes:
 ps=/

 # list the workers by name
 worker.list=tomcat1, tomcat2, loadbalancer

 # 
 # tomcat1 worker
 # 

 worker.tomcat1.host=192.168.0.61
 worker.tomcat1.port=8009
 worker.tomcat1.lbfactor=100
 worker.tomcat1.type=ajp13
 worker.tomcat1.cachesize=10
 worker.tomcat1.cache_timeout=600
 worker.tomcat1.socket_keepalive=1
 worker.tomcat1.socket_timeout=300

 # 
 # tomcat2 worker
 # 

 worker.tomcat2.host=192.168.0.65
 worker.tomcat2.port=8009
 worker.tomcat2.lbfactor=100
 worker.tomcat2.type=ajp13
 worker.tomcat2.cache_timeout=600
 worker.tomcat2.socket_keepalive=1
 worker.tomcat2.socket_timeout=300

 # 
 # end of file
 # 


 Can anyone give me an idea where I may have an error?
 Thanks.

 - ian



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



Re: AJP connector monitoring

2004-03-29 Thread John Sidney-Woollett
Antonio Fiol Bonnín said:
 Hi,

 I'd like to have our Tomcat servers monitored, in order to get an alarm
 if one of them stops responding.

 But they are not using HTTP at all. We are using the Coyote AJP
 connector because we have Apache in front of them, in a balanced
 configuration.

If you cannot find an AJP client...

Why not have tomcat listen for http requests as well (on 8080 or some
other port) (only accessible on your internal network), and have your
monitor script call some URL (a monitor servlet you create) on the tomcat
server to determine whether the tomcat server (and your web app) is up and
running.

Either use the response code (including no response) and/or the response
data/output to determine the state of the app server (and your
application).

You can use wget or some http client to poll your server. This is how we
do it even though we front-end Tomcat using Apache as well. This works
great with Nagios...

John Sidney-Woollett

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



Re: Securing a folder

2004-03-26 Thread John Sidney-Woollett
If you are using JK to connect Apache and Tomcat, you can specify JkMounts
which should cause Apache to forward the request to tomcat to handle.

For example:

VirtualHost 192.168.1.10:80
ServerName www.domain.com
ServerAdmin [EMAIL PROTECTED]
DocumentRoot /var/www/www.beanpix.com
ErrorLog /var/log/httpd/www.domain.com/error_log
CustomLog /var/log/httpd/www.domain.com/access_log combined
JkMount /pdfs/* worker
JkMount /*.jsp worker
/VirtualHost

should cause any URL with the pattern /pdfs/* and *.jsp to be
processed by tomcat. Whether you do this in the main section of the
httpd.conf or for a virtual host only is up to you and your configuration.

Also consider not having the location of the pdf's within the Apache web
root, but instead only accessible by Tomcat...

You can then enforce security using a filter, or using some other method.

Hope that helps

John Sidney-Woollett


Dean Searle said:
 Hello Everyone,

 Not to sure how to phrase this but here I go anyways. I am attempting to
 secure a folder that is located within my application. This folder
 contains pdf's that only need to be accessible by tomcat, the site
 requires a password to enter. At first if I did
 www.domain.com/pdfs/somefile.pdf it would open up somefile.pdf. So I tried
 this in my http.conf file for the website:

 Location /pdfs
   order deny,allow
   deny from all
   allow from 127.0.0.1
 /Location

 But now tomcat cannot even retrieve the pdf's. Am I doing this right.
 Could you please point me to some doc's that might explain this more.

 Not sure if this helps or not:

 Windows 2000 Server SP4
 Tomcat 4.1.24 LE
 Apache 2.0.46
 JDK 1.4.1_02

 Thank you for time

 Dean



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



RE: RE : JSP suggestion

2004-03-25 Thread John Sidney-Woollett
Ralph Einfeldt said:

 Sorry, but that wouldn't help the original poster.

 He is searching for a way to include taglib definitions
 and imports that are used in the pages. Any kind of dynamic
 include or decorators wouldn't achieve that.

Sorry, you're right, misread the original post.

Had it in my mind that they wanted to insert meta tags...

John Sidney-Woollett

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



Re: RE : JSP suggestion

2004-03-24 Thread John Sidney-Woollett
Also have a look at OpenSymphony's SiteMesh filter - it does just what
you're trying to do with your filter explanation here. SiteMesh is VERY
good!

See http://www.opensymphony.com/sitemesh/

It looks complicated, but it's not, and you can control through an XML
file which files get filtered or not (by pattern matching URLs).

The real power is that you build your jsp pages and focus on the core
presentation task in hand, then let the sitemesh filter decorate it by
extracting your page head, body etc and inserting those elements into a
template page (for example).

You could have a simple template that just adds extra meta tags, or
specifies the style sheet or whatever you want.

I've seen no downsides to using it, and speed is good too. Couple it with
OSCache (http://www.opensymphony.com/oscache/), and you have a couple of
blinding tools.

Hope that helps.

John Sidney-Woollett

Hertenstein Alain said:
 As for Servlet 2.3 specifications, you could easily create a Servlet
 Filter which would intercept all your requests based on your url-pattern
 (defined in web.xml), and which would do something like :

 RequestDispatcher reqDispatcher =
 request.getRequestDispatcher(header.jsp);
 reqDispatcher.include(request, response);

 And then let the filter forward to the requested page (chain.doFilter()).
 Thus all your pages would include your header.jsp file (beware not to
 include header.jsp into header.jsp file, or you'll get an infinite loop
 ;-) )

 This is quite easy to implement and the best way IMHO. Have a look at the
 http://java.sun.com web site for more info on Servlet Filters, they are
 very handy as soon as you understand how they work.

 Hope this helps,
 Alain

 -Message d'origine-
 De : Keith Hyland [mailto:[EMAIL PROTECTED]
 Envoyé : mercredi, 24. mars 2004 16:56
 À : Tomcat Users List
 Objet : Re: JSP suggestion


 Or you can specify a prelude.jspf file in your web.xml (I think this may
 only work with servlet spec 2.4 servers)

 (The prelude is added to the top of the file, the coda is added to the
 end of the file)

 jsp-config
 
 jsp-property-group
display-nameallFiles/display-name
url-pattern*.jsp/url-pattern
el-ignoredfalse/el-ignored
scripting-invalidfalse/scripting-invalid
is-xmlfalse/is-xml
include-prelude/template/prelude.jspf/include-prelude
include-coda/template/coda.jspf/include-coda
 /jsp-property-group
 /jsp-config

 Keith

 Adam Buglass wrote on 24/03/2004, 14:55:

   I use
  
   jsp:include page=header.jsp flush=true /
  
   HTH.
   Adam.
  
  
   On Wed, 2004-03-24 at 14:46, Edson Alves Pereira wrote:
  Hello folks, i´d like to build a default jsp header to all my
jsp´page, in this header i would put all taglibs and imports i need,
  but iin doubt about which is the best way to do it. Sould i
 make all   others pageextends this header page or do a @ page
 import in every page? Any   idea?   
  Regards,
  Edson


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



Re: mod_jk

2004-03-08 Thread John Sidney-Woollett
Chris Haines said:
 I spent nine hours trying to get mod_jk to compile properly for Linux but
 had no luck. I wanted to download the binary but couldn't find one. So, I
 downloaded the source code. The instructions I had were full of
 misinformation. Then I got to a point where I seemed to have gotten close
 when I tried compiling it.

 I typed:
 ./configure -with-apxs=/usr/local/apache/bin/apxs
 -with-apache13=/usr/local/apache

 but, the program kept failing and would tell me that it couldn't find
 apxs.

Thr problem may be that you didn't first compile Apache with
--enable-module=so, if you don't do this you won't be able to build mod_jk
(yes, the mod_jk install docs suck big time!), and I have never been able
to find a binary for Linux...

Here's what works (butchered from my own Apache + ModSSL build instructions)

1) in the Apache (source dist) directory (eg /usr/local/src/apache_1.3.29)

./configure --prefix=/usr/local/apache --enable-module=so

make

2) build the mod_jk

cd /usr/local/src/jakarta-tomcat-connectors-jk-1.2.5-src/jk/native

./buildconf.sh

./configure --with-apxs=/usr/local/apache/bin/apxs --enable-EAPI

[Make sure apache built with --enable-module=so otherwise you get can't
find apxs error!]

mkdir /usr/local/apache/modules

cp apache-1.3/mod_jk.so /usr/local/apache/modules

That should help you out. Good luck!

John Sidney-Woollett

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



RE: Internationalization problem

2004-03-04 Thread John Sidney-Woollett
Keith Hyland said:
 I'm testing some japanese characters in my app and I'm getting some
 strange behaviour.

 japanese characters that are in the jsp page get displayed correctly.

 However characters that get displayed through the fmt:message tag get
 corrupted.

 I have set the -Dfileencoding=UTF-8 in my catalina.bat
 (CATALINA_OPTS), and set the

 head
 meta http-equiv=Content-Type content=text/html; charset=utf-8
 /head

 at the op of my jsp page.

 Is there something I have to do to my resource properties file?

I think that resource properties ONLY support ISO-8859-1. They do allow
UTF characters to be defined provided the high order byte is zero. It is a
weakness in property files (which is yet to be addressed).

Consider populating the properties file without using the default load
mechanism to allow/preserve the UTF-8 encoding.

John Sidney-Woollett
 Any help appreciated.

 Cheers,
 Keith

 Is there something el

 Ralph Einfeldt wrote on 02/03/2004, 14:06:

   %@ page contentType=text/html;charset=UTF-8
 pageEncoding=UTF-8  %




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



Re: apache2/mod_jk/tomcat4 - file download / special characters in filename

2004-03-03 Thread John Sidney-Woollett
try converting the filename to ISO-8859-1 as well

eg filename = new String(file.getName(), ISO-8859-1);

Your Code (modified):
response.setHeader(Content-Disposition, attachment; filename= +
new String(file.getName(), ISO-8859-1));
response.setContentLength((int)file.length());
response.setContentType(application/octet-stream);
response.setHeader(Content-Transfer-Encoding, binary);

Hope that helps.

John Sidney-Woollett

Andreas Hartstack said:
 Problem:
 In my tomcat webapp a servlet manages a filedownload. Clicking on a
 file-link results in the browser's
 save as dialog.
 Using tomcat alone (port 8080) everything works fine. Special characters
 (like German umlaut) are shown
 in ISO-8859-1.
 Apache2/mod_jk seems to change the charset to UTF-8, e.g. täst.txt looks
 like tät.txt.

 Code:
 response.setHeader(Content-Disposition, attachment; filename= +
 file.getName());
 response.setContentLength((int)file.length());
 response.setContentType(application/octet-stream);
 response.setHeader(Content-Transfer-Encoding, binary);

 I tried also:
 response.setContentType(application/octet-stream; charset=ISO-8859-1);
 or
 String tmpName = new String(f.getName().getBytes(),ISO-8859-1);
 response.setHeader(Content-Disposition, attachment; charset=ISO8859-1;
 filename=+tmpName);
 or
 response.setHeader(Content-Transfer-Encoding, ISO-8859-1);

 Configuration:
 - Suse 8.2
 - Apache2.0.48
 - Tomcat4.1.18
 - mod_jk
 - $tomcat_home/bin/catalina.sh:
   export CATALINA_OPTS=-Dfile.encoding=ISO-8859-1 -Duser.language=de
 -Duser.country=DE

 Who can help ? Thank's in advance !

 Andreas

 _
 Schützen Sie Ihren Posteingang vor unerwünschten E-Mails.
 http://www.msn.de/antispam/prevention/junkmailfilter Jetzt
 Hotmail-Junk-Filter aktivieren!




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



JSP whitespace removal

2004-03-03 Thread John Sidney-Woollett
Hi

We want to achieve a 10-15% data reduction of the HTML being served by our
webserver (generated by JSP pages). This will have an impact on our
bandwidth charges from our ISP...

We can achieve this by by simply removing all the \n\r, \t characters
and replacing repeated occurences of(double space) by   (single
space). But we don't want to do this in our source JSP files as they will
become unmaintainable/unreadable.

eg
table
  tr
tdColumn 1/td
tdColumn 2/td
  tr
/table

(69 characters)

becomes

tabletrtdColumn 1/tdtdColumn 2/tdtr/table

(57 characters), that's an 17% saving for that text block...

I know that we could:

i) write/implement a filter to process the outputstream - BUT we use
OSCache (www.opensymphony.com) to cache (included) JSP pages, and we don't
want to reprocess cached data using another filter.

ii) use a script to transform or preprocess our JSP pages before they are
deployed - simple, but may have code breaking (between dev and live
system) or maintenance implications?

iii) create a tag library to process a text block (or another JSP), BUT
we've heard a rumour that taglibs can be inefficient (is that true?)

Question: is it possible to use a directive in a JSP page to force the
compiler to remove these characters to achieve our desired data reduction?

Are there any other techniques or solutions that anyone else is using?

Thanks

John Sidney-Woollett

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



Re: JSP whitespace removal

2004-03-03 Thread John Sidney-Woollett
Peter Lin said:
 have you tried turning gzip compression?  that should produce similar
 bandwidth savings to stripping out extra carraige returns and double
 spaces.

We running Apache 1.3.x + JK + TC 5.0.x

What's better the gzip valve/filter in Tomcat, or try doing the
compression with an Apache module (if that's even possible for JSP
rendered pages)?

Also, is there a threshold below which the penalty for processing the
compression outweighs the data payload reductuion?

We want to be low bandwidth + responsive...

 you could always use the jasper plugin architecture to strip out excess
 stuff

Is there a link to some docs for this?

Thanks

John Sidney-Woollett

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



RE: JSP whitespace removal

2004-03-03 Thread John Sidney-Woollett
Steffen Heil said:
 I cannot help you on this, but you should realise, that if you archive to
 reduce you jsps output by  10%, this will affect you traffic only by about
 2%.

 We do have a server, which generated (according to access_log_*)
 2.183.339.056 byte in 261.018 requests. But out provider counted about 9GB
 of traffic. [Actually he is accounting on switch port level and therefor
 including even ARP-requests, but anyway a lot of this traffic is based on
 out tomcat server.]

That's a good point - we're also charged at the switch port level!

We have a traffic shaper so we can control the amount of bandwidth
(Mbit/sec) we use for outbound traffic, and we're trying to cram as much
data per second as we can within our (managed/shaped) limit.

In fact it seems that (gzip) compression is a better strategy for HTML/CSS
pages because it offers compression of 80%. But it's still better to
compress the pages after you strip the whitespace for a small final text
size.

Unfortunately we also have a lot of graphics (but at least once they are
cached by the browser) then we only have to deal with a HEAD request to
see if they have been updated...

Thanks for the feedback.

John Sidney-Woollett

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



TC 5.0.18 RequestDespatcher bug?

2004-02-13 Thread John Sidney-Woollett
I think that there may be a bug in TC 5.0.18 when issuing a
RequestDespatcher.forward with an URL that has the jsessionid encoded in
the URL. My setup is RH 8, JDK 1.4.2_03 + Apache 1.3.29 + mod_jk + TC
5.0.18.

I have a servlet (mapped in web.xml to /home/*) which catches all URLs
starting with /home/. The servlet looks at the URL to work out which
JSP page to render by forwarding to it. The service method code is as
follows:

String fwdURL = /en/home/welcome.jsp;

//create the request dispatcher (for the new URL)
RequestDispatcher rqdD =
request.getRequestDispatcher(response.encodeURL(fwdURL));

//and forward the request
rqdD.forward(request, response);

Here is the error produced by TC

HTTP Status 404 -
/en/home/welcome.jsp;jsessionid=35CC14009BCF7CCED835634586378F46

type Status report

message /en/home/welcome.jsp;jsessionid=35CC14009BCF7CCED835634586378F46

description The requested resource
(/en/home/welcome.jsp;jsessionid=35CC14009BCF7CCED835634586378F46) is not
available.
Apache Tomcat/5.0.18

Is this a bug, or am I doing something wrong. Maybe I should not be
encoding the forwarded URL. The bug manifests itself when switching from
an SSL to a non-SSL connection, or when cookies are turned off.

Thanks for any help.

John Sidney-Woollett

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



Re: TC 5.0.18 RequestDespatcher bug?

2004-02-13 Thread John Sidney-Woollett
Tim Funk said:
 Without digging, I can't say if its a bug. BUT... There is no need to
 encode the URL if the action is a RequestDispatcher.forward(). Only one
 session may be associated with the live of a single request so once the
 session is there in the request, its there no matter how many times in
 the same request you do a RequestDispatcher.forward(). Encoding the URL
 is only needed for sending redirects back to the client or for links on
 pages.

Thanks for the clarification - I'll remove the call to URLEncode for these
situations.

Might still be a bug though... ;)

John




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



Session Tracking Question

2004-01-21 Thread John Sidney-Woollett
I have a webapp in which a servlet will redirect to another remote
webserver URL which will then redirect back to my webserver after
completing its request.

me.com/ServletA   ---   remote.com/someURL  --- me.com/ServletB

I need to be able to re-attach to the original session that the user had
before (in servletA) after returning from the remote site to my URL
me.com/ServletB.

Do I need to do anything special or can I rely on the jsessionid which is
recorded in the cookie for me.com to be automatically picked up when
ServletB is invoked again? Or will ServletB create a new session?

If cookies are switched off, what info do I need to pass to the remote
server (which can POST back anything that I POST to it). Does someone have
some sample code for ServletA and ServletB that allows it to identify the
original session, and re-attach to it?

I'm sorry if I'm asking a dumb question, but I've been checking on the net
for some answers but I don't seem to be making much progress.

I'm currently using Tomcat 5.0.16

Thanks for any help.

John Sidney-Woollett


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



Replication question

2004-01-12 Thread John Sidney-Woollett
Hi

For replication purposes (2 or more tcs in a cluster), how do you let the
sessionlistener know to re-replicate your session after you make a change
to a property of an object which is bound to the session, but where the
session attribute + object iself remains unchanged?

For example, if I bind a (lightweight and serializable) class to the
session and change one of its properties, how do I notify Tomcat that I
want the session replicated again. Probably as far as TC and the
replication code is concerned it doesn't need to do anything because no
attribute changes are recorded.

Do I just call session.setAttribute(MyObject, myObject) again (where the
myObject reference is the same as before), or do I have to remove and then
re-add the attribute? Or is there something that I have missed?

Also, if you add many attributes during a single servlet call, is the
replication buffered and delayed until the servlet sends its response, or
is the replication attempted each time the session's attributes are
changed?

When does anyone think that the recent replication fixes will make it into
the next official release?

Thanks for any info.

John Sidney-Woollett

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



RE: Replication question

2004-01-12 Thread John Sidney-Woollett
Thanks Filip

Perhaps you could help me clear up a little confusion.

1) If useDirtyFlag=false then the session is replicated EVERY time the
servlet container processes a request which has a session. If in 10
requests for one user, a session attribute is modified in one of the
requests only, then 10 replication attempts would have been attempted
although only one was really needed.

2) If useDirtyFlag=true, what other calls cause replication?
Hopefully not session.getAttribute()  :)

Thanks for your help.

John

Filip Hanik said:
Do I just call session.setAttribute(MyObject, myObject)

 YES, that will take care of it.

 if you do set the property useDirtyFlag=false your session will be
 replicated on each request, not good for performance but it takes care of
 code like this

 Map map = session.getAttribute(map);
 map.put(name,value);
 return;

 in this case, the session replication code doesn't know that anything
 changed, hence you don't want to use the dirty flag

 the useDirtyFlag=true replicates the session when
 setAttribute,removeAttribute and some other methods are called

 Filip


 -Original Message-
 From: John Sidney-Woollett [mailto:[EMAIL PROTECTED]
 Sent: Monday, January 12, 2004 9:35 AM
 To: [EMAIL PROTECTED]
 Subject: Replication question


 Hi

 For replication purposes (2 or more tcs in a cluster), how do you let the
 sessionlistener know to re-replicate your session after you make a change
 to a property of an object which is bound to the session, but where the
 session attribute + object iself remains unchanged?

 For example, if I bind a (lightweight and serializable) class to the
 session and change one of its properties, how do I notify Tomcat that I
 want the session replicated again. Probably as far as TC and the
 replication code is concerned it doesn't need to do anything because no
 attribute changes are recorded.

 Do I just call session.setAttribute(MyObject, myObject) again (where the
 myObject reference is the same as before), or do I have to remove and then
 re-add the attribute? Or is there something that I have missed?

 Also, if you add many attributes during a single servlet call, is the
 replication buffered and delayed until the servlet sends its response, or
 is the replication attempted each time the session's attributes are
 changed?

 When does anyone think that the recent replication fixes will make it into
 the next official release?

 Thanks for any info.

 John Sidney-Woollett

 -
 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: Tomcat 5 and oracle

2003-12-10 Thread John Sidney-Woollett
Try using the thin driver - it's jar file is classes12.jar

Place it in [TOMCAT_HOME]/common/lib

John Sidney-Woollett

Jonathan Drnek said:
 I am having a problem setting up a data source in tomcat.  I seem to
 remember having this problem last time I played with it several moths
 ago but I don't remember what I did to fix it.

 I am running Tomcat 5.0.16 with JVM version 1.4.2_03-b02 on windows
 2000.

 I am trying to connect to an Oracle 8.1.7.1.0 database.

 I have placed the ojdbc14.jar file in common\lib

 The error I am getting is

 javax.servlet.ServletException: Cannot create JDBC driver of class ''
 for connect URL 'null', cause: No suitable driver

 I am using oracle.jdbc.driver.OracleDriver because that's what the docs
 said, but I seem to recall that was not correct.  I just can't find
 anything that tells me what other driver I should be using.


 My server.xml file has

 .
 .
 .
 Resource name=jdbc/ordt type=javax.sql.DataSource/
 .
 .
 .
 /ResourceParams
   ResourceParams name=jdbc/ordt
   parameter
 namevalidationQuery/name
 valueselect * from dual/value
   /parameter
   parameter
 nameurl/name
 valuejdbc:oracle:thin:@holl302h:1521:ORDT/value
   /parameter
   parameter
 namepassword/name
 valuepassword/value
   /parameter
   parameter
 namemaxActive/name
 value4/value
   /parameter
   parameter
 namemaxWait/name
 value5000/value
   /parameter
   parameter
 namedriverClassName/name
 valueoracle.jdbc.driver.OracleDriver/value
   /parameter
   parameter
 nameusername/name
 valueusername/value
   /parameter
   parameter
 namemaxIdle/name
 value2/value
   /parameter
 /ResourceParams
 .
 .
 .

 web.xml looks like

 ?xml version=1.0 encoding=ISO-8859-1?

 !DOCTYPE web-app
 PUBLIC -//Sun Microsystems, Inc.//DTD Web Application 2.3//EN
 http://java.sun.com/dtd/web-app_2_3.dtd;

 web-app
   display-nameMetrology Lab/display-name
   description
  First Source Metrology Lab
   /description

  resource-ref
  descriptionOracle Datasource example/description
  res-ref-namejdbc/ordt/res-ref-name
  res-typejavax.sql.DataSource/res-type
  res-authContainer/res-auth
 /resource-ref

 /web-app

 my code looks like

 Context initContext = new InitialContext();
 Context envContext
 (Context)initContext.lookup(java:/comp/env);
 DataSource ds = (DataSource)envContext.lookup(jdbc/ordt);
 Connection conn = ds.getConnection();

 Thanks for any help,

 Jon Drnek




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



Re: directory reference

2003-11-28 Thread John Sidney-Woollett
Why not use a Properties file which you can get the class loader to locate
for you using call similar to:

properties.load(Thread.currentThread().getContextClassLoader().getResourceAsStream(/myfile.properties));

Just place the file at the root level of your (web project) source tree,
so that it is copied either to WEB-INF/classes or built into a jar file
placed in WEB-INF/lib when your app is deployed.

Make sure that the path to the file matches the directory (or package
folder) that you place the properties file in.

This technique works fine with Tomcat, or with a regular java app.

John Sidney-Woollett

Giorgio Franceschetti said:
 Hi all,
I'd like to create a file with some configuration details for my
 application.
 I tryed to reference my file like this ./data.txt and I found it in my
 tomcat/bin directory.
 Well, I should  have expected this, quite like any other java
 application points to the executable directory.
 Is there any way to point to my application directory?
 Should I assume a fixed path like tomcat/webapps/myapp?
 Thanks in advance,
 Giorgio





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



Re: JSP Editors

2003-11-28 Thread John Sidney-Woollett
Take a look at Eclipse (www.eclipse.org) [FREE] combined with MyEclipse
(www.myeclipseide.com) [$29.95].

Having used many IDE's, standalone editors etc, I can positively state
that this IDE will save you LOADS of time, blood sweat and tears. It is
fast, feature packed, written in java, and allows you to develop and debug
web projects easily. It supports virtually all the common J2EE servers
(including Tomcat 4 and 5). It runs on Windows, Linux and Mac OS X. It
features tight cvs integration too. It rocks.

I hear IDEA is a good IDE, and I have used CodeGuide (also good) but I
switched to Eclipse after trying it out.

If you have time to experiment, try Eclipse - you won't believe how good
it is.

John Sidney-Woollett

ps I'm not in any way affiliated to Eclipse or MyEclipse!




Duncan said:
 Sorry if off topic but...

 What do people use to edit JSPs?

 I'm after an editor, free if possible, to run on windows, with syntax
 colouring and possibly auto complete for java.

 Have tried vim for windows, but it doesn't seem as nice on windows as it
 is on linux.


 Any other suggestions?

 Cheers
 Duncan Smith
 Decker Telecom Ltd




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



Re: How to stop the URL comming up?

2003-11-27 Thread John Sidney-Woollett
Try creating a servlet which maps to a bookmark-able URL. Then have the
servlet use the RequestDispatcher to forward the request which will
generate the page (a JSP usually). The forwarded page is generated in the
same request, and the URL won't change.

Using this technique you can have the servlet called one of many JSP pages
to render different pages according to session info, request paremeters or
cookie information.

eg

//create the request dispatcher (for the new URL)
RequestDispatcher rqdD =
request.getRequestDispatcher(response.encodeURL(inclPage));

//and forward the request
rqdD.forward(request, response);

The beauty of this technique is that your servlet can handle all business
logic, generate beans etc, and place them into the request (attributes),
and the jsp page(s) only need concern themselves with presentation.

Hope this helps.

John Sidney-Woollett


Andoni said:
 Hello,

 I am looking for a way to stop my users bookmarking pages in the site.
 There is a login screen and they shouldn't even really be let bookmark
 this.  I was given someone's card today an then I went to his site:
 http://www.xeotrope.net and when I find that as I look around the site the
 url in the URL bar of my browser stays at http://www.xeotrope.net and
 never includes the page name.  This means that all bookmarks only bring up
 the main page.

 Is there any way to do this with apache / Tocmat?

 Thanks.

 Andoni.


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



Re: Invalid Number error when regional setting set to English (Canada )

2003-11-26 Thread John Sidney-Woollett
If you're saving numeric data back to an Oracle (or any) database, then
consider using binding native java data types instead of passing strings
in your update/insert statements or calls to stored procs.

For example, instead of:

String qry = update CUSTOMER set TOTAL_INVOICED =  + numValStr +
where CUSTOMER_ID =  + custIDStr;
Statement stmnt = conn.createStatement();
stmnt.executeUpdate(qry);

Try using the following:

Double invoiced = Double.parseDouble(numValStr);
int custID = Integer.parseInt(custIDStr);

String qry = update CUSTOMER set TOTAL_INVOICED = ? where CUSTOMER_ID ?;
PreparedStatement ps = conn.prepareStatement(qry);

ps.setDouble(1, invoiced);
ps.setInt(2, custID);

ps.executeUpdate();

You will be able to perform better checking because you are being forced
to convert the data from strings prior to inserting/updating the records,
and handle any errors, and you will see a performance gain using the
preparedstatement because Oracle will compile the statement once, and
re-use it without re-compiling it when it is used again (even when the
parameters have different values).

Hope that helps.

John

Lisa Wong said:
 I have a Java/struts app running on a Windows box.  If the box has the
 regional setting set to English (Canada), I am unable to save decimal
 numbers as somewhere along the way, it changes the decimal to a comma.

 I've run the package by itself on the box and it works fine, but through
 the
 app I get an ORA-017222 Invalid Number.  If I do a select via the app, I
 can
 actually see the decimal replaced by a comma on the screen.  It's fine if
 set to English (US) and most of the other English settings.

 Has anyone experienced something like this?

 Any suggestions would be helpful.

 thx,

 Lisa Wong




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



Re: Problems following symlinks

2003-11-24 Thread John Sidney-Woollett
John

In Tomcat 4.1.* you need to add the following attribute to your Resources
entry within the context entry in conf/server.xml to allow symlinks. For
example:

!-- Tomcat Root Context --
Context path= docBase=/apps/tomcat debug=0
  Resources className=org.apache.naming.resources.FileDirContext
 allowLinking=true docBase=/apps/tomcat /
/Context

This works for me on Solaris. The /apps/tomcat directory is not within the
tomcat web root (for the root context example above).

John Sidney-Woollett

John Prout said:
 Using Tomcat, I am not able to open a JSP page, when the page is a
symlink
 to another file. When I replace the symlink with the file, everything
works fine.

 Googling around, I've found some mention of Tomcat not following
symlinks
 by default, but that there's an attribute allowLinking to over-ride
this
 behavior, but I haven't been able to find where to put this.

 Does anyone know a fix to this problem?

 I am running Tomcat 4.1.? embedded in JBoss 3.2.2, running on Redhat
Linux
 9.0

 Thanks in advance

 John





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



TC 4.1.27 Bug? Redirect / - /index.jsp with jsessionid

2003-11-13 Thread John Sidney-Woollett
I hope that this is the right list to post this to. If not, apologies.

I'm having a problem with session information getting lost when Tomcat
redirects from a request to a folder, to the underlying resource (eg
../folder/index.jsp) when URLs are encoded with the session ID.

This might be a problem for sites that are encoding all URLs (using
response.encodeURL() and response.encodeRedirectURL()) when the browser
has cookies turned off, or the browser doesn't support cookies.

Here is an example of what happens:

Servlet redirects to /folder1/ using the following code:

String page = response.encodeRedirectURL(/folder1/);
response.sendRedirect(page);

OR jsp page provides a link to /folder1/ by rewriting the URL

a href=c:url value='/folder1/'Folder 1/a

When tomcat receives the request for /folder1/, it *appears* to redirect
to /folder1/index.jsp, but DOES NOT rewrite the URL.

When you end up in the /folder1/index.jsp page, the original session is
lost.

I know that a work-around is to specify the resource (ie index.jsp) rather
than the enclosing folder, but this may not be suitable in all cases.

Does this seem like a bug, and is anyone else able to confirm it?

Thanks

John Sidney-Woollett







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