  We revisit the idea of quantum nondemolition measurement (QND) of optical
quanta via a resonantly enhanced Kerr nonlinearity taking into account quantum
back action and show that the monolithic microcavities enable QND measurement
of number of quanta in a weak signal field using a spatially overlapping
classical probe field. Due to the cross-phase modulation effect, the phase of
the probe field acquires information about the signal number of quanta without
altering it. We find the exact solution to the Heisenberg equations of motion
of this system and calculate the measurement error, accounting for the optical
losses in the measurement path. We identify a realistic approximation to obtain
the explicit form of the final conditional quantum state of the signal field,
accounting for the undesirable self-phase modulation effect and designing the
optimal homodyne measurement of the probe beam to evade this effect. We show
that the best modern monolithic microcavities allow achieving the measurement
imprecision several times better than the standard quantum limit.
