Stop the server process on dependency injection errors.

Otherwise the process would just hang and do nothing.

(cherry picked from commit cc67fd80306a9dfe5f4d97112574914fb4aa8a6d)