![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Hi. I have this problem. I can to compile a java store procedure that reference a external library. I tested this source in eclipse and execute correctly. I want to copy a file using SFTP from external server to Oracle server. I have loaded the external library "jsch-0.1.37.jar" using javaload, and compiled the java store procedure. But I have problem with the load and with the java source. The java source not find the external library. I use: Oracle 9.0.2.8.0 loadjava -definer -grant plsql -oci8 -resolve -schema tcm -synonym - user tcm/tcmp... (AT) sgfdes (DOT) sion -verbose C:\aem\work\jsch-0.1.37.jar ++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++ create or replace and compile java source named copia_sftp as import com.jcraft.jsch.*; /** * class Copia_Sftp */ public class Copia_Sftp extends Object { public static String ejecutar(String host, String user, String passwd, int port, String remote_path, String local_path, String file_name) { String error = "0"; String message = ""; try { JSch jsch = new JSch(); Session session = jsch.getSession(user, host, port); // Crea una session . UsuarioSFTP ui = new UsuarioSFTP(); ui.setClave(passwd); session.setUserInfo(ui); session.connect(); // Abre el canal. Channel channel = session.openChannel("sftp"); channel.connect(); ChannelSftp c = (ChannelSftp) channel; try { try { c.get(remote_path + file_name, local_path + file_name); return ((new String (error + message))); } catch (SftpException e) { e.printStackTrace(); error = "1"; message = e.toString(); System.out.println(e.toString()); } session.disconnect(); } catch (Exception e) { e.printStackTrace(); error = "1"; message = e.toString(); System.out.println(e); } } catch (Throwable e) { error = "1"; message = e.toString(); e.printStackTrace(); } finally { return ((new String (error + message))); } } } /** * class UsuarioSFTP */ public class UsuarioSFTP implements UserInfo,UIKeyboardInteractive { private String clave; private String nombre; public String getPassphrase() { return null; } public String getPassword() { return clave; } public boolean promptPassword(String message) { return true; } public boolean promptPassphrase(String message) { return true; } public boolean promptYesNo(String message) { return true; } public void showMessage(String message) { } public void setClave(String clave) { this.clave = clave; } public String getNombre() { return nombre; } public void setNombre(String nombre) { this.nombre = nombre; } public String[] promptKeyboardInteractive(String destination, String name, String instruction, String[] prompt, boolean[] echo) { String [] resultado = new String [prompt.length]; resultado [0] = clave; return resultado; } } ++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++ When I compile the java store procedure. Compilation errors for JAVA SOURCE COPIA_SFTP Error: Interface UIKeyboardInteractive of class UsuarioSFTP not found. Line: 69 Text: public class UsuarioSFTP implements UserInfo,UIKeyboardInteractive Error: Interface UserInfo of class UsuarioSFTP not found. Line: 69 Text: public class UsuarioSFTP implements UserInfo,UIKeyboardInteractive Error: Class JSch not found. Line: 23 Text: JSch jsch = new JSch(); Thank a lot. Alvaro |
#3
| |||
| |||
|
|
Hi. I have this problem. I can to compile a java store procedure that reference a external library. I tested this source in eclipse and execute correctly. I want to copy a file using SFTP from external server to Oracle server. I have loaded the external library "jsch-0.1.37.jar" using javaload, and compiled the java store procedure. But I have problem with the load and with the java source. The java source not find the external library. I use: Oracle 9.0.2.8.0 loadjava -definer -grant plsql -oci8 -resolve -schema tcm -synonym - user tcm/tcmp... (AT) sgfdes (DOT) sion -verbose C:\aem\work\jsch-0.1.37.jar ++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++ create or replace and compile java source named copia_sftp as import com.jcraft.jsch.*; /** * class Copia_Sftp */ public class Copia_Sftp extends Object { public static String ejecutar(String host, String user, String passwd, int port, String remote_path, String local_path, String file_name) { String error = "0"; String message = ""; try { JSch jsch = new JSch(); Session session = jsch.getSession(user, host, port); // Crea una session . UsuarioSFTP ui = new UsuarioSFTP(); ui.setClave(passwd); session.setUserInfo(ui); session.connect(); // Abre el canal. Channel channel = session.openChannel("sftp"); channel.connect(); ChannelSftp c = (ChannelSftp) channel; try { try { c.get(remote_path + file_name, local_path + file_name); return ((new String (error + message))); } catch (SftpException e) { e.printStackTrace(); error = "1"; message = e.toString(); System.out.println(e.toString()); } session.disconnect(); } catch (Exception e) { e.printStackTrace(); error = "1"; message = e.toString(); System.out.println(e); } } catch (Throwable e) { error = "1"; message = e.toString(); e.printStackTrace(); } finally { return ((new String (error + message))); } } } /** * class UsuarioSFTP */ public class UsuarioSFTP implements UserInfo,UIKeyboardInteractive { private String clave; private String nombre; public String getPassphrase() { return null; } public String getPassword() { return clave; } public boolean promptPassword(String message) { return true; } public boolean promptPassphrase(String message) { return true; } public boolean promptYesNo(String message) { return true; } public void showMessage(String message) { } public void setClave(String clave) { this.clave = clave; } public String getNombre() { return nombre; } public void setNombre(String nombre) { this.nombre = nombre; } public String[] promptKeyboardInteractive(String destination, String name, String instruction, String[] prompt, boolean[] echo) { String [] resultado = new String [prompt.length]; resultado [0] = clave; return resultado; } } ++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++ When I compile the java store procedure. Compilation errors for JAVA SOURCE COPIA_SFTP Error: Interface UIKeyboardInteractive of class UsuarioSFTP not found. Line: 69 Text: public class UsuarioSFTP implements UserInfo,UIKeyboardInteractive Error: Interface UserInfo of class UsuarioSFTP not found. Line: 69 Text: public class UsuarioSFTP implements UserInfo,UIKeyboardInteractive Error: Class JSch not found. Line: 23 Text: JSch jsch = new JSch(); Thank a lot. Alvaro |
#4
| |||
| |||
|
|
Hi. I have this problem. I can to compile a java store procedure that reference a external library. I tested this source in eclipse and execute correctly. I want to copy a file using SFTP from external server to Oracle server. I have loaded the external library "jsch-0.1.37.jar" using javaload, and compiled the java store procedure. But I have problem with the load and with the java source. The java source not find the external library. I use: Oracle 9.0.2.8.0 loadjava -definer -grant plsql -oci8 -resolve -schema tcm -synonym - user tcm/tcmp... (AT) sgfdes (DOT) sion -verbose C:\aem\work\jsch-0.1.37.jar ++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++ create or replace and compile java source named copia_sftp as import com.jcraft.jsch.*; /** * class Copia_Sftp */ public class Copia_Sftp extends Object { public static String ejecutar(String host, String user, String passwd, int port, String remote_path, String local_path, String file_name) { String error = "0"; String message = ""; try { JSch jsch = new JSch(); Session session = jsch.getSession(user, host, port); // Crea una session . UsuarioSFTP ui = new UsuarioSFTP(); ui.setClave(passwd); session.setUserInfo(ui); session.connect(); // Abre el canal. Channel channel = session.openChannel("sftp"); channel.connect(); ChannelSftp c = (ChannelSftp) channel; try { try { c.get(remote_path + file_name, local_path + file_name); return ((new String (error + message))); } catch (SftpException e) { e.printStackTrace(); error = "1"; message = e.toString(); System.out.println(e.toString()); } session.disconnect(); } catch (Exception e) { e.printStackTrace(); error = "1"; message = e.toString(); System.out.println(e); } } catch (Throwable e) { error = "1"; message = e.toString(); e.printStackTrace(); } finally { return ((new String (error + message))); } } } /** * class UsuarioSFTP */ public class UsuarioSFTP implements UserInfo,UIKeyboardInteractive { private String clave; private String nombre; public String getPassphrase() { return null; } public String getPassword() { return clave; } public boolean promptPassword(String message) { return true; } public boolean promptPassphrase(String message) { return true; } public boolean promptYesNo(String message) { return true; } public void showMessage(String message) { } public void setClave(String clave) { this.clave = clave; } public String getNombre() { return nombre; } public void setNombre(String nombre) { this.nombre = nombre; } public String[] promptKeyboardInteractive(String destination, String name, String instruction, String[] prompt, boolean[] echo) { String [] resultado = new String [prompt.length]; resultado [0] = clave; return resultado; } } ++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++ When I compile the java store procedure. Compilation errors for JAVA SOURCE COPIA_SFTP Error: Interface UIKeyboardInteractive of class UsuarioSFTP not found. Line: 69 Text: public class UsuarioSFTP implements UserInfo,UIKeyboardInteractive Error: Interface UserInfo of class UsuarioSFTP not found. Line: 69 Text: public class UsuarioSFTP implements UserInfo,UIKeyboardInteractive Error: Class JSch not found. Line: 23 Text: JSch jsch = new JSch(); Thank a lot. Alvaro |
#5
| |||
| |||
|
|
Hi. I have this problem. I can to compile a java store procedure that reference a external library. I tested this source in eclipse and execute correctly. I want to copy a file using SFTP from external server to Oracle server. I have loaded the external library "jsch-0.1.37.jar" using javaload, and compiled the java store procedure. But I have problem with the load and with the java source. The java source not find the external library. I use: Oracle 9.0.2.8.0 loadjava -definer -grant plsql -oci8 -resolve -schema tcm -synonym - user tcm/tcmp... (AT) sgfdes (DOT) sion -verbose C:\aem\work\jsch-0.1.37.jar ++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++ create or replace and compile java source named copia_sftp as import com.jcraft.jsch.*; /** * class Copia_Sftp */ public class Copia_Sftp extends Object { public static String ejecutar(String host, String user, String passwd, int port, String remote_path, String local_path, String file_name) { String error = "0"; String message = ""; try { JSch jsch = new JSch(); Session session = jsch.getSession(user, host, port); // Crea una session . UsuarioSFTP ui = new UsuarioSFTP(); ui.setClave(passwd); session.setUserInfo(ui); session.connect(); // Abre el canal. Channel channel = session.openChannel("sftp"); channel.connect(); ChannelSftp c = (ChannelSftp) channel; try { try { c.get(remote_path + file_name, local_path + file_name); return ((new String (error + message))); } catch (SftpException e) { e.printStackTrace(); error = "1"; message = e.toString(); System.out.println(e.toString()); } session.disconnect(); } catch (Exception e) { e.printStackTrace(); error = "1"; message = e.toString(); System.out.println(e); } } catch (Throwable e) { error = "1"; message = e.toString(); e.printStackTrace(); } finally { return ((new String (error + message))); } } } /** * class UsuarioSFTP */ public class UsuarioSFTP implements UserInfo,UIKeyboardInteractive { private String clave; private String nombre; public String getPassphrase() { return null; } public String getPassword() { return clave; } public boolean promptPassword(String message) { return true; } public boolean promptPassphrase(String message) { return true; } public boolean promptYesNo(String message) { return true; } public void showMessage(String message) { } public void setClave(String clave) { this.clave = clave; } public String getNombre() { return nombre; } public void setNombre(String nombre) { this.nombre = nombre; } public String[] promptKeyboardInteractive(String destination, String name, String instruction, String[] prompt, boolean[] echo) { String [] resultado = new String [prompt.length]; resultado [0] = clave; return resultado; } } ++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++ When I compile the java store procedure. Compilation errors for JAVA SOURCE COPIA_SFTP Error: Interface UIKeyboardInteractive of class UsuarioSFTP not found. Line: 69 Text: public class UsuarioSFTP implements UserInfo,UIKeyboardInteractive Error: Interface UserInfo of class UsuarioSFTP not found. Line: 69 Text: public class UsuarioSFTP implements UserInfo,UIKeyboardInteractive Error: Class JSch not found. Line: 23 Text: JSch jsch = new JSch(); Thank a lot. Alvaro |
![]() |
| Thread Tools | |
| Display Modes | |
| |