tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From André Warnier>
Subject Re: mod_jk file not found
Date Thu, 13 May 2010 12:05:04 GMT
Markus Mehrwald wrote:
> Hi,
> I installed mod_jk and it works perfect except of a little strange 
> problem. I let handle tomcat everything except of static files which the 
> following lines in the virtual host for port 80 and the same for port 443:
> # Send servlet for context / jsp-examples to worker named worker1
> JkMount /* worker1
> # Static files in Tomcat webapp context directory are served by apache
> JkAutoAlias /opt/tomcat/webapps/ROOT
> JkUnMount /*.jpg  worker1
> JkUnMount /*.gif  worker1
> JkUnMount /*.png  worker1
> JkUnMount /*.js   worker1
> JkUnMount /*.css  worker1
> This works great for port 80 but for port 443 the javascript for the 
> myfaces popup component gets a http 404 
> (/faces/myFacesExtensionResource/org.apache.myfaces.renderkit.html.util.MyFacesResourceLoader/12737082/popup.HtmlPopupRenderer/JSPopup.js).

> Every other javascript can be retrieved on port 80 as well as on port 443.
> Can anyone explain how this can happen?

First, about tracing the error :
- if you bump up the JkLogLevel to "debug", you will get a lot of 
information about how mod_jk really tries to match the URL with one of 
the URLs it /should/ forward to Tomcat.  That may already give you a clue.
- if you use a plugin in the web browser such as HttpFox or 
LiveHttpHeaders (for Firefox) or Fiddler2 (for IE), you will get more 
information, from the browser point of view, about what happens.

In this case, is the 404 error returned one from Apache, or from Tomcat 
? (they have a quite different style, so you should be able to tell).
If it is from Apache, it means that the JkUnMount works, but that Apache 
then does not find that file at the indicated path, relative to Apache's 
It it is from Tomcat, then it means that mod_jk did not think that it 
matched the JkUnMount, and forwarded it to Tomcat (and Tomcat did not 
find the .js file).

Considering the above, I have to guess that for some reason, the URL
does not match the
 > JkUnMount /*.js   worker1
which causes Apache to try to serve it, and fail.

The JkMount/JkUnMount syntax is one possible way to do this kind of 
thing.  But there is another way in Apache, which personally I prefer, 
because it "fits better" with the normal Apache configuration style.
Technically, it is equivalent.  For your case above it would go as follows :

- remove or comment out all JkMount/JkUnMount directives
- add this :

<Location />
   SetHandler jakarta-servlet
   SetEnvIf REQUEST_URI "\.(js|jpg|gif|png|css)$"  no-jk

The way it works :

SetHandler jakarta-servlet : tells Apache that for all these URLs 
(matching the <Location>), mod_jk is the "handler" which should return 
the response.

SetEnvIf : matches the request URI with the given regexp, and if it 
matches, sets the internal Apache variable "no-jk" to a non-null value.

Then, when mod_jk gets the request to examine, but it sees that that the 
"no-jk" variable is set, and returns to Apache "declined", which 
essentially tells Apache "no, this was not for me, do it yourself".

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message