Buen día,
Tengo un desarrollo heredado de una transmisión ftp usando la librería Apache Commons VFS 2.0. El desarrollo funciona bien en ambiente de pruebas pero en ambiente productivo me genera el siguiente error:
[DEBUG] 09 feb 06:37:25.211 PM main [org.apache.commons.vfs2.cache.SoftRefFilesCache] putFile: sftp://XX.XX.XX.XX/externo/pines_sms
[ERROR] 09 feb 06:37:25.398 PM main [co.com.ath.ftptransfer.service.SourceTransferService] No se pudo conectar al servidor de origen en la ruta /externo/pines_sms/.
org.apache.commons.vfs2.FileSystemException: Unknown message with code "Could not determine the type of file "sftp://XX.XX.XX.XX/externo/pines_sms".". at org.apache.commons.vfs2.provider.sftp.SftpFileObject.refresh(SftpFileObject.java:95) at org.apache.commons.vfs2.provider.AbstractFileSystem.resolveFile(AbstractFileSystem.java:366) at org.apache.commons.vfs2.provider.AbstractFileSystem.resolveFile(AbstractFileSystem.java:317) at org.apache.commons.vfs2.provider.AbstractOriginatingFileProvider.findFile(AbstractOriginatingFileProvider.java:85) at org.apache.commons.vfs2.provider.AbstractOriginatingFileProvider.findFile(AbstractOriginatingFileProvider.java:65) at org.apache.commons.vfs2.impl.DefaultFileSystemManager.resolveFile(DefaultFileSystemManager.java:693) at org.apache.commons.vfs2.impl.DefaultFileSystemManager.resolveFile(DefaultFileSystemManager.java:621) at co.com.ath.ftptransfer.service.SourceTransferService.getSFTPFile(SourceTransferService.java:125) at co.com.ath.ftptransfer.service.SourceTransferService.process(SourceTransferService.java:50) at co.com.ath.ftptransfer.StartApplication.main(StartApplication.java:24) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoader.java:58) Caused by: org.apache.commons.vfs2.FileSystemException: Could not determine the type of file "sftp://10.115.1.33/externo/ext_ath/pines_sms". at org.apache.commons.vfs2.provider.AbstractFileObject.getType(AbstractFileObject.java:505) at org.apache.commons.vfs2.provider.sftp.SftpFileObject.refresh(SftpFileObject.java:91) ... 14 more Caused by: org.apache.commons.vfs2.FileSystemException: Could not change to work directory "/". at org.apache.commons.vfs2.provider.sftp.SftpFileSystem.getChannel(SftpFileSystem.java:143) at org.apache.commons.vfs2.provider.sftp.SftpFileObject.statSelf(SftpFileObject.java:151) at org.apache.commons.vfs2.provider.sftp.SftpFileObject.doGetType(SftpFileObject.java:114) at org.apache.commons.vfs2.provider.AbstractFileObject.getType(AbstractFileObject.java:496) ... 15 more Exception in thread "main" java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoader.java:58) Caused by: java.lang.NullPointerException at co.com.ath.ftptransfer.service.SourceTransferService.getSFTPFile(SourceTransferService.java:216) at co.com.ath.ftptransfer.service.SourceTransferService.process(SourceTransferService.java:50) at co.com.ath.ftptransfer.StartApplication.main(StartApplication.java:24) ... 5 more
Este es el código de la clase donde se genera el error:
try {
logger.debug("[SourceTransferService].[getSFTPFile] Inicializando el administrador del sistema de archivos");
// Initializes the file manager
manager.init();
logger.debug("[SourceTransferService].[getSFTPFile] Configurando el sistema de archivos");
// Setup our SFTP configuration
StaticUserAuthenticator auth = new StaticUserAuthenticator(null, sourceFTP.getUser(),
sourceFTP.getPassword());
FileSystemOptions opts = new FileSystemOptions();
DefaultFileSystemConfigBuilder.getInstance().setUserAuthenticator(opts, auth);
SftpFileSystemConfigBuilder.getInstance().setStrictHostKeyChecking(opts, "no");
SftpFileSystemConfigBuilder.getInstance().setUserDirIsRoot(opts, true);
SftpFileSystemConfigBuilder.getInstance().setTimeout(opts, 10000);
SftpFileSystemConfigBuilder.getInstance().setUserDirIsRoot(opts, false);
String dirUrl = SFTPService.createSFTPURL(sourceFTP);
logger.debug("[SourceTransferService].[getSFTPFile] Ruta de conexión: " + dirUrl);
// OBTIENE EL DIRECTORIO DE DONDE SE ALMACENAN LOS ARCHIVOS
directory = manager.resolveFile(dirUrl, opts);
Se validan manualmente las credenciales y funcionan correctamente. ¿Alguna idea de que podría estar fallando?