File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- 32295
1+ 32895
Original file line number Diff line number Diff line change @@ -135,6 +135,34 @@ if [ ${#MISSING[@]} -gt 0 ]; then
135135 sleep 3
136136fi
137137
138+ # ── Force Tomcat to reload all contexts if any show 404 ──────────────────────
139+ echo " "
140+ echo " [*] Checking Tomcat webapp loading..."
141+ NEEDS_RELOAD=0
142+ for MODULE_SPEC in " ${MODULES[@]} " ; do
143+ IFS=' :' read -r MOD_DIR CONTEXT <<< " $MODULE_SPEC"
144+ HC=$( curl -s -o /dev/null -w " %{http_code}" --connect-timeout 2 " http://localhost:8080/$CONTEXT /" 2> /dev/null || echo " 000" )
145+ if [ " $HC " = " 404" ] || [ " $HC " = " 000" ]; then
146+ NEEDS_RELOAD=1
147+ break
148+ fi
149+ done
150+
151+ if [ " $NEEDS_RELOAD " -eq 1 ]; then
152+ echo " [*] Some webapps returning 404 — restarting Tomcat to force reload..."
153+ if [ -x " $TOMCAT_HOME /bin/shutdown.sh" ]; then
154+ " $TOMCAT_HOME /bin/shutdown.sh" > /dev/null 2>&1 || true
155+ sleep 3
156+ " $TOMCAT_HOME /bin/startup.sh" > /dev/null 2>&1
157+ else
158+ sudo systemctl restart tomcat 2> /dev/null || true
159+ fi
160+ echo " [*] Waiting for Tomcat to load webapps (8s)..."
161+ sleep 8
162+ else
163+ echo " [✓] All webapps loaded — no restart needed"
164+ fi
165+
138166# ── Verify HTTP endpoints ─────────────────────────────────────────────────────
139167echo " "
140168echo " [*] Verifying HTTP endpoints..."
You can’t perform that action at this time.
0 commit comments