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: [email protected]
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]