Move into JApplication base to fix unit tests