我正在尝试在cfscript中执行getFile
到SFTP服务器,并且在我工作了一整天后,我在这里,希望至少得到一些提示。
所以,这是我的剧本:
LOCAL.fileName = lsDateFormat(now(), 'yyyymmdd') & '.csv';
LOCAL.filePath = "example_path\#LOCAL.fileName#";
LOCAL.ftpService = new FTP();
LOCAL.ftpService.setServer('sftp.example.com');
LOCAL.ftpService.setPort('22');
LOCAL.ftpService.setUserName('example_user');
LOCAL.ftpService.setSecure('true');
LOCAL.ftpService.setKey("example_privateSSH.ppk");
LOCAL.ftpService.setStopOnError(true);
LOCAL.ftpService.setRemoteFile('example_r_file');
LOCAL.ret = LOCAL.ftpService.open();
writeDump(LOCAL.ret);
LOCAL.doInsert = 0;
if(LOCAL.ret.getPrefix().succeeded){
LOCAL.testExists = LOCAL.ftpService.existsFile();
writeDump(LOCAL.testExists);
if(LOCAL.testExists.getPrefix().succeeded){
LOCAL.doInsert = 1;
LOCAL.ftpService.setLocalFile(LOCAL.filePath);
LOCAL.ftpService.setFailIfExists(false);
LOCAL.resp = LOCAL.ftpService.getFile();
writeDump(LOCAL.resp);
}
}
LOCAL.ftpService.close();
连接服务器:确定
ExistsFile测试:确定
GetFile:KO。
我收到以下消息:
标记CFFTP的属性验证错误。它具有无效的属性组合:action,failifexists,key,localfile,port,remotefile,server,stoponerror,username。可能的组合包括:
必需属性:'action,localfile,password,remotefile,server,username'。可选属性:'agentname,asciiextensionlist,attributes,buffersize,failifexists,fingerprint,passive,port,proxybypass,proxyserver,result,retrycount,secure,stoponerror,timeout,transfermode'。 必需属性:'action,localfile,key,remotefile,server,username'。可选属性:'agentname,asciiextensionlist,attributes,buffersize,failifexists,fingerprint,passphrase,port,proxybypass,proxyserver,result,retrycount,secure,stoponerror,timeout,transfermode'。 必需属性:'action,connection,localfile,remotefile'。可选属性:'agentname,asciiextensionlist,attributes,buffersize,failifexists,fingerprint,passive,password,port,proxybypass,proxyserver,result,retrycount,secure,server,stoponerror,timeout,transfermode,username'。
栈跟踪
coldfusion.tagext.validation.IllegalAttrConfigException: Attribute validation error for tag CFFTP.
at coldfusion.tagext.validation.TagAttrConfiguration.validate(TagAttrConfiguration.java:212)
at coldfusion.tagext.validation.TagAttrConfiguration.validate(TagAttrConfiguration.java:165)
at coldfusion.tagext.validation.CFMLTagValidator.validateAttrConfiguration(CFMLTagValidator.java:202)
at coldfusion.tagext.GenericTag._setArguments(GenericTag.java:466)
at cfbase2ecfc845959907$funcINVOKETAG.runFunction(C:\ColdFusion9\CustomTags\com\adobe\coldfusion\base.cfc:338)
at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:472)
at coldfusion.runtime.UDFMethod$ReturnTypeFilter.invoke(UDFMethod.java:405)
at coldfusion.runtime.UDFMethod$ArgumentCollectionFilter.invoke(UDFMethod.java:368)
at coldfusion.filter.FunctionAccessFilter.invoke(FunctionAccessFilter.java:55)
at coldfusion.runtime.UDFMethod.runFilterChain(UDFMethod.java:321)
at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:220)
at coldfusion.runtime.CfJspPage._invokeUDF(CfJspPage.java:2582)
at coldfusion.runtime.CfJspPage._invoke(CfJspPage.java:2383)
at cfftp2ecfc1567526491$funcINVOKETAG.runFunction(C:\ColdFusion9\CustomTags\com\adobe\coldfusion\ftp.cfc:300)
at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:472)
at coldfusion.filter.SilentFilter.invoke(SilentFilter.java:47)
at coldfusion.runtime.UDFMethod$ReturnTypeFilter.invoke(UDFMethod.java:405)
at coldfusion.runtime.UDFMethod$ArgumentCollectionFilter.invoke(UDFMethod.java:368)
at coldfusion.filter.FunctionAccessFilter.invoke(FunctionAccessFilter.java:55)
at coldfusion.runtime.UDFMethod.runFilterChain(UDFMethod.java:321)
at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:220)
at coldfusion.runtime.CfJspPage._invokeUDF(CfJspPage.java:2582)
at cfftp2ecfc1567526491$funcGETFILE.runFunction(C:\ColdFusion9\CustomTags\com\adobe\coldfusion\ftp.cfc:185)
at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:472)
at coldfusion.filter.SilentFilter.invoke(SilentFilter.java:47)
at coldfusion.runtime.UDFMethod$ReturnTypeFilter.invoke(UDFMethod.java:405)
at coldfusion.runtime.UDFMethod$ArgumentCollectionFilter.invoke(UDFMethod.java:368)
at coldfusion.filter.FunctionAccessFilter.invoke(FunctionAccessFilter.java:55)
at coldfusion.runtime.UDFMethod.runFilterChain(UDFMethod.java:321)
at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:220)
at coldfusion.runtime.TemplateProxy.invoke(TemplateProxy.java:491)
at coldfusion.runtime.TemplateProxy.invoke(TemplateProxy.java:337)
at coldfusion.runtime.CfJspPage._invoke(CfJspPage.java:2360)
at cfupdate_stats_nmp2ecfm1620928340.runPage(E:\IIS\wwwroot\softVillage\Scheduled\AdminEmailing\update_stats_nmp.cfm:28)
at coldfusion.runtime.CfJspPage.invoke(CfJspPage.java:231)
at coldfusion.tagext.lang.IncludeTag.doStartTag(IncludeTag.java:416)
at coldfusion.runtime.CfJspPage._emptyTcfTag(CfJspPage.java:2722)
at cfApplication2ecfc2017417412$funcONREQUEST.runFunction(E:\IIS\wwwroot\softVillage\Application.cfc:56)
at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:472)
at coldfusion.runtime.UDFMethod$ArgumentCollectionFilter.invoke(UDFMethod.java:368)
at coldfusion.filter.FunctionAccessFilter.invoke(FunctionAccessFilter.java:55)
at coldfusion.runtime.UDFMethod.runFilterChain(UDFMethod.java:321)
at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:220)
at coldfusion.runtime.TemplateProxy.invoke(TemplateProxy.java:491)
at coldfusion.runtime.TemplateProxy.invoke(TemplateProxy.java:337)
at coldfusion.runtime.AppEventInvoker.invoke(AppEventInvoker.java:88)
at coldfusion.runtime.AppEventInvoker.onRequest(AppEventInvoker.java:280)
at coldfusion.filter.ApplicationFilter.invoke(ApplicationFilter.java:356)
at coldfusion.filter.RequestMonitorFilter.invoke(RequestMonitorFilter.java:48)
at coldfusion.filter.MonitoringFilter.invoke(MonitoringFilter.java:40)
at coldfusion.filter.PathFilter.invoke(PathFilter.java:94)
at coldfusion.filter.ExceptionFilter.invoke(ExceptionFilter.java:70)
at coldfusion.filter.ClientScopePersistenceFilter.invoke(ClientScopePersistenceFilter.java:28)
at coldfusion.filter.BrowserFilter.invoke(BrowserFilter.java:38)
at coldfusion.filter.NoCacheFilter.invoke(NoCacheFilter.java:46)
at coldfusion.filter.GlobalsFilter.invoke(GlobalsFilter.java:38)
at coldfusion.filter.DatasourceFilter.invoke(DatasourceFilter.java:22)
at coldfusion.filter.CachingFilter.invoke(CachingFilter.java:62)
at coldfusion.CfmServlet.service(CfmServlet.java:200)
at coldfusion.bootstrap.BootstrapServlet.service(BootstrapServlet.java:89)
at jrun.servlet.FilterChain.doFilter(FilterChain.java:86)
at coldfusion.monitor.event.MonitoringServletFilter.doFilter(MonitoringServletFilter.java:42)
at coldfusion.bootstrap.BootstrapFilter.doFilter(BootstrapFilter.java:46)
at jrun.servlet.FilterChain.doFilter(FilterChain.java:94)
at jrun.servlet.FilterChain.service(FilterChain.java:101)
at jrun.servlet.ServletInvoker.invoke(ServletInvoker.java:106)
at jrun.servlet.JRunInvokerChain.invokeNext(JRunInvokerChain.java:42)
at jrun.servlet.JRunRequestDispatcher.invoke(JRunRequestDispatcher.java:286)
at jrun.servlet.ServletEngineService.dispatch(ServletEngineService.java:543)
at jrun.servlet.jrpp.JRunProxyService.invokeRunnable(JRunProxyService.java:203)
at jrunx.scheduler.ThreadPool$DownstreamMetrics.invokeRunnable(ThreadPool.java:320)
at jrunx.scheduler.ThreadPool$ThreadThrottle.invokeRunnable(ThreadPool.java:428)
at jrunx.scheduler.ThreadPool$UpstreamMetrics.invokeRunnable(ThreadPool.java:266)
at jrunx.scheduler.WorkerThread.run(WorkerThread.java:66)
我一遍又一遍地检查了我的代码,但无法找到无效代码的位置。我的错误在哪里?
答案 0 :(得分:0)
尝试:
LOCAL.resp = LOCAL.ftpService.getFile('example_r_file',LOCAL.filePath,true);