Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Name based virtual hosts

 
Tad Dicks
Ranch Hand
Posts: 264
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm trying to set up several virtual hosts that are based off of names in tomcat 5.0.28.

I'm using something like:
<Host name="www.someUrl.com" debug="0" appBase="someUrlwebapps" unpackWARs="true"><Alias>someUrl.com</Alias></Host>

Then I set up a directory similiar to webapps called someUrlwebapps and put it in the same directory as webapps.

When I direct a browser to www.someUrl.com I just get a blank screen (even though I have a ROOT directory under someUrlwebapps with pages in it).

I've tried moving the appbase to "webapps/someUrl" and setting that directory up like a normal webapp dir and I get the same problem.

Any idea what the problem is? It seems to know that it should be serving pages from a different directory... just its not either finding that directory... or something. Any help would be greatly appreciated.

-Tad
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How are you resolving that URL?

Do you have it registered somewhere, your hosts file?
 
Tad Dicks
Ranch Hand
Posts: 264
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The domain names are registered and I'm using 2mydns.com to have them redirected to my own IP address (all that works as expected). The incoming requests hit my router on port 80 (normal stuff) then I have my router forward the requests to port 8080 of my machine running tomcat. At first I thought maybe somewhere along the line a header was getting stripped and tomcat couldn't differentiate between requests. But I have it now to where the one domain I tried to setup on a separate host seems to redirect (I get a blank screen and not the "so you've installed tomcat" screen). I just wonder if its looking in the right directory still, or if I need to manually create a context for it. It did create directories off the working directory.

-tad
 
Tad Dicks
Ranch Hand
Posts: 264
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I just started looking at my tomcat setup at work for the last project I worked on and remembered a few things. At home (the one I'm having issues with) the "manager" application wasn't working. I looked through the webapps directory and noticed it was "missing". I figured I accidentally deleted it. Thought I would copy it from work and use it. So I looked for it, and lo and behold its missing too. Actually the manager (and admin) application is located under the server directory. This got me to thinking that for whatever reason tomcat at home can't find the server/webapps directory and probably can't find the docbases for the other hosts either? I guess my question would then be how does it find the standard localhost docbase then?

I'm guessing I need to figure out how to set a tomcat home directory on my debian box. Well I hope that fixes it.

-Tad
 
Tad Dicks
Ranch Hand
Posts: 264
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, I was wrong CATALINA_HOME is set (and set properly). So I'm lost why this isn't working.

The Manager and Admin apps (in the server/webapps directory) won't work either.

Just to try to figure out what else is going on, I changed the doc base for the localhost (default host) to something other than webapps (though I copied the same basic structure there). And I got a servlet error.

I'm running Tomcat 5.0.28 on debian, anyone have any idea whats causing this?

-Tad
 
Tad Dicks
Ranch Hand
Posts: 264
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok... the manager/admin applications are working fine now... but still the virtual host is giving me fits...

Well now instead of a blank screen I'm getting an error (I think this is a step in the right direction):

 
Tad Dicks
Ranch Hand
Posts: 264
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok... I figured out my error. I copied the web.xml file from the "default" install root directory into the root directory of the appbase of my other host =/ oops.
Now it works =)

-Tad
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic