FileNotFoundException while getting the InputStream object from HttpURLConnection
I am trying to send a post request to a url using HttpURLConnection (for using cUrl in java). The content of the request is xml and at the end point, the application processes the xml and stores a record to the database and then sends back a response in form of xml string. The app is hosted on apache-tomcat locally. When I execute this code from the terminal, a row gets added to the db as expected. But an exception is thrown as follows while getting the InputStream from the connection java.io.FileNotFoundException: http://localhost:8080/myapp/service/generate at sun.net.www.protocol.http