SFTP connection java.net.SocketTimeoutException: Read timed out
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-12-2018 02:03 AM
I'm trying to establish SFTP connection in SNOW in order to send some files, I'm testing my script in "Scripts - Background" tab, that's how the code looks like:
try {
var pt = new Packages.java.util.Properties();
pt.setProperty("connection.host", "host");
pt.setProperty("connection.port", 22);
pt.setProperty("user.login", "user");
pt.setProperty("user.password", "pass");
pt.setProperty("connection.type", "AUTH_SSL_FTP_CONNECTION");
pt.setProperty("connection.timeout", "6000");
pt.setProperty("connection.passive", "false");
var connection = Packages.org.ftp4che.FTPConnectionFactory.getInstance(pt);
gs.log("Starting connection");
connection.connect();
gs.log("Connected!!!!!");
} catch (e) {
gs.log("[FTP] e: " + e);
gs.log("[FTP] Line number: " + e.lineNumber);
gs.log("[FTP] Source: " + e.sourceName);
gs.log("[FTP] Name: " + e.name);
gs.log("[FTP] Message: " + e.message);
}
But whatever configuration I try I'm always getting the same error:
*** Script: [FTP] e: java.net.SocketTimeoutException: Read timed out
*** Script: [FTP] Line number: undefined
*** Script: [FTP] Source: undefined
*** Script: [FTP] Name: undefined
I though that it's caused because of some kind of firewall or other security measure but I can clearly establish SFTP connection from the instance server without a problem so why can't I connect from SNOW?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-10-2020 03:52 PM
Does this actually work? I thought access to the java packages was locked down as of Fuji release.
(per this thread here )
When I try this I get:
Attempted script access to inaccessible member denied - java.util.Properties:setProperty:(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/Object;
Background message, type:info, message: Exception caught :JavaException: java.lang.SecurityException: Illegal access to method setProperty(string,string) in class java.util.Properties
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-21-2021 07:08 AM
FYI - for anyone interested, while access to the java packages from the instance was locked down in Fuji release, they are still accessible on the mid server.
Here is an example of how to connect via FTP from the mid server:
(May take some adjusting to use SFTP)