tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From André Warnier ...@ice-sa.com>
Subject Re: Apache mod_jk and Tomcat not working correctly
Date Mon, 27 Oct 2008 08:20:19 GMT
Hi.
Forget my earlier response, and look at Rainer's.
He spotted what I did not, in your JkMount.
You don't have any JkMount that will match /dwr-examples/dwr, and that 
is the problem.
But go back, read Rainer's answer, do the different things that he says 
(cleaning up mostly), and read the stuff below if you still do not get it.


the Why :

When Apache gets asked for a URL, and it realises that this URL 
corresponds to a directory (not a file), it will :
- try and locate, in that directory, a document that matches one of the 
ones indicated in its "DirectoryIndex" directive.  If it finds one, it 
will return it to the browser, and he's done.
- if it doesn't, it will look if he's authorised to create himself a 
directory list of files (Options Indexes).  If he is, he will create 
such a document, send it back to the browser, and he's done.
- if the above all fails, Apache returns a "not found" error.
That's a bit simplified, but it's the idea.

What probably happens in your case :
1) You enter the URL "http://localhost/dwr-examples/"
2) Apache gets this request, and tries to match /dwr-examples/ with all 
your Alias and JkMount directives.
3) It does not find a match with JkMount, but finds a match with your 
Alias directive :
Alias /dwr-examples "/www/tomcat5/webapps/dwr-examples/"
4) So it serves this content itself.  It looks in 
"/www/tomcat5/webapps/dwr-examples/" to find a "DirectoryIndex" file 
(you did not say what you put there).  Suppose it finds one there, 
called "index.html". It sends it to the browser and he's done.
5) Now something in this file tells the browser to load the page 
"http://localhost/dwr-examples/dwr", so it does.
(I am guessing here, but you should be able to see what happens, in 
sequence, in your Apache access log)
6) Apache gets this new request (for "/dwr-examples/dwr"), and starts 
again trying to match it with Alias and JkMount.  It again does not 
match any JkMount, but it does match the same Alias as before, so Apache 
tries to serve this new request from the directory 
"/www/tomcat5/webapps/dwr-examples/" (loking for "dwr" in there).
7) It does not find anything there called "dwr", so it returns the error 
you are seeing in the log.

