DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT <http://issues.apache.org/bugzilla/show_bug.cgi?id=28221>. ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND INSERTED IN THE BUG DATABASE.
http://issues.apache.org/bugzilla/show_bug.cgi?id=28221 "scratchdir" Can Break Virtual Hosts Summary: "scratchdir" Can Break Virtual Hosts Product: Tomcat 5 Version: 5.0.19 Platform: PC OS/Version: Windows NT/2K Status: NEW Severity: Normal Priority: Other Component: Connector:Coyote AssignedTo: [EMAIL PROTECTED] ReportedBy: [EMAIL PROTECTED] Hello, First, I'm not sure if this should be assigned to Coyote or Jasper (or possibly somewhere else). I am running TC v5.0.19 on Win 2k, J2SE v1.4.2_04. I am running TC as "stand- alone", i.e., as a stand-alone server, using the Coyote HTTP connector, not using Apache. Here is the issue: The "JSP servlet" (I'm referring to the servlet responsible for translating JSPs to Java source code) has a "scratchdir" parameter it uses to decide where to write the translated Java source code and compiled class files for a JSP. If this "scratchdir" value is set (let's say, "c:\temp", for example) then *EVERY* JSP, regardless of the virtual host, will be translated to the same directory (C:\temp). This is a big problem if two virtual hosts have an identically named JSP (index.jsp, for example) because whichever version of the JSP is translated first will be the version served across *ALL* virtual hosts whenever a JSP with that name is requested. If "scratchdir" is *NOT SET*, on the other hand, then separate directory hierarchies are created, one for each virtual host, and there is no problem of one host grabbing the other's JSPs. Here is an example... In Windows, I have these two lines in my C:\WINNT\system32\drivers\etc\hosts file: 127.0.0.1 xxx.test1.com 127.0.0.1 xxx.test2.com Now, in server.xml I have this: <Engine name="Standalone" defaultHost="xxx.test1.com" debug="0"> <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> </Engine> Now, assume both test1 and test2 define an index.jsp in their root contexts *AND* the "scratchdir" has been set to some directory. If you browse to http://xxx.test1.com, then test1's version of index.jsp will be compiled and placed in the scratchdir directory. That's fine. If you now browse to http://xxx.test2.com you will be served with test1's version of index.jsp. Now, modify test2's version of "index.jsp" and go again to http://xxx.test2.com. You see your modified JSP. Great. Now go to http://xxx.test1.com. And you still see test2's version of "index.jsp"! I believe the proper behavior should be for a directory to be created which reflects the host from which the JSP originates. This is the behavior we see if the "scratchdir" attribute is not used. The "scratchdir" attribute should be used as a base or root directory, below which a subdirectory hierarchy is created to reflect the host of the JSP being compiled. A final important point, if I may...I believe (99% sure) the problem described here also occurs for a single <Host> that contains multiple <Context>s where two or more <Context>s have identically named JSPs. If both <Context>s, for example, have a JSP, "fred.jsp", then the "scratchdir" will contain whichever one gets compiled first. It's the same problem except across <Context>s rather than across <Host>s. I hope all this is clear. Feel free to contact me if you need any additional information. Thanks... --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]