Add try-catch blocks for ioexceptions and classnotfoundexceptions on server side: