Patching One File Inside a WAR: What Should a Partial Deploy Record?
When you ship a single class instead of the whole WAR, the unit of deployment becomes "original WAR plus patch." A recovery spec that covers copy, delete and preserve on one page, the Tomcat redeploy trap, and what to record per server.
Friday afternoon, a ticket comes in: receipts are showing the wrong net amount. The fix is one class. Redeploying the full WAR means lining up with another team's scheduled maintenance. Operations asks: "Can we push just the changed file first?"
Some environments allow it. But the moment you do, the unit of deployment changes. Until yesterday, a single billing.war described what was running in production. From today, you need the original WAR and the patch applied on top of it to describe a server. If only server A got the patch, A and B will report the same product version and still print different receipts.
In a partial deploy, the unit of deployment is not the one file you changed but "the original WAR plus the patch on top of it." Describing a server means recording both.
Write the recovery spec first and the missing file shows up
Say the receipt layout change also retires the old print screen. The change fits in three rows.
| Target | On rollout | On recovery |
|---|---|---|
ReceiptFormatter.class | Confirm the baseline matches, then replace with the patched class | Restore the archived baseline class |
print-old.js | Confirm nothing references it anymore, then delete | Restore the old file at the same path |
site.properties | Site-specific config, excluded from the job | Confirm it survived before and after |
If the patch ZIP contains only the modified class, the second row disappears. The copy succeeds and the script you meant to retire stays on the server. Go the other way and sync the whole directory, and you can wipe production config that was never in the build. A partial deploy needs "what to copy" and "what to delete or preserve" on the same page.
Does a patch in the expanded directory survive the next regular release?
Not necessarily, so check which path the application server actually runs from. Depending on configuration, Tomcat will remove a previously expanded directory and re-expand it when a new WAR arrives (Tomcat Host autoDeploy and unpackWARs). A hotfix applied only to the expanded directory can vanish at the next regular release. After swapping the class, go through that server's reload procedure and verify the result with a receipt produced by the patched instance itself.
What should you record per server after a partial deploy?
For every server you patched, record three things: the baseline WAR, the patch applied, and a real business response. With those three, you can answer "do A and B produce the same receipt?" one server at a time.
There's a check before the job as well. If server A's existing file doesn't match the baseline, that's a reason to stop work on that server. Someone may have shipped an earlier emergency fix. Overwrite a file whose hash doesn't match and that fix disappears without a trace. How to keep regular builds versioned and pull an approved one back out is covered in moving WAR files from rsync to an artifact repository.
The last step is folding the patch into the next regular WAR. Otherwise, when you add a server next month, it won't print the same receipt. Until the patch lands in a real build, it's worth writing into the runbook that a freshly provisioned server may still be doing pre-Friday math.
- #legacy-deploy
- #war
- #tomcat
- #hotfix
- #rollback
- #vm