Are you using IIS as the server? Does IIS forward JSP requests to Tomcat or are you using Tomcat as your stand-alone web server?
--- "LILES, DAVID (CONTRACTOR)" <[EMAIL PROTECTED]> wrote: > We are configured with multiple <host> tags and each > project has identically named JSPs but we don't seem > to be experiencing what you have described.... > > We followed the following document we created.... > www.dynamichostings.com/TomCat5IIS5.do > > -Dave > > -----Original Message----- > From: Lisa Simaki [mailto:[EMAIL PROTECTED] > Sent: Friday, April 02, 2004 11:19 AM > To: [EMAIL PROTECTED] > Subject: Virtual Hosts Kill My JSPs > > > Hi, > > Thought I'd try again.... :) > > We are using Tomcat v5.0.19 as a stand-alone server, > with the Coyote HTTP 1.1 Connector, on Windows 2000. > We have Tomcat configured with two virtual hosts > (i.e., two <Host> elements). The virtual hosting is > working great except for a problem with identically > named JSPs across hosts: > > NUTSHELL > -------- > In a nutshell, when Tomcat translates a JSP into a > servlet, it is *NOT* taking into account which > <Host> > the JSP belongs to. It translates the JSP into a > servlet and dumps the resulting Java source code in > the same directory, regardless of what <Host> the > JSP > came from. > > This causes a big problem if the different hosts > have > a JSP that happens to be the same name, like, say, > index.jsp. Since the generated Java code > (index_jsp.java) is dumped into the same directory, > regardless of which <Host> the JSP originated from, > Tomcat will serve the index.jsp that got translated > first. So, both hosts end up sharing the same > index.jsp. > > > MORE SPECIFICS (More Details) > -------------- > In my server.xml I have two <Host> elements > configured: > > <Host name="xxx.test2.com" debug="0" > appBase="C:\TestWebSites\test2" > unpackWARs="true" deployOnStartup='true' > autoDeploy="false"> > <Context path="/" docBase="" debug="0" > reloadable="false" /> > </Host> > > <Host name="xxx.test1.com" debug="0" > appBase="C:\TestWebSites\test1" > unpackWARs="true" deployOnStartup='true' > autoDeploy="false"> > <Context path="/" docBase="" debug="0" > reloadable="false" /> > </Host> > > The "name" attribute of the first Host element is > "xxx.test1.com" and the "name" attribute on > the second Host is "xxx.text2.com". Of course, I > also > have the Windows "hosts" file set up so that both > host > names are associated with 127.0.0.1. In other words, > the "hosts" file has entries for both xxx.test1.com > and xxx.test2.com and they both point to 127.0.0.1. > > Both test1 and test2 have their own directories. In > other words, both "appBase" attributes of the <Host> > elements point to the directory appropriate to that > host (xxx.test1.com or xxx.test2.com). > > I hope this is clear so far. > > With Tomcat running I can browse to either > http://xxx.test1.com or http://xxx.test2.com and the > correct page is served. Tomcat seems to be using > virtual hosting just fine....except... > > If both test1 and test2 have a JSP with the same > name > (like, say, index.jsp), then there's confusion. The > first index.jsp that gets compiled is the one that > gets served for *BOTH* hosts. For example: > > Assume no JSPs are yet compiled. > I go to http://xxx.test1.com/index.jsp, causing the > test1's index.jsp to be compiled and rendered. > That's > expected. Now, go to http://xxx.test2.com/index.jsp > -- the result is still test1's version of index.jsp! > > Now, if I modify test2's index.jsp and I go to > http://xxx.test2.com/index.jsp I see what I expect > -- > test2's JSP with the modification I just made. But > now > if I go to http://xxx.test1.com/index.jsp I also see > test2's index.jsp, not test1's JSP!!! > > HERE'S WHY IT HAPPENS! > --------------------- > Now, I know, partially why this is happening. You > know > that Tomcat uses a separate directory to store > compiled JSPs. As I mentioned, Tomcat is not > differentiating between hosts when it writes the > Java > source code (from the translated JSP) to this > directory. It's simply putting *all* > compiled JSPs into the same directory (WINNT/temp). > Since both test1 and test2 have identically named > "index.jsp" files, Tomcat does not distinguish them. > In both cases it generates "index_jsp.java" as > needed, > overwriting the previous version. That is the crux > of > what's causing my grief. > > One would think Tomcat would build a directory > structure reflective of the host name and contexts > so > that identically named JSPs from different hosts do > not over-write each other. > > Can anyone offer any comments on this? Is anyone > still > reading at this point? > > Thanks, > > LS > > __________________________________ > Do you Yahoo!? > Yahoo! Small Business $15K Web Design Giveaway > http://promotions.yahoo.com/design_giveaway/ > > --------------------------------------------------------------------- > To unsubscribe, e-mail: > [EMAIL PROTECTED] > For additional commands, e-mail: > [EMAIL PROTECTED] > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: > [EMAIL PROTECTED] > For additional commands, e-mail: > [EMAIL PROTECTED] > __________________________________ Do you Yahoo!? Yahoo! Small Business $15K Web Design Giveaway http://promotions.yahoo.com/design_giveaway/ --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]