----- Original Message ----- From: Steven Probetts
To: users@tomcat.apache.org
Sent: Wednesday, June 25, 2008 4:13 AM
Subject: Re: Tomcat caching and deployment issues


Thanks for your replies.
Couple of things, I'm in Australia so that is why I don't get back to you straight away. Also, I hope I'm replying properly and that this message get put in the correct location in the thread list.




To deploy I:
Stopped tomcat
added the war file to my wars directory
edited the context fragment file (in conf/Catalina/localhost/mycontext.xml to point the docBase attribute to the correct war file)
started tomcat


I am wondering if maybe I didn't 'undeploy' the app in the Tomcat manager (or another manager app called probe). I'm unclear as to whether I need to explicitly 'undeploy' to clear out the works directory etc. So, as Johnny Kewl said, there is legacy code being used from the old version. So do i need to 'undeploy' to clear out the work directory and any other directories that tomcat uses to run the app or does restarting tomcat do this automatically. Having said that, the solution I used was to stop and start tomcat, which apparently cleared out the cache, so why didn't it do this when i restarted tomcat after deployment. And it doesn't seem to answer the problem of when I changed the database directly and it didn't show up in the app. Here it seemed to cache the data rather than the application code (which resetting the browser or using a different browser or using a different machine that has never run the application before didn't fix).


I'd like to explain how we deploy a bit clearer as I think I rushed it a bit earlier.


We have two business sites that have two separate databases (running on the same database instance but that is irrelevant). For convenience, we wanted to have a single war file for the web app that all sites shared.


So we do the following (and I lied earlier we use /var not /opt):
We have a dir called /var/tomcat/wars in which we store the single war file
We have a dir called /var/tomcat/instances which contains directories for each site
ie
/var/tomcat/instances/site_a
/var/tomcat/instances/site_b


in each of these directories we have the tomcat directories conf, webapps, work etc.


The tomcat binary is in /opt/tomcat (and yes i do mean /opt this time)


We have a context fragment file for each site which is
/var/tomcat/instances/site_a/conf/Catalina/www.site_a.com.au/myContext.xml
which contains
<Context docBase="/var/tomcat/wars/site_a-version1.war"
       reloadable="false" swallowOutput="true">


The server.xml file has a Host element that reads:
<Host name="www.site_a.com.au" appBase="webapps"
      unpackWARs="false" autoDeploy="false"
      xmlValidation="false" xmlNamespaceAware="false">


There is no Context element
Running version.sh returns:Using CATALINA_BASE: /opt/tomcatUsing CATALINA_HOME: /opt/tomcatUsing CATALINA_TMPDIR: /opt/tomcat/temp
To deploy I:
* Stop tomcat using launchctl (MacOSX's services controller, like init.d in Linux) * copy the war file into the wars directory (with a different name to the old app)
*Edit the context fragment file so that docBase points to the new war file
* restart tomcat using launchctl


Regards,


=================================
Steven

Ah... I see what you doing... this is what is wrong

Do not change the name of the WEB APP.... of the WAR
The way TC relates context and path is thru the actual name of the file.

This is so that normal humans can easily change the context just by changing the file name...

So make the context file in TC look something like this

<?xml version="1.0" encoding="UTF-8"?>
<Context docBase="D:/DEV/Ext/test/WebApplication2.war" path="/WebApplication2"/>

The path is the context you want it to run on.... ie domain/WebApplication2
Make them the SAME...

Then do this... in HOST

autoDeploy="true"

Then just drop the new wars over the old one.... and it will redeploy automatically.

Notes...
You are not sharing files like this, ie when it deploys, each TC is getting its own unpacked version in webapps... have a look. So you see what happens and its what you calling CACHING... is that when you change the name... TC looks for that context. Cant find it, BUT does find the old already unpacked one in webapps... and just runs that. It cant connect that the new WAR name, ie context must be the same as war file name. <Context docBase="D:/DEV/Ext/test/WebApplication2.war" path="/WebApplication2"/>

is the full way, so you can see if you can try match a context to a different war name, but I dont think TC will figure it out.

If you want to "mismatch" war and context... you can
but then you must undeploy from /manager/html

and you must run this to redeploy

http://localhost:8080/manager/deploy?config=file://path/to/context.xml&path=/NewContext

Too much pain...

Then one last thing... becareful if you develop against one of these TC's... as soon as you do that, the IDE will steal the context away. And then you'll think its caching again... but its using the one in the IDE...
ie you shouldnt develop against these production TC's.

How Apple shares one binary is a mystery to me... there you on your own, but I dont think its related, other than I think you not seeing it because the files are hiding in those hidden Apple bundles, and thats why it probably been deployed extenally like this, because of those virtual links.
Apple madness ;)
Steve Jobs is on another planet... so I suggest you also join [EMAIL PROTECTED]

because the other stuff thats happening with Java and Apple, we cant help you with... like where is Java 6 and other issues.

You predecessor played nicely.... good luck

The rest of us... we just drop webapps into webapp... then go fly planes or play golf ;)

Thanks... I learnt something ;)

---------------------------------------------------------------------------
HARBOR : http://www.kewlstuff.co.za/index.htm
The most powerful application server on earth.
The only real POJO Application Server.
See it in Action : http://www.kewlstuff.co.za/cd_tut_swf/whatisejb1.htm
---------------------------------------------------------------------------





















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

Reply via email to