You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by "Gilson do N. D'Elrei" <gi...@uol.com.br> on 2001/06/02 16:11:26 UTC
a newbie question...
hello all,
I have made a simple servlet (HelloWorldServlet2) and added it on my WEB-INF/Classes context. When I try to execute it using the url below:
http://server:8080/mycontext/servlets/HelloWorldServlet2
i received "not found (404)" error. I tried also:
http://server:8080/mycontext/HelloWorldServlet2
http://server:8080/mycontext/WEB-INF/Classes/HelloWorldServlet2
but I continue to receiving the same error.
My tomcat installation is ok, cos i get to execute the examples servlet files and others.
I have added these lines in the server.xml file
<Context path="/mycontext"
docBase="webapps/mycontext"
debug="0"
reloadable="true" >
</Context>
and updated these lines in the tomcat.conf (only more a trying... )
############################## Context mapping - you need to "deploy"
# ( copy or ln -s ) the context into htdocs
##
ApJservMount /mycontext/servlet /root
<Location /mycontext/WEB-INF/ >
AllowOverride None
deny from all
</Location>
thanks in advance.
Re: a newbie question...
Posted by Bo Xu <bo...@cybershop.ca>.
"Gilson do N. D'Elrei" wrote:
> hello all,I have made a simple servlet (HelloWorldServlet2) and added
> it on my WEB-INF/Classes context. When I try to execute it using the
> url below: http://server:8080/mycontext/servlets/HelloWorldServlet2 i
> received "not found (404)" error. I tried
> also: http://server:8080/mycontext/HelloWorldServlet2http://server:8080/mycontext/WEB-INF/Classes/HelloWorldServlet2but
> I continue to receiving the same error.My tomcat installation is ok,
> cos i get to execute the examples servlet files and others.
> [...]
Hi :-)
*
- if we don't set servlet-maping in WEB-INF/web.xml, now it means
we will use the "Non-standard invoker, for backward compat" syntax
to invoke MyServlet class, like the following:
http://[server]:[port]/[ContextName]/[invokerName]/[ServletName/servlet-declarationName]
- and if we also don't change the "Non-standard invoker" in
conf/server.html,
it means now we will use the "default one": it is "/servlet/"
so now the sytax should be:
http://[server]:[port]/[ContextName]/servlet/[ServletName/servlet-declarationName]
(it is not "/servlets/", it is "/servlet/")
*
- if you Do change the "RequestInterceptor" from "/servlet/" to
"/servlets/", your 1st syntax will be right .
- if you define a servlet-declaration in WEB-INF/web.xml, you also
can use the following syntax:
http://[server]:[port]/[ContextName]/[invokerName]/[servlet-declarationName]
- if you define a servlet-mapping in WEB-INF/web.xml and you also
want to use it now,
now it means you will Not use invokerName, you will directly use
the following syntax:
http://[server]:[port]/[ContextName]/[servlet-mappingName]
(* ContextName is defined in conf/server.xml)
* the following is from conf/server.xml of jakarta-tomcat-3.2.1, but I
don't
find it in TC4.0-b5, I guess it means:
- TC4.0-b5 still use "/servlet/" as default "Non-standard invoker"
- but Only when I try to change it, then I have to write them in
conf/server.xml,
otherwise I don't need to write. is it right? thanks!
...
<!-- Non-standard invoker, for backward compat. ( /servlet/* )
You can modify the prefix that is matched by adjusting the
"prefix" parameter below. Be sure your modified pattern
starts and ends with a slash.
NOTE: This prefix applies to *all* web applications that
are running in this instance of Tomcat.
-->
<RequestInterceptor
className="org.apache.tomcat.request.InvokerInterceptor"
debug="0" prefix="/servlet/" />
...
have a nice day! :-)
Bo
June.02, 2001