  We calculate the Casimir energy at spherical cavities within a host made up
of an arbitrary material described by a possibly dispersive and lossy
dielectric response. To that end, we add to the coherent optical response a
contribution that takes account of the incoherent radiation emitted by the host
in order to guarantee the detailed balance required to keep the system at
thermodynamic equilibrium in the presence of dissipation. The resulting
boundary conditions allow a conventional quantum mechanical treatment of the
radiation within the cavity from which we obtain the contribution of the cavity
walls to the density of states, and from it, the thermodynamic properties of
the system. The contribution of the cavity to the energy diverges as it
incorporates the interaction energy between neighbor atoms in a continuum
description. The change in the energy of an atom situated at the center of the
cavity due to its interaction with the fluctuating cavity field is however
finite. We evaluate the latter for a simple case.
