You are viewing a plain text version of this content. The canonical link for it is here.
Posted to general@jakarta.apache.org by Peter Heinrich <pe...@pobox.com> on 2000/01/31 22:57:42 UTC
recommend virtual hosts?
I just switched from JServ/GNUJSP to Tomcat, did I make a mistake?
We have 5 developers creating a product on one Linux server. With
JServ/GNUJSP, each developer has his own work area--corresponding to a
servlet zone--accessible on a different port. With Tomcat, this appears to
be impossible because contexts must be named uniquely irrespective of
virtual hosts.
Could this be true?
For example, say each developer modifies Servlet1 (in the "mktg"
context/servlet zone). With JServ/GNUJSP, we can specify a different
document base depending on the virtual host:
http://www.domain.com:7100/mktg/Servlet1 --> developer 1's version
http://www.domain.com:8100/mktg/Servlet1 --> developer 2's version
http://www.domain.com:9100/mktg/Servlet1 --> developer 3's version
With Tomcat, the URL changes:
http://www.domain.com:7100/mktg_dev1/servlets/Servlet1 --> developer 1's
version
http://www.domain.com:8100/mktg_dev2/servlets/Servlet1 --> developer 2's
version
http://www.domain.com:9100/mktg_dev3/servlets/Servlet1 --> developer 3's
version
You can imagine the nightmare... I'd love to hear how others have set up
their development environments. Any suggestions would be greatly
appreciated, especially since I've seen this question go unanswered several
times--it was even deleted from the Faq-o-matic.
peter
Re: recommend virtual hosts?
Posted by Brill Pappin <br...@jmonkey.com>.
With Contexts, there is no need to use separate ports. Each context has its
own application settings and classes/servlets directory and can be
completely separate.
i.e. on my machine, some users have a special context for themselves.
The following is the context for my own home directory:
<Context path="/~bpappin" docBase="/export/home/bpappin/public_html"
defaultSessionTimeOut="30" isWARExpanded="true"
isWARValidated="false" isInvokerEnabled="true"
isWorkDirPersistent="false"/>
My public_html directory have a dir called WEB-INF and that has a web.xml
file and a classes directory.
To call a servlet in this context, I have to use
/~bpappin/servlet/com.mypackage.MyServlet
What you would have to check, (because I don't know for sure) is that the
classes in this directory are not visible to all the contexts...
However, at the moment Tomcat does *not* do servlet reloading, so you might
not want to use it as a development platform yet. Servlet reloading is in
the works now... and will be available at a later date.
- Brill Pappin
www.jmonkey.com
----- Original Message -----
From: Peter Heinrich <pe...@pobox.com>
To: <ge...@jakarta.apache.org>
Sent: Monday, January 31, 2000 9:57 PM
Subject: recommend virtual hosts?
> I just switched from JServ/GNUJSP to Tomcat, did I make a mistake?
>
> We have 5 developers creating a product on one Linux server. With
> JServ/GNUJSP, each developer has his own work area--corresponding to a
> servlet zone--accessible on a different port. With Tomcat, this appears
to
> be impossible because contexts must be named uniquely irrespective of
> virtual hosts.
>
> Could this be true?
>
> For example, say each developer modifies Servlet1 (in the "mktg"
> context/servlet zone). With JServ/GNUJSP, we can specify a different
> document base depending on the virtual host:
>
> http://www.domain.com:7100/mktg/Servlet1 --> developer 1's version
> http://www.domain.com:8100/mktg/Servlet1 --> developer 2's version
> http://www.domain.com:9100/mktg/Servlet1 --> developer 3's version
>
> With Tomcat, the URL changes:
>
> http://www.domain.com:7100/mktg_dev1/servlets/Servlet1 --> developer 1's
> version
> http://www.domain.com:8100/mktg_dev2/servlets/Servlet1 --> developer 2's
> version
> http://www.domain.com:9100/mktg_dev3/servlets/Servlet1 --> developer 3's
> version
>
> You can imagine the nightmare... I'd love to hear how others have set up
> their development environments. Any suggestions would be greatly
> appreciated, especially since I've seen this question go unanswered
several
> times--it was even deleted from the Faq-o-matic.
>
> peter
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: general-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: general-help@jakarta.apache.org
>
Re: recommend virtual hosts?
Posted by John Thorhauer <jt...@phoenixcolor.com>.
Peter Heinrich wrote:
>
>
> With Tomcat, the URL changes:
>
> http://www.domain.com:7100/mktg_dev1/servlets/Servlet1 --> developer 1's
> version
> http://www.domain.com:8100/mktg_dev2/servlets/Servlet1 --> developer 2's
> version
> http://www.domain.com:9100/mktg_dev3/servlets/Servlet1 --> developer 3's
> version
>
> You can imagine the nightmare... I'd love to hear how others have set up
> their development environments. Any suggestions would be greatly
> appreciated, especially since I've seen this question go unanswered several
> times--it was even deleted from the Faq-o-matic.
I have also been trying to setup something similar to this and recieved
some suggestions. I did get Tomcat/Apache working with virtual hosts/ip
aliasing and I was able to use the same directory structure for each
host. With the following configuration I can go to
http://172.16.0.230/apps/servlet/Hello
or
http://172.16.0.231/apps/servlet/Hello
These 2 servlets are on the same box and are totallyseperate from each
other.
If anyone knows of a better way to do this please let me know. Im not
sure if this would be considered the "correct" or best way but here is
how I got it to work:
NOTE: be sure to load mod_jserv before these lines
section of Apache httpd.conf
-----------------------------------------------------
##############################
## Virtual Host A
##############################
<VirtualHost 172.16.1.230>
ServerName 172.16.1.230
DocumentRoot /usr/local/websites/vhosta/docs
## tomcat info
<IFModule mod_jserv.c>
ApJServDefaultPort 8008
AddType text/jsp .jsp
AddHandler jserv-servlet .jsp
ApJServMount /apps /root
</IfModule>
</VirtualHost>
##############################
## Virtual Host B
##############################
<VirtualHost 172.16.1.231>
ServerName 172.16.1.231
DocumentRoot /usr/local/websites/vhostb/docs
## tomcat info
<IFModule mod_jserv.c>
ApJServDefaultPort 8009
AddType text/jsp .jsp
AddHandler jserv-servlet .jsp
ApJServMount /apps /root
</IfModule>
</VirtualHost>
---------------------------------------------------------
Section of server.xml
----------------------------------------------------------
<!-- ######################################################### -->
<!-- Config for vhosta -->
<!-- ######################################################### -->
<ContextManager port="8081" hostName="172.16.1.230"
inet="172.16.1.230">
<Context path="/" docBase="/usr/local/websites/vhosta/docs"
defaultSessionTimeOut="30" isWARExpanded="true"
isWARValidated="false" isInvokerEnabled="true"
isWorkDirPersistent="false"/>
<Context path="/apps" docBase="/usr/local/websites/apps/vhosta"
defaultSessionTimeOut="30" isWARExpanded="true"
isWARValidated="false" isInvokerEnabled="true"
isWorkDirPersistent="false"/>
<!-- New HttpServer. -->
<Connector
className="org.apache.tomcat.service.http.HttpAdapter">
</Connector>
<!-- AJP12 - current JServ module -->
<Connector
className="org.apache.tomcat.service.TcpEndpointConnector">
<Parameter name="handler"
value="org.apache.tomcat.service.connector.Ajp12ConnectionHandler"/>
<Parameter name="port" value="8008"/>
</Connector>
</ContextManager>
<!-- ######################################################### -->
<!-- Config for vhostb -->
<!-- ######################################################### -->
<ContextManager port="8082" hostName="172.16.1.231"
inet="172.16.1.231">
<Context path="/" docBase="/usr/local/websites/vhostb/docs"
defaultSessionTimeOut="30" isWARExpanded="true"
isWARValidated="false" isInvokerEnabled="true"
isWorkDirPersistent="false"/>
<Context path="/apps" docBase="/usr/local/websites/apps/vhostb"
defaultSessionTimeOut="30" isWARExpanded="true"
isWARValidated="false" isInvokerEnabled="true"
isWorkDirPersistent="false"/>
<!-- New HttpServer. -->
<Connector
className="org.apache.tomcat.service.http.HttpAdapter">
</Connector>
<!-- AJP12 - current JServ module -->
<Connector
className="org.apache.tomcat.service.TcpEndpointConnector">
<Parameter name="handler"
value="org.apache.tomcat.service.connector.Ajp12ConnectionHandler"/>
<Parameter name="port" value="8009"/>
</Connector>
</ContextManager>
-----------------------------------------------------------
--
********************************
** John Thorhauer
** Web Developer
** jthorhauer@phoenixcolor.com
********************************