You are getting 404 error because of the action="/ReceiveMessagesServlet", please remove the slash. Try with action="ReceiveMessagesServlet".
When you add a slash to URL pattern then the container will look for a web application deployed with name 'ReceiveMessagesServlet'.Since this not there you will receive 404 error.