getting 'java.net.ConnectException: Connection timed out: connect' error
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-08-2023 02:26 AM
*** Script: >>>ERROR: CohesityLogs: Exception occured while fetching information from SNOW table : java.net.ConnectException: Connection timed out: connect
Getting the above error while calling in the below function in mid server script includes:
var relResult = HTTPobj.SNOW_HTTP_GET(COHESITY_ACCOUNTS, this.SNOWusername, this.SNOWpassword, queryString);
// HTTP GET method to SNOW
SNOW_HTTP_GET: function(tableName, username, password, queryString) {
try {
var url = this._buildSNOWTableUrl(tableName);
var getMethod = new GetMethod(url);
var UsernamePasswordCredentials = httpclient.UsernamePasswordCredentials;
var AuthScope = httpclient.auth.AuthScope;
var authScope = new AuthScope(url, this.protocol);
var credentials = new UsernamePasswordCredentials(username, password);
client.getState().setCredentials(authScope.ANY, credentials);
if (queryString != '') {
queryString = queryString.replace(/[^\x00-\x7F]/g, '');
queryString = '?sysparm_query=' + (this.STRING_PARSER(queryString));
this.logger._debug('SNOW queryString : ' + queryString);
getMethod.setQueryString(queryString);
}
getMethod.setDoAuthentication(true);
var status = client.executeMethod(getMethod);
var result = getMethod.getResponseBodyAsString();
this.logger._debug('(Status) SNOW Get : ' + status);
this.logger._debug('(Response) SNOW Get : ' + result);
if (status == 200) {
var respObject = new JSON().decode(result);
return respObject;
} else { // Resource not avaiable.
return null;
}
} catch (ex) {
// throw ex;
this.logger._error('Exception occured while fetching information from SNOW table : ' + ex);
return null;
}
},
not sure of the root cause for the above error.
@Ankur Bawiskar any idea why this error is been thrown? Any fix for this?
Do we have any default time out causing the above error?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-08-2023 07:47 AM
Hi Aishwarya,
It seems this is network timeout.
Please try to add one line while sending request ,
req.setTimeout(500000);//milliseconds
Hope this will resolve error.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-08-2023 08:05 PM
@Abhay Kumar1 Thanks for the info.
In the above script which line of code is causing this network timeout error? Any idea?
Regards,
Aishwarya
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-30-2023 07:33 PM
@Aishwarya NG you can add anywhere before executeMethod.