VFS 上传文件到sftp 报错!

wangbin0016 2014-12-18 08:46:39
在 centos6.5 建一个sftp 用户 dsideal 组为 sftp

ChrootDirectory /home/sftp

定义了一个 上传文件的文件夹 /home/sftp/fs 。配置完毕后。

用filezilla 登录 可以登录。可以看到fs目录。并且可以在fs目录下面读写文件。

但是用vfs 会报错。

FileObject targetfs = null;
FileObject srcfs = null;
targetfs = repoFile.resolveFile(fo.getFullpath());
srcfs = mgr.resolveFile(fo.getFile(), "");
targetfs.copyFrom(srcfs, Selectors.SELECT_FILES);

Caused by: org.apache.commons.vfs2.FileSystemException: Could not copy "file:///E:/ktcworkspace/ktc-platform/ktc-platform-wyadmin/target/tomcat/work/Tomcat/localhost/_/upload_7c184acf_14a5d645fc3__8000_00000008.tmp" to "sftp://dsideal:***@192.168.1.168/image/public/2014/12/3/5/30_b5761ed526d0499d8ce33fb8c9e65eb0.jpg".
at org.apache.commons.vfs2.provider.AbstractFileObject.copyFrom(AbstractFileObject.java:1062)
at zycj.ktc.filestore.store.SftpFileStore.store(SftpFileStore.java:105)
... 75 more
Caused by: org.apache.commons.vfs2.FileSystemException: Could not create folder "sftp://dsideal:***@192.168.1.168/image".
Caused by: 3: Permission denied
at com.jcraft.jsch.ChannelSftp.throwStatusError(ChannelSftp.java:2491)
at com.jcraft.jsch.ChannelSftp.mkdir(ChannelSftp.java:1897)
at org.apache.commons.vfs2.provider.sftp.SftpFileObject.doCreateFolder(SftpFileObject.java:209)
at org.apache.commons.vfs2.provider.AbstractFileObject.createFolder(AbstractFileObject.java:988)
... 86 more


是什么原因?
...全文
603 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
  • 打赏
  • 举报
