NullPointerException from JDBC managed and minor fix

Signed-off-by: Marco Casella <marco.casella@gmail.com>