It seems to me that mod_jk in Apache does not sync with the AJP connector in JBoss. The AJP protocol uses persistent, reusable connections between the web server and the application server, and if the protocol is not configured exactly at both ends of the connection, eventually the connections will become obsolete at one end of the connection and continue to try to use them at the other end. The symptom is error 502.
My first suggestion: do not use mod_jk unless you need to. It is difficult and difficult to configure in order to get a stable system. If you do not need performance or load balancing functions, I suggest using mod_proxy instead. This is just as good for most applications, and pretty easy.
But if you want to stick with mod_jk, the first thing you need to do is make sure you are using the latest version of mod_jk (currently 1.2.28), as older versions are generally difficult to configure. Fortunately, mod_jk is still supported on Apache 1.3.
Then check the mod_jk log file (configured using the JkLogFile directive). If you see a lot of connection-related errors while things go wrong, you need to configure your jk configuration at both ends of the connection. The most likely culprit is the timeout settings, so read about them here and make sure that both ends are sung from the same sheet of hymns.
source share