After reading more explanations and documentation about what to put in the server.xml file, and the answer to my last post below (see "Confused on a higher plane - Tomcat"), I STILL can't seem to make head nor tail of specifically what goes where in the <host> section of the server.xml file.
The relevant facts about my site are: I am running on a dedicated server set up by my web host (which doesn't provide tech support related to Tomcat or Apache). I am running Tomcat 4.06 with Apache 2.0.(X) under Linux. I am trying to get Tomcat to handle servlets. My domain name is registered, but not yet assigned to the URL number of the server, so I have to type in http://myURLnumber/mydomainname/ to access the site (don't know if this effects anyting in server.xml or not). The complete pathname to my site, which is a name based virtual site, is /home/virtual/site1/fst/var/www/html Within that directory are, as a far as I know, all the elements that are considered a "web application" including all my html files, a web.xml file, and a WEB-INF folder which contains lib,jsp,and classes folders (the servlet class fiels are in the latter).
The first host - /host section was there already, it was my understanding that this had to stay there to define a default host for Tomcat to try in the absence of anything else (there is another webapp directory structure there in /var/www/html with a default placemarker html page in it, put there by the web host).
The second host - /host section is my attempt to tell Tomcat where I want it to go to get the servlets. I also tried Context path="/mydomainname" (left off the URL number) and a few other minor variations with no luck. I am trying to get a helloworld servlet by typing in http://myURLnumber/mydomainname/servlet/helloworld
The web.xml file seems to be set up OK, the helloworld servlet is listed in there and I am using the correct name for it.
All I get are error messages in the browser that say: The requested URL /~admin1/servlet/HelloWorldExample was not found on this server.
The Apache logs read "File does not exist: /home/virtual/site1/fst/var/www/html/servlet
Apache apparently does not forward the request to Tomcat, which I am guessing it should do for all requests to your namespace. Given that, the server.xml file probably has nothing to do with the problem, because Tomcat never sees the request. I haven't set up an Apache/Tomcat combo in a long time, so I can't speculate what might be wrong with that.
BTW, I would advise not to use the implicit servlet declaration using "servlet/classname", but to properly register and map your servlet in your web.xml file.
As far as I can tell, the name in the Host element must match exactly the way your site is addressed so if you use a numeric address, thats what has to appear in Host name I have Tomcat serving hosts directly so I don't know what complexities Apache introduces. Bill
Joined: Mar 30, 2005
Re: The Host name - in the first line of the host element,
Host name="_________" appbase="__________"
(Again, I've taken out the "<" ">" symbols because the software running this bulletin board likes to reject things with html tags).
Is the name supposed to be "/myURLnumber/mydomainame"? If so, what is the Context path=______ supposed to be on the next line?
Re: Apache not calling Tomcat - That may be the case, and I'm trying to find out why. Tomcat's error logs in Catalina.out don't report on anything other than the fact that I turned Tomcat off and on again. I noticed that and the statements in Apache error logs before, and thought maybe the fact that the Tomcat server.xml and web.xml files weren't set up to do anyting with my webbb app were causing it to ignore Apche's requests or something. Anyone have any ideas?
Author and all-around good cowpoke
Joined: Mar 22, 2000
Is the name supposed to be "/myURLnumber/mydomainame"?
I admit to being totally mystified by that usage. The way I am supporting multiple hosts uses the host domain - like this:
The WROX publication _Professional Apache Tomcat 5_ has a section on configuring Apache to work with virtual hosts on Tomcat in chapt 16. Bill
Joined: Mar 30, 2005
"/myURLnumber/mydomainame" is what I have to type in the browser to get to my dedicated server. The reason for that is that "mydomainame" is not yet registered with that server. "Mydomainame" is currently registered with a different, shared server (which doesn't support Tomcat, Java, etc.), which is where my active site currently resides. I don't want to change the registration until I have everything working properly on, and everything transferred to, the new serever.
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com