tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Geoffrey Charters <g.chart...@auckland.ac.nz>
Subject [Newbie] Failed access to servlet via URL mapping (context setting problem?)
Date Sun, 16 Jan 2005 04:47:21 GMT
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) Safari/125.12
> Jan 16, 2005 5:40:28 PM org.apache.catalina.valves.RequestDumperValve 
> invoke
> INFO:             header=accept=*/*
> Jan 16, 2005 5:40:28 PM org.apache.catalina.valves.RequestDumperValve 
> invoke
> INFO:             header=accept-encoding=gzip, deflate;q=1.0, 
> identity;q=0.5, *;q=0
> Jan 16, 2005 5:40:28 PM org.apache.catalina.valves.RequestDumperValve 
> invoke
> INFO:             header=accept-language=en, ja;q=0.61, ru;q=0.93, 
> de-de;q=0.89, de;q=0.86, fr;q=0.82, nl-nl;q=0.79, nl;q=0.75, 
> it-it;q=0.71, it;q=0.68, ja-jp;q=0.64, ru-ru;q=0.96, es;q=0.57, 
> da-dk;q=0.54, da;q=0.50, fi-fi;q=0.46, fi;q=0.43, ko-kr;q=0.39, 
> ko;q=0.36
> Jan 16, 2005 5:40:28 PM org.apache.catalina.valves.RequestDumperValve 
> invoke
> INFO:             
> header=cookie=JSESSIONID=A1159716478A6F61B9760CCB58402392
> Jan 16, 2005 5:40:28 PM org.apache.catalina.valves.RequestDumperValve 
> invoke
> INFO:             locale=en
> Jan 16, 2005 5:40:28 PM org.apache.catalina.valves.RequestDumperValve 
> invoke
> INFO:             method=GET
> Jan 16, 2005 5:40:28 PM org.apache.catalina.valves.RequestDumperValve 
> invoke
> INFO:           pathInfo=null
> Jan 16, 2005 5:40:28 PM org.apache.catalina.valves.RequestDumperValve 
> invoke
> INFO:           protocol=HTTP/1.1
> Jan 16, 2005 5:40:28 PM org.apache.catalina.valves.RequestDumperValve 
> invoke
> INFO:        queryString=null
> Jan 16, 2005 5:40:28 PM org.apache.catalina.valves.RequestDumperValve 
> invoke
> INFO:         remoteAddr=127.0.0.1
> Jan 16, 2005 5:40:28 PM org.apache.catalina.valves.RequestDumperValve 
> invoke
> INFO:         remoteHost=127.0.0.1
> Jan 16, 2005 5:40:28 PM org.apache.catalina.valves.RequestDumperValve 
> invoke
> INFO:         remoteUser=null
> Jan 16, 2005 5:40:28 PM org.apache.catalina.valves.RequestDumperValve 
> invoke
> INFO: requestedSessionId=A1159716478A6F61B9760CCB58402392
> Jan 16, 2005 5:40:28 PM org.apache.catalina.valves.RequestDumperValve 
> invoke
> INFO:             scheme=http
> Jan 16, 2005 5:40:28 PM org.apache.catalina.valves.RequestDumperValve 
> invoke
> INFO:         serverName=localhost
> Jan 16, 2005 5:40:28 PM org.apache.catalina.valves.RequestDumperValve 
> invoke
> INFO:         serverPort=8080
> Jan 16, 2005 5:40:28 PM org.apache.catalina.valves.RequestDumperValve 
> invoke
> INFO:        servletPath=/
> Jan 16, 2005 5:40:28 PM org.apache.catalina.valves.RequestDumperValve 
> invoke
> INFO:           isSecure=false
> Jan 16, 2005 5:40:28 PM org.apache.catalina.valves.RequestDumperValve 
> invoke
> INFO: ---------------------------------------------------------------
> Jan 16, 2005 5:40:28 PM org.apache.catalina.valves.RequestDumperValve 
> invoke
> INFO: ---------------------------------------------------------------
> 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:      contentLength=-1
> Jan 16, 2005 5:40:28 PM org.apache.catalina.valves.RequestDumperValve 
> invoke
> INFO:        contentType=text/html;charset=UTF-8
> Jan 16, 2005 5:40:28 PM org.apache.catalina.valves.RequestDumperValve 
> invoke
> INFO:            message=null
> Jan 16, 2005 5:40:28 PM org.apache.catalina.valves.RequestDumperValve 
> invoke
> INFO:         remoteUser=null
> Jan 16, 2005 5:40:28 PM org.apache.catalina.valves.RequestDumperValve 
> invoke
> INFO:             status=200
> Jan 16, 2005 5:40:28 PM org.apache.catalina.valves.RequestDumperValve 
> invoke
> INFO: ===============================================================

The line:
>  INFO:        servletPath=/
suggests to me that somehow the URL (/hi) is not being passed through 
as I would hope.

If someone could take the time to point a newbie in the right 
direction, I'd be very appreciative.

Thanks.


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Mime
View raw message