You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Rashmi Rubdi <de...@yahoo.com> on 2006/11/09 15:53:31 UTC

Switching between 2 projects, each setup at Tomcat's ROOT context deletes the source folder of the 2nd project.

I'm working on 2 different projects and I'm having problems while trying to switch between 2 projects that are both set up at the ROOT context.

My Environment: Tomcat 5.5, Windows XP

On the development environment there are 2 ROOT.xml context files under:
\apache-tomcat-5.5.12\conf\Catalina\localhost\


Only one project is active at any given time. This is done by switching-off the other ROOT.xml file. 
The other ROOT.xml is named something like ROOT.xml_temp_off


On the *development environment* the docBase attribute of Context in both ROOT.xml refer to the 
*source* folder, where all the source files are present and not Tomcat's webapps folder. This is to avoid 
performing an ANT build from source to webapps each time a JSP or static file changes.


The problem is that when I switch the ROOT.xml file from one Project01 to Project02 there is a conflict between the two projects. 
For example when Project02 is loaded, it tries to load a class file that is actually in Project01.


Setting <Context crossContext="false" in ROOT.xml doesn't solve this problem. 
I have to set antiResourceLocking="true" and antiJARLocking="true" 
in order to make Tomcat release all files for Project01 when I'm trying to load Project02.


But, the problem here is that when I set antiResourceLocking="true" and antiJARLocking="true" Tomcat *deletes* my entire Project02 source folder.


In order to prevent the folder from being deleted I go through a manual process each time I need to work on the other project. 
I rename Project02's source folder to source_bak, (to protect it from being deleted by Tomcat) 
I start Tomcat with antiResourceLocking="true" and antiJARLocking="true" and make it release resources for Project01. 
And then I shutdown Tomcat and rename source_bak back to source, and then re-start Tomcat.


The contents of the first ROOT.xml are:
<Context docBase="C:\dev\projects\Site01\__source"
         privileged="false" 
         antiResourceLocking="false" 
         antiJARLocking="false" 
         crossContext="false" 
         reloadable="true" 
         cachingAllowed="false" >
<Manager className="org.apache.catalina.session.PersistentManager" saveOnRestart="false"/>
<!-- The above is to prevent this error: SEVERE: IOException while loading persisted sessions: java.io.EOFException -->
</Context>


The contents of the second ROOT.xml are:
<Context docBase="C:\dev\projects\Site02\__source"
         privileged="false" 
         antiResourceLocking="false" 
         antiJARLocking="false" 
         crossContext="false" 
         reloadable="true" 
         cachingAllowed="false" >
<Manager className="org.apache.catalina.session.PersistentManager" saveOnRestart="false"/>
<!-- The above is to prevent this error: SEVERE: IOException while loading persisted sessions: java.io.EOFException -->
</Context>


Please note that I only change antiResourceLocking="true" and antiJARLocking="true" when switching from one project to the other.

Some additional info:
Each project also has a context.xml file located under \__source\META-INF\ with contents:
<?xml version="1.0" encoding="UTF-8"?>
<Context path="/">
</Context>

I would like to know if there's a way to set up these 2 projects in the development environment so that switching between the two projects
is a bit easier. That is the __source folder of Project02 *should not be deleted* when I try to switch the ROOT.xml file from Project01 to Project02


I don't mind the manual process, but sometimes it is error prone, if I forget one step I end up accidentally deleting the projects source folder
then I have to rely on the IDEs back up to restore the entire project, which is not easy since it doesn't back up image and xml files. I'm not using Version Control at the moment.


If there's a different / better way to set up 2 project like this I'm open to try other types of project set up.

Thanks in advance for any help.

-Rashmi



---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Switching between 2 projects, each setup at Tomcat's ROOT context deletes the source folder of the 2nd project.

Posted by Hassan Schroeder <ha...@gmail.com>.
On 11/9/06, Rashmi Rubdi <de...@yahoo.com> wrote:
> I'm working on 2 different projects and I'm having problems while trying to switch between 2 projects that are both set up at the ROOT context.

The first question is why they both have to be the ROOT context;
nevertheless, if there's a valid reason --

Create separate virtual hosts with unique AppBases and run each
project as ROOT in its own vhost. End of problem.

HTH!
-- 
Hassan Schroeder ------------------------ hassan.schroeder@gmail.com

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org