You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by Aaron Mulder <am...@alumni.princeton.edu> on 2000/01/08 22:05:51 UTC

List Archive + Questions

	Is this mailing list archived anywhere?  I tried asking the list
processor for past messages, and it hasn't gotten back to me yet.
	In the mean time, I've just started working with Tomcat, and I've
got some questions.  If this is not the appropriate forum for them, let me
know where to look.

Thanks,
	Aaron


 - The FAQ link on the web site doesn't seem to work, and I can't really
find anything by way of documentation or mailing list archives.  Is there
some way to get information other than asking here?

 - How do you make a servlet be the "default" servlet, so any requests
that Tomcat can't otherwise handle will be sent to it?

 - Is the existing default behavior (sending directory lists, 404s, etc)
implemented as a servlet or otherwise?

 - I gather some XML classes were supposed to be included in the RPM
distribution I installed (they weren't!).  Is the Project X TR2 jar the
appropriate package?

 - In the conf directives in the tomcat.conf file, there's are lines that
look like this and specify which web applications get served by which
URLs:

ApJServMount default /root
ApJServMount /examples /root

	It seems like the /examples part of that tells apache to send
any URLs starting with http://.../examples to Tomcat.  What is the purpose
of the /root part of those?  Would different Virtual Hosts (in Apache)
have to use different values for the "/root" in order to avoid collision?
Can the "/root" be replaced with "/examples" for consistency?


 - The default server.xml has a section reading:

<!--
    Note: a default context, one which path is specified
          as "/", must be defined per the servlet 2.2
          specification.
-->
        <Context path="/" docBase="webpages"
            defaultSessionTimeOut="30" isWARExpanded="true"
            isWARValidated="false" isInvokerEnabled="true"
            isWorkDirPersistent="false"/>

	If all the requests go through Apache, then I assume this context
will never be used (unless you set Apache to forward *everything* to
Tomcat).  Why is it required, then, and what would it do?  I didn't
actually see this discussed in the 2.2 Servlet spec.


Re: List Archive + Questions

Posted by Bill Ataras <ba...@mobilemob.com>.
I too am trying to figure out virtual hosting with the apache/tomcat
combo. So far the my best guess is to try to setup an appjservmount of
"main" within each apache virtual host section. and then point that
"main" at different tomcat contexts. So users would have to surf
www.site1.com/main and www.site2.com/main.

All in all, it doesn't seem to clean.


"Zacharias J. Beckman" wrote:
> 
> Sorry; last post sent in rich text. Reposting.
> 
> >  - In the conf directives in the tomcat.conf file, there's are lines that
> > look like this and specify which web applications get served by which
> > URLs:
> >
> > ApJServMount default /root
> > ApJServMount /examples /root
> >
> >  - The default server.xml has a section reading:
> 
> If you find answers to these questions, please post them! I've been working
> with Tomcat for about two weeks, trying to get virtual hosts, contexts,
> servlet processing, etc., working smoothly. So far, not much luck. I wish I
> had better news; as far as I can tell, Tomcat doesn't work well with virtual
> 
> hosts. At least in 3.0 you simply have to create a separate context for
> every
> host and tailor your web site URLs appropriately.
> 
> This is unfortunately very unattractive and means that building cross-site
> code isn't very feasible, unless you run different Apache servers on
> different
> ports, so each server has its own Tomcat configuration. That is, we can't
> use
> //www.foo.com/file.jsp, we have to introduce a new context, such as
> //www.foo.com/foo_jsps/foo.jsp... otherwise, the root-level contexts between
> 
> virtual hosts seems to become "confused."
> 
> I've experimented with putting ApJServMount directives inside of VirtualHost
> 
> configurations. This leads to largely broken, somewhat limited success. I
> don't think the scope is actually being limited to the enclosing
> VirtualHost.
> For instance, I tried this:
> 
> 1. Create a /foo context,
> 2. Create a /bar context,
> 3,4: Mount them at "/" into respective foo and bar web sites,
> 5. Put a test.jsp into each web site document root.
> 
> The problem is, even though test.jsp generates different output for each web
> 
> site, it appears the //www.foo.com/test.jsp calls the same JSP as
> //www.bar.com/test.jsp. In other words, all JSPs are being shared among all
> web sites, and it seems to be a first come, first serve approach.
> 
> It causes another problem as well. Since it results in all JSP/servlet calls
> 
> being redirected to the Tomcat server, root-level URL references don't work.
> 
> For instance, I have a JSP site where URLs such as "/common/funcs.jsp" is
> used
> throughout. Once Tomcat was installed, you end up seeing plenty of "File not
> 
> found: /common/funcs.jsp" errors, because the root-level reference is
> broken.
> We need to insert a context at the head of the URL.
> 
> Another alternative, of course, is to name each JSP &/or servlet differently
> 
> for each web site. I.e.: foo_test.jsp and bar_test.jsp. Unattractive for
> obvious reasons.
> 
> That's about as far as I've gotten...
> 
> I'm (trying to) using Apache 1.3.9 and Tomcat 3.0 on RH Linux 6.1.
> --
> Zacharias J. Beckman - zbeckman@creativesun.com - (U.S.) 305-281-8701
> Creative Sun Inc., Publishing for the Internet - http://www.creativesun.com
> 
> Far better it is to dare mighty things, to win glorious triumphs, even
> though checkered by failure, than to take rank with those poor spirits who
> neither enjoy nor suffer much, because they live in the gray twilight that
> knows neither victory nor defeat. -- Theodore Roosevelt
> 
>   ------------------------------------------------------------------------
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org

Re: List Archive + Questions

Posted by "Zacharias J. Beckman" <zb...@creativesun.com>.
Sorry; last post sent in rich text. Reposting.

>  - In the conf directives in the tomcat.conf file, there's are lines that
> look like this and specify which web applications get served by which
> URLs:
>
> ApJServMount default /root
> ApJServMount /examples /root
>
>  - The default server.xml has a section reading:

If you find answers to these questions, please post them! I've been working
with Tomcat for about two weeks, trying to get virtual hosts, contexts,
servlet processing, etc., working smoothly. So far, not much luck. I wish I
had better news; as far as I can tell, Tomcat doesn't work well with virtual

hosts. At least in 3.0 you simply have to create a separate context for
every
host and tailor your web site URLs appropriately.

This is unfortunately very unattractive and means that building cross-site
code isn't very feasible, unless you run different Apache servers on
different
ports, so each server has its own Tomcat configuration. That is, we can't
use
//www.foo.com/file.jsp, we have to introduce a new context, such as
//www.foo.com/foo_jsps/foo.jsp... otherwise, the root-level contexts between

virtual hosts seems to become "confused."

I've experimented with putting ApJServMount directives inside of VirtualHost

configurations. This leads to largely broken, somewhat limited success. I
don't think the scope is actually being limited to the enclosing
VirtualHost.
For instance, I tried this:

1. Create a /foo context,
2. Create a /bar context,
3,4: Mount them at "/" into respective foo and bar web sites,
5. Put a test.jsp into each web site document root.

The problem is, even though test.jsp generates different output for each web

site, it appears the //www.foo.com/test.jsp calls the same JSP as
//www.bar.com/test.jsp. In other words, all JSPs are being shared among all
web sites, and it seems to be a first come, first serve approach.

It causes another problem as well. Since it results in all JSP/servlet calls

being redirected to the Tomcat server, root-level URL references don't work.

For instance, I have a JSP site where URLs such as "/common/funcs.jsp" is
used
throughout. Once Tomcat was installed, you end up seeing plenty of "File not

found: /common/funcs.jsp" errors, because the root-level reference is
broken.
We need to insert a context at the head of the URL.

Another alternative, of course, is to name each JSP &/or servlet differently

for each web site. I.e.: foo_test.jsp and bar_test.jsp. Unattractive for
obvious reasons.

That's about as far as I've gotten...

I'm (trying to) using Apache 1.3.9 and Tomcat 3.0 on RH Linux 6.1.
--
Zacharias J. Beckman - zbeckman@creativesun.com - (U.S.) 305-281-8701
Creative Sun Inc., Publishing for the Internet - http://www.creativesun.com

Far better it is to dare mighty things, to win glorious triumphs, even
though checkered by failure, than to take rank with those poor spirits who
neither enjoy nor suffer much, because they live in the gray twilight that
knows neither victory nor defeat. -- Theodore Roosevelt


Re: List Archive + Questions

Posted by "Zacharias J. Beckman" <zb...@creativesun.com>.
>  - In the conf directives in the tomcat.conf file, there's are lines that
> look like this and specify which web applications get served by which
> URLs:
>
> ApJServMount default /root
> ApJServMount /examples /root
>
>  - The default server.xml has a section reading:

If you find answers to these questions, please post them! I've been working
with Tomcat for about two weeks, trying to get virtual hosts, contexts,
servlet processing, etc., working smoothly. So far, not much luck. I wish I
had better news; as far as I can tell, Tomcat doesn't work well with virtual
hosts. At least in 3.0 you simply have to create a separate context for every
host and tailor your web site URLs appropriately.

This is unfortunately very unattractive and means that building cross-site
code isn't very feasible, unless you run different Apache servers on different
ports, so each server has its own Tomcat configuration. That is, we can't use
//www.foo.com/file.jsp, we have to introduce a new context, such as
//www.foo.com/foo_jsps/foo.jsp... otherwise, the root-level contexts between
virtual hosts seems to become "confused."

I've experimented with putting ApJServMount directives inside of VirtualHost
configurations. This leads to largely broken, somewhat limited success. I
don't think the scope is actually being limited to the enclosing VirtualHost.
For instance, I tried this:

1. Create a /foo context,
2. Create a /bar context,
3,4: Mount them at "/" into respective foo and bar web sites,
5. Put a test.jsp into each web site document root.

The problem is, even though test.jsp generates different output for each web
site, it appears the //www.foo.com/test.jsp calls the same JSP as
//www.bar.com/test.jsp. In other words, all JSPs are being shared among all
web sites, and it seems to be a first come, first serve approach.

It causes another problem as well. Since it results in all JSP/servlet calls
being redirected to the Tomcat server, root-level URL references don't work.
For instance, I have a JSP site where URLs such as "/common/funcs.jsp" is used
throughout. Once Tomcat was installed, you end up seeing plenty of "File not
found: /common/funcs.jsp" errors, because the root-level reference is broken.
We need to insert a context at the head of the URL.

Another alternative, of course, is to name each JSP &/or servlet differently
for each web site. I.e.: foo_test.jsp and bar_test.jsp. Unattractive for
obvious reasons.

That's about as far as I've gotten...

I'm (trying to) using Apache 1.3.9 and Tomcat 3.0 on RH Linux 6.1.
--
Zacharias J. Beckman - zbeckman@creativesun.com - (U.S.) 305-281-8701
Creative Sun Inc., Publishing for the Internet - http://www.creativesun.com

Far better it is to dare mighty things, to win glorious triumphs, even
though checkered by failure, than to take rank with those poor spirits who
neither enjoy nor suffer much, because they live in the gray twilight that
knows neither victory nor defeat. -- Theodore Roosevelt