tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kitching Simon <Simon.Kitch...@orange.ch>
Subject RE: How to configure Tomcat to read .class files?
Date Wed, 20 Sep 2000 09:38:08 GMT
Hi,

> -----Original Message-----
> From:	Shravan Shashikant [SMTP:s0s7900@unix.tamu.edu]
> Sent:	Wednesday, September 20, 2000 12:31 AM
> To:	tomcat-user@jakarta.apache.org
> Subject:	How to configure Tomcat to read .class files?
> 
> Hi all,
>    I know this question has been asked time and again but anyway,I still
> am not sure how to get this done.I have installed Tomcat in c:\tomcat.I am
> running Apache webserver on Win 2000.I need to set a context such that
> http://mywebsite/servlets should look for servlet classes in
> c:\servlets\classes.
>    Could you tell me which files I need to update and with what?Any help
> is greatly appreciated..
> TIA,
> Shravan
	[Kitching Simon]  
	Hi,

	First of all, I would recommend that you 
	*don't* put your servlets in c:\servlets\classes.

	This is really against the letter and the spirit of
	the Sun servlet specification. Servlet code should
	go in wepapp/WEB-INF/classes directory, in
	which case it will all work immediately without
	any hacking around.

	However, if you really want your class files
	to be elsewhere, then just set up your
	CLASSPATH to point to the root directory
	of the servlet code before starting tomcat.
	By doing this, however, tomcat loses the
	ability to reload changed servlets without a
	restart.

	By default, your servlets are accessable
	via "wepapp/servlet", which is compliant
	with the sun servlet specification. If you
	really wish to use the non-standard 
	"webapp/servlets" prefix instead, then either:
	(a) modify the entry in $TOMCAT_HOME/conf/web.xml 
	that has <url-pattern>/servlet/*</url-pattern> to be
	/servlets/*, or 
	(b) copy that <servlet-mapping> entry
	to your webapp/WEB-INF/web.xml file, and then
	change servlet to servlets. This will have the effect
	that the servlets will be accessable via both
	"wepapp/servlet" and "webapp/servlets", but 
	does mean that you are only changing a 
	webapp-specific config file instead of a global
	config file.

	In order to get rid of the "/webapp" prefix when
	accessing your files, you need to edit the
	$TOMCAT_HOME/conf/server.xml file, 
	<context> entry for your webapp (or create one).
	set the path attribute to an empty string.

	Regards,

	Simon




Mime
View raw message