By doing what Rainer is recommending :
JkMount /dwr-examples/* workername
and then "un-mounting" selected parts of that, like
JkUnMount /dwr-examples/*.html workername
...
you avoid the above, because your call to
"/dwr-examples/dwr" will now match the first JkMount, so it will be 
re-directed to Tomcat (and Apache will not try to do it itself), and 
Tomcat (presumably) knows what to do with "/dwr-examples/dwr".





Wayne Bragg wrote:
> Apache is suppose to serve /dwr-examples and /dwr-examples/dwr just not 
> any jsp or jspx that is called for
> 
>> Alias /dwr-examples "/www/tomcat5/webapps/dwr-examples/"
>> also covers URLs like "/dwr-examples/dwr", and so it is Apache trying to
>> serve it, it is never re-directed to Tomcat by mod_jk, it does not even
>> get that far.
> 
> I kind of get what you are saying and will try
> 
>> AliasMatch /dwr-examples/(.*\.(html?|jpg|php))$
>> /www/tomcat5/webapps/dwr-examples/$1
>>
>> (I put html?|jog|php .. because I don't remember how to say "not .jsp")
> 
> but the alias structure I posted is the way I always had it and it 
> worked, but not before I made some other fixes that I don't remember.
> 
> I'm not quite understanding what you want me to try though.
> Do you mean get rid of the current Alias code and replace it with
> 
> AliasMatch /dwr-examples/(.*\.(html?|jpg|php))$ 
> /www/tomcat5/webapps/dwr-examples/$1
> 
> or use it in addition to it and where exactly should it go?
> Prior to the JkMount /dwr-examples/*.jsp ajp13worker1
> 
> Forgive me for being so dense but this is new to me!
> 
> ----- Original Message ----- From: "André Warnier" <aw@ice-sa.com>
> To: "Tomcat Users List" <users@tomcat.apache.org>
> Sent: Sunday, October 26, 2008 6:36 PM
> Subject: Re: Apache mod_jk and Tomcat not working correctly
> 
> 
>> I think your Alias at the beginning has "more priority" than your
>> JkMount later.
>> Not that the order in the config file matters, that's not what I mean.
>> What I mean is :
>> Alias /dwr-examples "/www/tomcat5/webapps/dwr-examples/"
>> also covers URLs like "/dwr-examples/dwr", and so it is Apache trying to
>> serve it, it is never re-directed to Tomcat by mod_jk, it does not even
>> get that far.
>> Try maybe (one line)
>> AliasMatch /dwr-examples/(.*\.(html?|jpg|php))$
>> /www/tomcat5/webapps/dwr-examples/$1
>>
>> (I put html?|jog|php .. because I don't remember how to say "not .jsp")
>>
>>
>> Wayne Bragg wrote:
>>> I guess I need to add, going through http port 80 works with no errors
>>> for everything except .jsp to tomcat
>>>
>>> ----- Original Message ----- From: "Martin Gainty" <mgainty@hotmail.com>
>>> To: "Tomcat Users List" <users@tomcat.apache.org>
>>> Sent: Sunday, October 26, 2008 5:41 PM
>>> Subject: RE: Apache mod_jk and Tomcat not working correctly
>>>
>>>
>>>
>>> Please confirm this parameter in $APACHE_HOME/conf/httpd.conf
>>> Listen 80
>>>
>>> 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.
>>>
>>>
>>>> From: wlbragg@cox.net
>>>> To: users@tomcat.apache.org
>>>> Subject: Apache mod_jk and Tomcat not working correctly
>>>> Date: Sun, 26 Oct 2008 17:17:13 -0500
>>>>
>>>> my setup:
>>>>     WinXP Home
>>>>     Wed-Dev install of:
>>>>         Apache/2.2.3 (Win32)
>>>>         Tomcat 5
>>>>         PHP 5.2.0
>>>>
>>>> I have mod_jk connector set up the following way according to
>>>> instructions:
>>>>
>>>> Alias /dwr-examples "/www/tomcat5/webapps/dwr-examples/"
>>>>
>>>>  <Directory "/www/tomcat5/webapps/dwr-examples/">
>>>>   Options Indexes FollowSymLinks
>>>>   AllowOverride None
>>>>   Order deny,allow
>>>>   Deny from all
>>>>   Allow from all
>>>>
>>>>   AddType text/html .php .phps
>>>>   AddHandler application/x-httpd-php .php
>>>>   AddHandler application/x-httpd-php-source .phps
>>>>  </Directory>
>>>>
>>>> mod_jk setup:
>>>>     LoadModule jk_module modules/mod_jk.so
>>>>
>>>> <IfModule jk_module>
>>>>      JkWorkersFile conf/Suite-extra/workers.properties
>>>>      JkLogFile logs/mod_jk.log
>>>>      JkLogLevel warn
>>>>      JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "
>>>>      JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories
>>>>      JkRequestLogFormat "%w %V %T"
>>>>
>>>>     <Location /*/WEB-INF/*>
>>>>          # AllowOverride None
>>>>           deny from all
>>>>      </Location>
>>>>
>>>>     JkMount /dwr-examples/*.jsp ajp13worker1
>>>>     JkMount /dwr-examples/*.jspx ajp13worker1
>>>>     JkUnMount /dwr-examples/*.html  ajp13worker1
>>>>     JkUnMount /dwr-examples/*.htm  ajp13worker1
>>>>     JkUnMount /dwr-examples/*.png  ajp13worker1
>>>>     JkUnMount /dwr-examples/*.jpg  ajp13worker1
>>>>     JkUnMount /dwr-examples/*.jpeg  ajp13worker1
>>>>     JkUnMount /dwr-examples/*.gif  ajp13worker1
>>>>     JkUnMount /dwr-examples/*.ico  ajp13worker1
>>>>     JkUnMount /dwr-examples/*.php  ajp13worker1
>>>>
>>>> </IfModule>
>>>>
>>>> Everthing works using port 8080 but I am getting the following error
>>>> in the
>>>> error.log in Apache when I use port
>>>> 80 ie: http://localhost:8080/dwr-examples/ vs
>>>> http://localhost/dwr-examples/
>>>>
>>>>
>>>> [Sun Oct 26 15:11:32 2008] [notice] ModSecurity for Apache 2.0.4
>>>> configured
>>>> [Sun Oct 26 15:11:34 2008] [notice] Apache/2.2.3 (Win32) PHP/5.2.0
>>>> mod_ssl/2.2.3 OpenSSL/0.9.8d mod_jk/1.2.19 mod_perl/2.0.3-dev 
>>>> Perl/v5.8.8
>>>> configured -- resuming normal operations
>>>> [Sun Oct 26 15:11:34 2008] [notice] Server built: Nov 15 2006 21:34:51
>>>> [Sun Oct 26 15:11:34 2008] [notice] Parent: Created child process 268
>>>> [Sun Oct 26 15:11:36 2008] [notice] ModSecurity for Apache 2.0.4
>>>> configured
>>>> [Sun Oct 26 15:11:38 2008] [notice] Child 268: Child process is running
>>>> [Sun Oct 26 15:11:38 2008] [notice] Child 268: Acquired the start 
>>>> mutex.
>>>> [Sun Oct 26 15:11:38 2008] [notice] Child 268: Starting 250 worker
>>>> threads.
>>>> [Sun Oct 26 15:11:38 2008] [notice] Child 268: Starting thread to
>>>> listen on
>>>> port 443.
>>>> [Sun Oct 26 15:11:38 2008] [notice] Child 268: Starting thread to
>>>> listen on
>>>> port 80.
>>>> [Sun Oct 26 15:11:51 2008] [error] [client 127.0.0.1] File does not
>>>> exist:
>>>> C:/www/tomcat5/webapps/dwr-examples/dwr, referer:
>>>> http://localhost/dwr-examples/
>>>> [Sun Oct 26 15:11:51 2008] [error] [client 127.0.0.1] File does not
>>>> exist:
>>>> C:/www/tomcat5/webapps/dwr-examples/dwr, referer:
>>>> http://localhost/dwr-examples/
>>>> [Sun Oct 26 15:11:51 2008] [error] [client 127.0.0.1] File does not
>>>> exist:
>>>> C:/www/tomcat5/webapps/dwr-examples/dwr, referer:
>>>> http://localhost/dwr-examples/
>>>> [Sun Oct 26 15:11:52 2008] [error] [client 127.0.0.1] File does not
>>>> exist:
>>>> C:/www/webroot/favicon.ico
>>>> [Sun Oct 26 15:11:55 2008] [error] [client 127.0.0.1] File does not
>>>> exist:
>>>> C:/www/webroot/favicon.ico
>>>>
>>>> Where /DWR is a servlet in Tomcat that works properly under port:8080
>>>>
>>>> When I installed this originally I had the same trouble and through 
>>>> great
>>>> effort got it working right. Then I built an elaborate webapp and lost
>>>> the
>>>> drive. The
>>>> backup I had was only of the webapp and not the server setup, dumb me!
>>>>
>>>> One of the things I thought I had to do for some reason, maybe not
>>>> related
>>>> to this problem, was remove a security rule or two from either 
>>>> apache or
>>>> tomcat because it was causing a problem.
>>>> I also am getting this from the stdout_.log and don't know if this is
>>>> related.
>>>>
>>>> INFO: org.apache.webapp.balancer.BalancerFilter: init(): ruleChain:
>>>> [org.apache.webapp.balancer.RuleChain:
>>>> [org.apache.webapp.balancer.rules.URLStringMatchRule: Target string:
>>>> News /
>>>> Redirect URL: http://www.cnn.com],
>>>> [org.apache.webapp.balancer.rules.RequestParameterRule: Target param
>>>> name:
>>>> paramName / Target param value: paramValue / Redirect URL:
>>>> http://www.yahoo.com],
>>>> [org.apache.webapp.balancer.rules.AcceptEverythingRule: Redirect URL:
>>>> http://jakarta.apache.org]]
>>>>
>>>> Unfortunatly I don't know much if anything about the security rules?
>>>> Anyone
>>>> see anything that is obviously wrong?
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To start a new topic, e-mail: users@tomcat.apache.org
>>>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>>>> For additional commands, e-mail: users-help@tomcat.apache.org
>>>>
>>>
>>> _________________________________________________________________
>>> Want to read Hotmail messages in Outlook? The Wordsmiths show you how.
>>> http://windowslive.com/connect/post/wedowindowslive.spaces.live.com-Blog-cns!20EE04FBC541789!167.entry?ocid=TXT_TAGLM_WL_hotmail_092008

>>>
>>>
>>>
>>>
>>> --------------------------------------------------------------------------------

>>>
>>>
>>>
>>>
>>>
>>> No virus found in this incoming message.
>>> Checked by AVG - http://www.avg.com
>>> Version: 8.0.175 / Virus Database: 270.8.3/1747 - Release Date:
>>> 10/26/2008 9:27 AM
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To start a new topic, e-mail: users@tomcat.apache.org
>>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>>> For additional commands, e-mail: users-help@tomcat.apache.org
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To start a new topic, e-mail: users@tomcat.apache.org
>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>>
> 
> 
> -------------------------------------------------------------------------------- 
> 
> 
> 
> 
> No virus found in this incoming message.
> Checked by AVG - http://www.avg.com
> Version: 8.0.175 / Virus Database: 270.8.3/1748 - Release Date: 
> 10/26/2008 7:53 PM
> 
> 
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message