Jon,

On 11/7/24 13:08, Mcalexander, Jon J. wrote:
Happy Thursday everybody,

I have a question around starting a Tomcat Service Instance on Windows servers. 
Is there a way to have the Tomcat Startup kick off a script before starting 
that will clear the contents of the workDir (Clear the cache so to say)?

We have run into some issues after upgrading our binaries to Tomcat 9.0.96 
where applications start throwing some unknown method errors when starting. The 
fix for this was to clear the workDir contents before startup and let Tomcat do 
it's recompile steps. Note, the app didn't change, but the binaries did.

Please note that there is a regression in 9.0.96 that you need to be aware of that affects JSPs. It will affect you, since you are reporting (a) missing method errors and (b) you want to clear your work directory, presumably to remove .jsp -> .java -> .class files to trigger recompilation of all of those.

I would pause and NOT deploy 9.0.96 because recompilation will stop the app from throwing those missing-method errors, but some tags might actually not behave properly.

We separate our CATALINA_HOME from our CATALINA_BASE, so app teams just need to 
restart their instance after the upgrade.

Doing this in Linux/Unix/MAC, is easier as we can do this with the setenv.sh 
script or in the startup or shutdown scripts. However Windows is more difficult 
as the instance runs as a service.

Any help here would be much appreciated.

As to your question about procrun running a script before it launches Tomcat, I think the short answer is "no" but I do have an idea for you.

Create a new service called Tomcat-cleanup, make it a simply BAT/PS script that cleans-out that directory, and make it a startup dependency of the real Tomcat service.

-chris


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to