回复
2018/11/09 19:54:08 - RepositoriesMeta - Reading repositories XML file: C:\Users\Administrator\.kettle\repositories.xml
2018/11/09 19:54:10 - DBCache - Loading database cache from file: [C:\Users\Administrator\.kettle\db.cache-7.1.0.0-12]
2018/11/09 19:54:10 - DBCache - We read 5 cached rows from the database cache!
2018/11/09 19:54:11 - RepositoriesMeta - No repositories file found in the local directory: D:\CDH\pdi-ce-7.1.0.0-12\data-integration\repositories.xml
2018/11/09 19:54:11 - RepositoriesMeta - Reading repositories XML file: C:\Users\Administrator\.kettle\repositories.xml
2018/11/09 19:54:11 - Spoon - 试图打开最近使用的文件.
2018/11/09 19:54:12 - Spoon - Connected to metastore : File repository, added to delegating metastore
2018/11/09 19:54:12 - RepositoriesMeta - No repositories file found in the local directory: D:\CDH\pdi-ce-7.1.0.0-12\data-integration\repositories.xml
2018/11/09 19:54:12 - RepositoriesMeta - Reading repositories XML file: C:\Users\Administrator\.kettle\repositories.xml
2018/11/09 19:54:17 - Spoon - Transformation [hadoop_input_output] in directory [/] loaded from the repository.
2018/11/09 19:54:24 - Spoon - 保存文件或资源库...
2018/11/09 19:54:24 - Spoon - 保存到资源库...
2018/11/09 19:54:24 - DBCache - We wrote 5 cached rows to the database cache!
2018/11/09 19:54:24 - Spoon - Using legacy execution engine
2018/11/09 19:54:24 - Spoon - 转换已经打开.
2018/11/09 19:54:24 - Spoon - 正在打开转换 [hadoop_input_output]...
2018/11/09 19:54:24 - Spoon - 开始执行转换.
2018/11/09 19:54:25 - hadoop_input_output - 为了转换解除补丁开始 [hadoop_input_output]
2018/11/09 19:54:26 - Hadoop File Input.0 - Opening file: hdfs://root:***@cdh1:8020/tmp/demo_agg.txt
2018/11/09 19:54:26 - Hadoop File Input.0 - 完成处理 (I=3, O=0, R=0, W=3, U=1, E=0)
2018/11/09 19:54:26 - Hadoop File Output.0 - ERROR (version 7.1.0.0-12, build 1 from 2017-05-16 17.18.02 by buildguy) : Unexpected error
2018/11/09 19:54:26 - Hadoop File Output.0 - ERROR (version 7.1.0.0-12, build 1 from 2017-05-16 17.18.02 by buildguy) : org.pentaho.di.core.exception.KettleException:
2018/11/09 19:54:26 - Hadoop File Output.0 - Error opening new file : org.pentaho.di.core.exception.KettleFileException:
2018/11/09 19:54:26 - Hadoop File Output.0 -
2018/11/09 19:54:26 - Hadoop File Output.0 - org.apache.commons.vfs2.FileSystemException: Could not create file "hdfs://cdh1/user/Administrator/texxt.txt".
2018/11/09 19:54:26 - Hadoop File Output.0 - Could not create file "hdfs://cdh1/user/Administrator/texxt.txt".
2018/11/09 19:54:26 - Hadoop File Output.0 -
2018/11/09 19:54:26 - Hadoop File Output.0 - Could not create file "hdfs://cdh1/user/Administrator/texxt.txt".
2018/11/09 19:54:26 - Hadoop File Output.0 -
2018/11/09 19:54:26 - Hadoop File Output.0 -
2018/11/09 19:54:26 - Hadoop File Output.0 - at org.pentaho.di.trans.steps.textfileoutput.TextFileOutput.openNewFile(TextFileOutput.java:692)
2018/11/09 19:54:26 - Hadoop File Output.0 - at org.pentaho.di.trans.steps.textfileoutput.TextFileOutput.processRow(TextFileOutput.java:130)
2018/11/09 19:54:26 - Hadoop File Output.0 - at org.pentaho.di.trans.step.RunThread.run(RunThread.java:62)
2018/11/09 19:54:26 - Hadoop File Output.0 - at java.lang.Thread.run(Thread.java:745)
2018/11/09 19:54:26 - Hadoop File Output.0 - 完成处理 (I=0, O=0, R=1, W=0, U=0, E=1)
2018/11/09 19:54:26 - hadoop_input_output - ERROR (version 7.1.0.0-12, build 1 from 2017-05-16 17.18.02 by buildguy) : 错误被检测到!
2018/11/09 19:54:26 - Spoon - 转换完成!!
2018/11/09 19:54:26 - hadoop_input_output - ERROR (version 7.1.0.0-12, build 1 from 2017-05-16 17.18.02 by buildguy) : 错误被检测到!
2018/11/09 19:54:26 - hadoop_input_output - ERROR (version 7.1.0.0-12, build 1 from 2017-05-16 17.18.02 by buildguy) : 错误被检测到!
2018/11/09 19:54:26 - hadoop_input_output - 转换被检测
2018/11/09 19:54:26 - hadoop_input_output - 转换正在杀死其他步骤!


我的发生这种问题,不是权限吧,org.apache.commons.vfs2.FileSystemException: Could not create file "hdfs://cdh1/user/Administrator/texxt.txt".

只是说不能创建文件,原因就是这个,都没说具体是什么原因。。。。。。。
wangbin0016 2014-12-20
  • 打赏
  • 举报
回复
targetfs = repoFile.resolveFile(fo.getFullpath()); targetfs debug显示的路径是全路径 sftp://test:test@192.168.1.168/home/sftp/fs/image/public/1.jpg /home/sftp 是属于root的。 fs下面的 都是属于test用户的。也就是sftp的用户。 filezilla 登录以后 显示的是/fs 以及下面的文件。而且可以删除增加操作。
wangbin0016 2014-12-20
  • 打赏
  • 举报
回复
相同的用户 。我用filezilla 登录以后 是可以在/fs 文件夹下面读写的。
tianfang 2014-12-19
  • 打赏
  • 举报
回复
文件系统权限不够 Caused by: org.apache.commons.vfs2.FileSystemException: Could not create folder "sftp://dsideal:***@192.168.1.168/image". Caused by: 3: Permission denied

67,513

社区成员

发帖
与我相关
我的任务
社区描述
J2EE只是Java企业应用。我们需要一个跨J2SE/WEB/EJB的微容器,保护我们的业务核心组件(中间件),以延续它的生命力,而不是依赖J2SE/J2EE版本。
社区管理员
  • Java EE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