I have googled but many concerns was "java.lang.IllegalStateException: Target host must not be null", but in my case error was "java.lang.IllegalStateException: Target host is null"
I am trying to post a request using following code
StringEntity reqContent = new StringEntity(xmlData);
reqContent.setContentType("text/xml");
HttpPost req = new HttpPost(serverURL);
req.setEntity(reqContent);
httpClient = new DefaultHttpClient(connMgr, params);
httpClient.getCredentialsProvider().setCredentials(AuthScope.ANY,
new UsernamePasswordCredentials(username, password));
HttpResponse response = httpClient.execute(req);
After executing the request I am getting "Target host is null". I am giving a valid host. Does this error comes when Target host which I am trying to access is not available?