wood burning stoves 2.0
The moose likes Tomcat and the fly likes Tomcat url redirect problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 forum!
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Tomcat url redirect problem" Watch "Tomcat url redirect problem" New topic

Tomcat url redirect problem

Ankush Bhargava

Joined: Dec 03, 2004
Posts: 19
I am using httpd with tomcat and mod_jk

My webapp url is something like:
- which picks up the JSP from /home/webapps/myapp

But when someone else a url such as
http://localhost:8080/myapp/assets/1.gif, or
- I want tomcat to retrieve the gif from a different directory on the server -
/usr/share/my_images/1.gif and

To do this, i created a file called myapp#assets.xml, and placed it in
The content of myapp#assets.xml are -
<Context docbase="/usr/share/my_images/" path="/assets/*"></Context>

But this is not working, and the server just does not find http://localhost:8080/myapp/assets/1.gif.
What am i doing wrong?
Travis Hein
Ranch Hand

Joined: Jun 06, 2006
Posts: 161
This sounds like the JKAutoAlias apache directive for mod_jk.. see also : http://tomcat.apache.org/connectors-doc/reference/apache.html

i think when you set up the assets like that, to mean that mod_jk would allow apache to fetch the files instead of invoking tomcat, that you no longer can hit tomcat (e.g. you said going to ..:8080/....gif wasn't working.. So, wouldn't that be the direct to tomcat mode,

does, going through apache localhost:80/myapp/assets/... work ?

Error: Keyboard not attached. Press F1 to continue.
Ankush Bhargava

Joined: Dec 03, 2004
Posts: 19

Eventually what i ended up doing is -
1. unmount the folder

2. create alias in httpd to redirect urls to the specific directory

This seems to work :-)
I agree. Here's the link: http://aspose.com/file-tools
subject: Tomcat url redirect problem
jQuery in Action, 3rd edition