You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by MBP <mb...@back-bone.dk> on 2000/09/06 17:17:25 UTC
How can I place servlets in a directory different from tomcat/webapps?
Hi
I know several people has asked about this before, but all the threads seem
to end before a clear answer emerges. At least they never get clear enough
for me to understand.
Problem:
I would like to place my servlets in C:\bb_projekt\byg\servlets
html files, images etc. go in C:\bb_projekt\byg\htdocs
Attempts:
After getting myself confused reading Tomcat's User guide, Tomcat
Minimalistic User Guide, part of Servlet specifications and an uncounted
number of mails in mailing lists, I now know I have to edit server.xml,
httpd.conf, tomcat-apache.conf and possibly web.xml.
In httpd.conf I add a virtual server:
NameVirtualHost 192.168.0.231:80
<VirtualHost 192.168.0.231>
ServerAdmin mbp@bb.dk
DocumentRoot /bb_projekt/byg/htdocs
ServerName mbp.byg.int
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory "C:/bb_projekt/byg/htdocs">
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
Allow from all
</Directory>
ScriptAlias /cgi-bin/ "C:/bb_projekt/byg/cgi-bin/"
<Directory "C:/bb_projekt/byg/cgi-bin">
AllowOverride None
Options None
</Directory>
ErrorLog logs/byg_error.log
CustomLog logs/byg_access.log common
</VirtualHost>
In Tomcat-apache.conf I copy one of the example mappings and edit it:
### Byg servlets mapping
Alias /byg "C:/bb_projekt/byg"
<Directory "C:/bb_projekt/byg">
Options Indexes FollowSymLinks
</Directory>
ApJServMount /byg/servlets /byg
<Location /byg/servlets/ >
AllowOverride None
deny from all
</Location>
In server.xml I add a new context:
<Context path="/byg" docBase="c:/bb_projekt/byg/servlets" debug="0"
reloadable="true" >
</Context>
In C:\bb_projekt\byg\servlets there is a bygsetupservlet.class
What works:
The virtual host is working fine.
I can run Tomcat HelloWorldExample servlet in both Tomcat and thru Apache
I can run my own servlet thru Apache if I place it in the Tomcat examples
directory
What doesn't work:
Any servlet placed in c:\bb_projekt\byg\servlets
In the error log I keep getting messages like this:
[Wed Sep 06 14:53:13 2000] [error] [client 192.168.0.231] File does not
exist: c:/bb_projekt/byg/servlets/bygsetupservlet
So my question is: am I just stupid, have I missed some obscure detail or is
this really hard to get to work?
Whatever the answer to that is, what can I do to get this thing to work?
TIA
Best regards
Michael
Michael Bjerregaard Pedersen, senior software engineer
------------------------------------------------------
Backbone Digital Systems
Ryesgade 19A
DK-2200 Copenhagen N
Tlf. 35 245 245
Re[2]: How can I place servlets in a directory different from tomcat/webapps?
Posted by Rui Oliveira <ol...@milu.ipn.pt>.
In order to get the servlets to run on a directory different from
tomcat/webapps one must place the Servlet in a web-inf/classes
directory under the desired context. And you must have a web.xml file
inside the web-inf directory from that context.
Example:
context=xpto
servlet directory: xpto/web-inf/classes
web.xml placement: xpto/web-inf/web.xml
PS: You must have your context defined in the server.xml config file.
Best Regards
Rui Oliveira
On Wed, 6 Sep 2000 17:12:56 +0100
"Richard Evans" <rd...@webtrak.co.uk> wrote:
> I don't think there's any easy way to do this. The servlet API implemented
> by tomcat defines the "webapp" structure for pages and classes.
>
> This bugged me too, so I looked at the sources (3.2b3). I was able to make
> a small change to one of the source files to allow extra attributes in the
> <Context> tag to define additional class repositories and a different htdocs
> base. It allows us to use tomcat with out existing directory structure,
> designed for a different app server, which has config files, servlet classes
> and pages in different places.
>
> Richard
>
> -----Original Message-----
> From: MBP [mailto:mbp@back-bone.dk]
> Sent: 06 September 2000 16:17
> To: tomcat-user@jakarta.apache.org
> Subject: How can I place servlets in a directory different from
> tomcat/webapps?
>
>
> Hi
> I know several people has asked about this before, but all the threads seem
> to end before a clear answer emerges. At least they never get clear enough
> for me to understand.
>
> Problem:
> I would like to place my servlets in C:\bb_projekt\byg\servlets
> html files, images etc. go in C:\bb_projekt\byg\htdocs
>
> Attempts:
> After getting myself confused reading Tomcat's User guide, Tomcat
> Minimalistic User Guide, part of Servlet specifications and an uncounted
> number of mails in mailing lists, I now know I have to edit server.xml,
> httpd.conf, tomcat-apache.conf and possibly web.xml.
>
> In httpd.conf I add a virtual server:
>
> NameVirtualHost 192.168.0.231:80
> <VirtualHost 192.168.0.231>
> ServerAdmin mbp@bb.dk
> DocumentRoot /bb_projekt/byg/htdocs
> ServerName mbp.byg.int
>
> <Directory />
> Options FollowSymLinks
> AllowOverride None
> </Directory>
> <Directory "C:/bb_projekt/byg/htdocs">
> Options Indexes FollowSymLinks MultiViews
> AllowOverride None
> Order allow,deny
> Allow from all
> </Directory>
>
> ScriptAlias /cgi-bin/ "C:/bb_projekt/byg/cgi-bin/"
>
> <Directory "C:/bb_projekt/byg/cgi-bin">
> AllowOverride None
> Options None
> </Directory>
>
> ErrorLog logs/byg_error.log
> CustomLog logs/byg_access.log common
>
> </VirtualHost>
>
>
> In Tomcat-apache.conf I copy one of the example mappings and edit it:
>
> ### Byg servlets mapping
> Alias /byg "C:/bb_projekt/byg"
> <Directory "C:/bb_projekt/byg">
> Options Indexes FollowSymLinks
> </Directory>
> ApJServMount /byg/servlets /byg
> <Location /byg/servlets/ >
> AllowOverride None
> deny from all
> </Location>
>
>
> In server.xml I add a new context:
>
> <Context path="/byg" docBase="c:/bb_projekt/byg/servlets" debug="0"
> reloadable="true" >
> </Context>
>
> In C:\bb_projekt\byg\servlets there is a bygsetupservlet.class
>
>
>
> What works:
> The virtual host is working fine.
> I can run Tomcat HelloWorldExample servlet in both Tomcat and thru Apache
> I can run my own servlet thru Apache if I place it in the Tomcat examples
> directory
>
>
> What doesn't work:
> Any servlet placed in c:\bb_projekt\byg\servlets
> In the error log I keep getting messages like this:
> [Wed Sep 06 14:53:13 2000] [error] [client 192.168.0.231] File does not
> exist: c:/bb_projekt/byg/servlets/bygsetupservlet
>
>
>
> So my question is: am I just stupid, have I missed some obscure detail or is
> this really hard to get to work?
>
> Whatever the answer to that is, what can I do to get this thing to work?
>
> TIA
>
> Best regards
> Michael
>
>
> Michael Bjerregaard Pedersen, senior software engineer
> ------------------------------------------------------
> Backbone Digital Systems
> Ryesgade 19A
> DK-2200 Copenhagen N
> Tlf. 35 245 245
>
>
>
RE: How can I place servlets in a directory different from tomcat/webapps?
Posted by "Abhilash V. Sonwane" <ab...@elitecore.com>.
In the error log I keep getting messages like this:
[Wed Sep 06 14:53:13 2000] [error] [client 192.168.0.231] File does not
exist: c:/bb_projekt/byg/servlets/bygsetupservlet
Well the file does not exist but the file
c:\bb_projekt\byg\servlets\bygsetupservlet exists
got it
replace / with \ for windows file path separator
-----Original Message-----
From: MBP [mailto:mbp@back-bone.dk]
Sent: Wednesday, September 06, 2000 8:47 PM
To: tomcat-user@jakarta.apache.org
Subject: How can I place servlets in a directory different from
tomcat/webapps?
Hi
I know several people has asked about this before, but all the threads seem
to end before a clear answer emerges. At least they never get clear enough
for me to understand.
Problem:
I would like to place my servlets in C:\bb_projekt\byg\servlets
html files, images etc. go in C:\bb_projekt\byg\htdocs
Attempts:
After getting myself confused reading Tomcat's User guide, Tomcat
Minimalistic User Guide, part of Servlet specifications and an uncounted
number of mails in mailing lists, I now know I have to edit server.xml,
httpd.conf, tomcat-apache.conf and possibly web.xml.
In httpd.conf I add a virtual server:
NameVirtualHost 192.168.0.231:80
<VirtualHost 192.168.0.231>
ServerAdmin mbp@bb.dk
DocumentRoot /bb_projekt/byg/htdocs
ServerName mbp.byg.int
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory "C:/bb_projekt/byg/htdocs">
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
Allow from all
</Directory>
ScriptAlias /cgi-bin/ "C:/bb_projekt/byg/cgi-bin/"
<Directory "C:/bb_projekt/byg/cgi-bin">
AllowOverride None
Options None
</Directory>
ErrorLog logs/byg_error.log
CustomLog logs/byg_access.log common
</VirtualHost>
In Tomcat-apache.conf I copy one of the example mappings and edit it:
### Byg servlets mapping
Alias /byg "C:/bb_projekt/byg"
<Directory "C:/bb_projekt/byg">
Options Indexes FollowSymLinks
</Directory>
ApJServMount /byg/servlets /byg
<Location /byg/servlets/ >
AllowOverride None
deny from all
</Location>
In server.xml I add a new context:
<Context path="/byg" docBase="c:/bb_projekt/byg/servlets" debug="0"
reloadable="true" >
</Context>
In C:\bb_projekt\byg\servlets there is a bygsetupservlet.class
What works:
The virtual host is working fine.
I can run Tomcat HelloWorldExample servlet in both Tomcat and thru Apache
I can run my own servlet thru Apache if I place it in the Tomcat examples
directory
What doesn't work:
Any servlet placed in c:\bb_projekt\byg\servlets
In the error log I keep getting messages like this:
[Wed Sep 06 14:53:13 2000] [error] [client 192.168.0.231] File does not
exist: c:/bb_projekt/byg/servlets/bygsetupservlet
So my question is: am I just stupid, have I missed some obscure detail or is
this really hard to get to work?
Whatever the answer to that is, what can I do to get this thing to work?
TIA
Best regards
Michael
Michael Bjerregaard Pedersen, senior software engineer
------------------------------------------------------
Backbone Digital Systems
Ryesgade 19A
DK-2200 Copenhagen N
Tlf. 35 245 245
RE: How can I place servlets in a directory different from tomcat/webapps?
Posted by Richard Evans <rd...@webtrak.co.uk>.
I don't think there's any easy way to do this. The servlet API implemented
by tomcat defines the "webapp" structure for pages and classes.
This bugged me too, so I looked at the sources (3.2b3). I was able to make
a small change to one of the source files to allow extra attributes in the
<Context> tag to define additional class repositories and a different htdocs
base. It allows us to use tomcat with out existing directory structure,
designed for a different app server, which has config files, servlet classes
and pages in different places.
Richard
-----Original Message-----
From: MBP [mailto:mbp@back-bone.dk]
Sent: 06 September 2000 16:17
To: tomcat-user@jakarta.apache.org
Subject: How can I place servlets in a directory different from
tomcat/webapps?
Hi
I know several people has asked about this before, but all the threads seem
to end before a clear answer emerges. At least they never get clear enough
for me to understand.
Problem:
I would like to place my servlets in C:\bb_projekt\byg\servlets
html files, images etc. go in C:\bb_projekt\byg\htdocs
Attempts:
After getting myself confused reading Tomcat's User guide, Tomcat
Minimalistic User Guide, part of Servlet specifications and an uncounted
number of mails in mailing lists, I now know I have to edit server.xml,
httpd.conf, tomcat-apache.conf and possibly web.xml.
In httpd.conf I add a virtual server:
NameVirtualHost 192.168.0.231:80
<VirtualHost 192.168.0.231>
ServerAdmin mbp@bb.dk
DocumentRoot /bb_projekt/byg/htdocs
ServerName mbp.byg.int
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory "C:/bb_projekt/byg/htdocs">
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
Allow from all
</Directory>
ScriptAlias /cgi-bin/ "C:/bb_projekt/byg/cgi-bin/"
<Directory "C:/bb_projekt/byg/cgi-bin">
AllowOverride None
Options None
</Directory>
ErrorLog logs/byg_error.log
CustomLog logs/byg_access.log common
</VirtualHost>
In Tomcat-apache.conf I copy one of the example mappings and edit it:
### Byg servlets mapping
Alias /byg "C:/bb_projekt/byg"
<Directory "C:/bb_projekt/byg">
Options Indexes FollowSymLinks
</Directory>
ApJServMount /byg/servlets /byg
<Location /byg/servlets/ >
AllowOverride None
deny from all
</Location>
In server.xml I add a new context:
<Context path="/byg" docBase="c:/bb_projekt/byg/servlets" debug="0"
reloadable="true" >
</Context>
In C:\bb_projekt\byg\servlets there is a bygsetupservlet.class
What works:
The virtual host is working fine.
I can run Tomcat HelloWorldExample servlet in both Tomcat and thru Apache
I can run my own servlet thru Apache if I place it in the Tomcat examples
directory
What doesn't work:
Any servlet placed in c:\bb_projekt\byg\servlets
In the error log I keep getting messages like this:
[Wed Sep 06 14:53:13 2000] [error] [client 192.168.0.231] File does not
exist: c:/bb_projekt/byg/servlets/bygsetupservlet
So my question is: am I just stupid, have I missed some obscure detail or is
this really hard to get to work?
Whatever the answer to that is, what can I do to get this thing to work?
TIA
Best regards
Michael
Michael Bjerregaard Pedersen, senior software engineer
------------------------------------------------------
Backbone Digital Systems
Ryesgade 19A
DK-2200 Copenhagen N
Tlf. 35 245 245