In the real world, the ultraviolet catastrophe doesn't happen because the quantization of photons modifies the classical behavior of light at frequencies comparable to and higher than the temperature. But classical electromagnetism is a mathematically self-consistent theory, so we could imagine a world where $\hbar = 0$ and electromagnetism remains classical to arbitrarily high frequencies. How would the ultraviolet catastrophe work in such a world? Classically, all frequencies are equally populated at all temperatures and each has energy $\frac{1}{2} k_B T$, apparently leading to infinite energy radiation at any temperature, which doesn't seem compatible with conservation of energy. What would happen if you put a theoretical fully classical system in contact with a thermal bath (which seems like a physically reasonable set-up)?
My guess is that since this system has an infinite number of quadratic degrees of freedom, the usual canonical-ensemble derivation of thermal equilibrium breaks down. I think that if you couple a perfectly conducing cavity to any thermal bath, no matter how large, then the cavity will absorb an unboundedly large amount of energy from the bath. In the usual derivation, we assume that the bath has so much more energy than the system that its energy density is independent of the state of the system, but in this case that assumption will eventually be violated. The cavity's energy will become comparable to the bath's, so to find its equilibrium state, we will need to consider the details of the bath and treat the combined cavity-bath system in the microcanonical ensemble. So the Boltzmann distribution and the equipartition theorem will no longer apply, and the ultraviolet catastrophe will be avoided.