Mac OSX 10.3.7; Tomcat 5.5.4; JDK 1.4.2; compat installed
I have installed Tomcat 5.5.4 with a view to using it to implement a
web-based interface to a MySQL database.
I began by following the guidelines here:
http://developer.apple.com/internet/java/tomcat1.html, but as these
related to V4 of tomcat, this has served to trip me up a little. I
could not get any of the example servlets to function by following the
directions given.
I subsequently found further guidelines here:
http://www.coreservlets.com/Apache-Tomcat-Tutorial/, I have got to the
point where I can run all of the sample servlets described there.
These involve directly copying resources into the
$CATALINA_HOME/webapps/ROOT/WEB-INF(/classes) directories.
I could now develop my application and copy it to the ROOT directory
and access it through a URL like localhost:8080/hi, but this seems like
poor structure to me. I could also place the app in a subdirectory and
access it with localhost:8080/hi/servlet/hi, but that is not too tidy.
What I would like to do, and what I think is possible, is somehow to
advise tomcat of the location of my webapp in its own directory (not
under ROOT) and access it with localhost:8080/hi.
No amount of tweaking servlet mappings and URL patterns has worked, and
I suspect that somewhere I need to have a context element. (I admit
to confusion over the apparent need to specify the path both in the
context and the servlet mapping, so I've missed a big point somewhere).
The nearest I have got is to obtain an empty Directory listing for
/ page in response to my http://localhost:8080/hi request. I enabled
request logging and obtained the following:
Created MBeanServer with ID: c3e82b:10179d228c6:-8000:XarqiMac.local:1
Jan 16, 2005 5:40:16 PM org.apache.coyote.http11.Http11Protocol init
INFO: Initializing Coyote HTTP/1.1 on http-8080
Jan 16, 2005 5:40:16 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 4706 ms
Jan 16, 2005 5:40:17 PM org.apache.catalina.core.StandardService start
INFO: Starting service Catalina
Jan 16, 2005 5:40:17 PM org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/5.5.4
Jan 16, 2005 5:40:17 PM org.apache.catalina.core.StandardHost start
INFO: XML validation disabled
Jan 16, 2005 5:40:22 PM org.apache.catalina.core.ApplicationContext log
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]]
Jan 16, 2005 5:40:23 PM org.apache.catalina.core.ApplicationContext log
INFO: ContextListener: contextInitialized()
Jan 16, 2005 5:40:23 PM org.apache.catalina.core.ApplicationContext log
INFO: SessionListener: contextInitialized()
Jan 16, 2005 5:40:24 PM org.apache.catalina.core.ApplicationContext log
INFO: ContextListener: contextInitialized()
Jan 16, 2005 5:40:24 PM org.apache.catalina.core.ApplicationContext log
INFO: SessionListener: contextInitialized()
Jan 16, 2005 5:40:25 PM org.apache.coyote.http11.Http11Protocol start
INFO: Starting Coyote HTTP/1.1 on http-8080
Jan 16, 2005 5:40:27 PM org.apache.jk.common.ChannelSocket init
INFO: JK2: ajp13 listening on /0.0.0.0:8009
Jan 16, 2005 5:40:27 PM org.apache.jk.server.JkMain start
INFO: Jk running ID=0 time=0/77 config=null
Jan 16, 2005 5:40:27 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 10702 ms
Jan 16, 2005 5:40:28 PM org.apache.catalina.valves.RequestDumperValve
invoke
INFO: REQUEST URI =/hi/
Jan 16, 2005 5:40:28 PM org.apache.catalina.valves.RequestDumperValve
invoke
INFO: authType=null
Jan 16, 2005 5:40:28 PM org.apache.catalina.valves.RequestDumperValve
invoke
INFO: characterEncoding=null
Jan 16, 2005 5:40:28 PM org.apache.catalina.valves.RequestDumperValve
invoke
INFO: contentLength=-1
Jan 16, 2005 5:40:28 PM org.apache.catalina.valves.RequestDumperValve
invoke
INFO:contentType=null
Jan 16, 2005 5:40:28 PM org.apache.catalina.valves.RequestDumperValve
invoke
INFO:contextPath=/hi
Jan 16, 2005 5:40:28 PM org.apache.catalina.valves.RequestDumperValve
invoke
INFO: cookie=JSESSIONID=A1159716478A6F61B9760CCB58402392
Jan 16, 2005 5:40:28 PM org.apache.catalina.valves.RequestDumperValve
invoke
INFO: header=host=localhost:8080
Jan 16, 2005 5:40:28 PM org.apache.catalina.valves.RequestDumperValve
invoke
INFO: header=connection=keep-alive
Jan 16, 2005 5:40:28 PM org.apache.catalina.valves.RequestDumperValve
invoke
INFO: header=user-agent=Mozilla/5.0 (Macintosh; U; PPC Mac
OS X; en) AppleWebKit/125.5.5 (KHTML, like Gecko)