  Let $E$ be a complete, separable metric space and $A$ be an operator on
$C_b(E)$. We give an abstract definition of viscosity sub/supersolution of the
resolvent equation $\lambda u-Au=h$ and show that, if the comparison principle
holds, then the martingale problem for $A$ has a unique solution. Our proofs
work also under two alternative definitions of viscosity sub/supersolution
which might be useful, in particular, in infinite dimensional spaces, for
instance to study measure-valued processes.
  We prove the analogous result for stochastic processes that must satisfy
boundary conditions, modeled as solutions of constrained martingale problems.
In the case of reflecting diffusions in $D\subset {\bf R}^d$, our assumptions
allow $ D$ to be nonsmooth and the direction of reflection to be degenerate.
  Two examples are presented: A diffusion with degenerate oblique direction of
reflection and a class of jump diffusion processes with infinite variation jump
component and possibly degenerate diffusion matrix.
