send file via sftp not working
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-02-2016 07:41 PM
I'm using file builder FTP trying to send a file via SFTP to a remote location.
I have no problem retrieving files from the same server, so I know the credentials are ok.
However, when I try to send a file I see the output processed on the ECC Queue, but the input never processes.
Not sure if this is an instance issue or file builder FTP issue.
I have requested assistance from file builder but no response.
Any assistance would be greatly appreciated.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-25-2016 01:29 AM
Hi Kevin,
Did you get 'Copying from local file of MID server..' message in the log? EOF Exception is usually caused when end of data file is reached unexpectedly during input.
I guess there is something wrong with the filename or file path. Can you provide the code here?
Mark Correct if it solved your issue or hit Like and Helpful if you find my response worthy.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-25-2016 06:31 AM
This is the main routine in the mid server script include. I have verified via Filezilla that the hostname, username, password and port connect properly.
The error in the mid server log is being caught when I do the ssh.connect (highlited below). So, I am never getting to the code where I attempt to save the file to the SFTP server.
Error in Mid Server log:
ERROR connecting: com.sshtools.j2ssh.transport.MessageStoreEOFException: The message store has reached EOF
sftpFile : function(hostName, userName, password, localFileName, remoteFileName) {
this.log('sftpFile(): attempting to connect to ' + hostName);
var ssh = new Packages.com.sshtools.j2ssh.SshClient();
var ignoreHost = new Packages.com.sshtools.j2ssh.transport.IgnoreHostKeyVerification();
if (!this.targetPort){
this.targetPort = 22;
}
this.log('sftpFile(): attempting to connect to ' + hostName + " on port " + this.targetPort);
try {
ssh.connect(hostName, this.targetPort, ignoreHost);
} catch(ex1) {
this.log('ERROR connecting: ' + ex1);
throw ex1;
}
pwd = new Packages.com.sshtools.j2ssh.authentication.PasswordAuthenticationClient();
var authPassword = new Packages.com.glide.util.Encrypter().decrypt(password);
pwd.setUsername(userName);
pwd.setPassword(authPassword);
// Get full path of filename
this.log('sftpFile(): attempting to copy ' + localFileName + ' to ' + remoteFileName);
if(ssh.authenticate(pwd) == new Packages.com.sshtools.j2ssh.authentication.AuthenticationProtocolState().COMPLETE) {
sftp = ssh.openSftpClient();
try {
sftp.put(localFileName, remoteFileName);
this.log("File successfully copied to targert path\n\n");
if (this.deleteAfterUpload == "true") {
this.log("deleteAfterUpload -> " + this.deleteAfterUpload + ", deleting local file...");
new this.File(localFileName)["delete"]();
}
} catch(e) {
this.log('FILE NOT FOUND ' + remoteFileName + ' or error: ' + e);
}
sftp.quit();
try{
// kill connection
ssh.disconnect();
} catch(e) {
this.log('Manual connection kill not successful with error: ' + e);
}
}
},
I am also getting this error in the system log:
Failure during scheduled run of job: 81c92ce9c0a8016400e5f0d2f784ea78: java.lang.NullPointerException: com.snc.automation.ScheduledExportSetJob.runScript(ScheduledExportSetJob.java:114)
com.snc.automation.ScheduledExportSetJob.runExport(ScheduledExportSetJob.java:89)
com.snc.automation.ScheduledExportSetJob.execute(ScheduledExportSetJob.java:53)
com.glide.schedule.JobExecutor.execute(JobExecutor.java:80)
com.glide.schedule.GlideScheduleWorker.executeJob(GlideScheduleWorker.java:191)
com.glide.schedule.GlideScheduleWorker.process(GlideScheduleWorker.java:135)
com.glide.schedule.GlideScheduleWorker.run(GlideScheduleWorker.java:57)
KEVIN MAURIELLO
Sr. Technical Consultant
INSOURCE | 565 E. Swedesford Road, Suite 220 | Wayne, PA 19087
P. 1 610 592 0800 | C. 1 484 695 3645 | F. 1 610 592 0817
kevin.mauriello@insourcenow.com<mailto:michael.hallman@insourcenow.com> | www.insourcenow.com<http://www.insourcenow.com/> | Connect on LinkedIn<https://www.linkedin.com/in/kjmdeveloper>
INSOURCE: Facebook<https://www.facebook.com/insourceinc/> | Twitter | LinkedIn<https://www.linkedin.com/company/insourceinc/>
ServiceNow Silver Services Partner
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-02-2016 09:16 PM
I cant see path name here, can you post your scheduled job code from where you are sending file path. I guess you are calling this from scheduled job...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-25-2016 01:33 AM
Kevin Mauriello wrote:
I'm using file builder FTP trying to send a file via SFTP to a remote location.
I have no problem retrieving files from the same server, so I know the credentials are ok.
Any assistance would be greatly appreciated.
Have you tried using a command prompt to manually send files to the same server?
The credentials only allow you to login - there's nothing saying if you have write access to that location to store files.
At least if there's any errors, you'd see them in a terminal window - they may be reported to the MID server and buried in a logfile somewhere.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-25-2016 05:44 AM
I am able to copy the same file using the same credentials via Filezilla, so I know the creds have the proper authority
KEVIN MAURIELLO
Sr. Technical Consultant
INSOURCE | 565 E. Swedesford Road, Suite 220 | Wayne, PA 19087
P. 1 610 592 0800 | C. 1 484 695 3645 | F. 1 610 592 0817
kevin.mauriello@insourcenow.com<mailto:michael.hallman@insourcenow.com> | www.insourcenow.com<http://www.insourcenow.com/> | Connect on LinkedIn<https://www.linkedin.com/in/kjmdeveloper>
INSOURCE: Facebook<https://www.facebook.com/insourceinc/> | Twitter | LinkedIn<https://www.linkedin.com/company/insourceinc/>
ServiceNow Silver Services Partner