NIntegrate::inumr: The integrand !\*SubscriptBox[\(\[PartialD], 2]f[2, a]) has evaluated to non-numerical values for all sampling points in the region with boundaries {{0,1}}.
Those ?NumericQ in the definition of f interfere with symbolic computation. Also, if you calculate the derivative with D[f[x, a], x], the variable x will become numerical too soon, before the symbolic derivative is calculated. One way to solve the problem is to use Derivative, which does not use a symbolic variable name: