Fixing null pointer exception in rest api, cartridge deployment method