cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Visit the PTCooler (the community lounge) to get to know your fellow community members and check out some of Dale's Friday Humor posts! X

FTP Connector Error

sarathi
14-Alexandrite

FTP Connector Error

I cant able to figure out the following Error

I am Downloading Json Files from FTP to System Repository and the parsing the file one by one and update to the Corresponding Thing

If I Check Script Log Given Follwing Error "[message: Execution error in service script [HT_IP_Data_Entry_Services] :: File Does Not Exist]"

 But if Check in Application Log it will given following error 

it.sauronsoftware.ftp4j.FTPException [code=550, message= The system cannot find the file specified. __ Win32 error: The system cannot find the file specified. __ Error details: File system returned an error.__End]__ at it.sauronsoftware.ftp4j.FTPClient.download(FTPClient.java:3479)__ at ftp_extension.FTP_Utils.DownloadFile(FTP_Utils.java:170)__ at ftp_extension.FTP_Server.DownloadFile(FTP_Server.java:114)__ at sun.reflect.GeneratedMethodAccessor205.invoke(Unknown Source)__ at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)__ at java.lang.reflect.Method.invoke(Unknown Source)__ at com.thingworx.common.processors.ReflectionProcessor.processService(ReflectionProcessor.java:261)__ at com.thingworx.handlers.ReflectionServiceHandler.processService(ReflectionServiceHandler.java:50)__ at com.thingworx.handlers.ServiceHandlerBase.processServiceWithMetrics(ServiceHandlerBase.java:48)__ at com.thingworx.things.Thing.processServiceRequestDirect(Thing.java:7763)__ at com.thingworx.things.Thing.processServiceRequest(Thing.java:7680)__ at com.thingworx.dsl.engine.adapters.VirtualFunction.call(VirtualFunction.java:145)__ at org.mozilla.javascript.optimizer.OptRuntime.call1(OptRuntime.java:32)__ at org.mozilla.javascript.gen.HT_IP_Data_Entry_Services_21855._c_script_0(HT_IP_Data_Entry_Services:30)__ at org.mozilla.javascript.gen.HT_IP_Data_Entry_Services_21855.call(HT_IP_Data_Entry_Services)__ at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:394)__ at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3090)__ at org.mozilla.javascript.gen.HT_IP_Data_Entry_Services_21855.call(HT_IP_Data_Entry_Services)__ at org.mozilla.javascript.gen.HT_IP_Data_Entry_Services_21855.exec(HT_IP_Data_Entry_Services)__ at com.thingworx.dsl.engine.DSLProcessor.executeService(DSLProcessor.java:171)__ at com.thingworx.dsl.DSLServiceHandler.processService(DSLServiceHandler.java:38)__ at com.thingworx.handlers.ServiceHandlerBase.processServiceWithMetrics(ServiceHandlerBase.java:48)__ at com.thingworx.things.Thing.processServiceRequestDirect(Thing.java:7763)__ at com.thingworx.things.Thing.processAPIServiceRequest(Thing.java:7701)__ at com.thingworx.webservices.BaseService.handleInvoke(BaseService.java:3050)__ at com.thingworx.webservices.BaseService.service(BaseService.java:355)__ at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)__ at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:292)__ at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)__ at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)__ at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)__ at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)__ at org.apache.catalina.filters.CorsFilter.handleNonCORS(CorsFilter.java:458)__ at org.apache.catalina.filters.CorsFilter.doFilter(CorsFilter.java:177)__ at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)__ at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)__ at com.thingworx.security.contenttype.ContentTypeFilter.doFilter(ContentTypeFilter.java:138)__ at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)__ at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)__ at com.thingworx.security.filter.ValidationFilter.doFilter(ValidationFilter.java:22)__ at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)__ at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)__ at com.thingworx.security.authentication.AuthenticationFilter.propagateRequest(AuthenticationFilter.java:533)__ at com.thingworx.security.authentication.AuthenticationFilter.doFilter(AuthenticationFilter.java:210)__ at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)__ at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)__ at org.tuckey.web.filters.urlrewrite.RuleChain.handleRewrite(RuleChain.java:176)__ at org.tuckey.web.filters.urlrewrite.RuleChain.doRules(RuleChain.java:145)__ at org.tuckey.web.filters.urlrewrite.UrlRewriter.processRequest(UrlRewriter.java:92)__ at org.tuckey.web.filters.urlrewrite.UrlRewriteFilter.doFilter(UrlRewriteFilter.java:389)__ at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)__ at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)__ at com.thingworx.security.filter.ClickjackFilter.doFilter(ClickjackFilter.java:178)__ at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)__ at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)__ at com.thingworx.security.filter.ProhibitIfNotLeaderFilter.doFilter(ProhibitIfNotLeaderFilter.java:119)__ at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)__ at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)__ at com.thingworx.security.filter.HttpResponseHeadersFilter.doFilter(HttpResponseHeadersFilter.java:173)__ at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)__ at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)__ at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:212)__ at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:94)__ at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:496)__ at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141)__ at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)__ at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:620)__ at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)__ at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:502)__ at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1156)__ at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:684)__ at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1539)__ at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1495)__ at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)__ at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)__ at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)__ at java.lang.Thread.run(Unknown Source)__

I dont know why this error is coming i need to know what is root cause of this Error

 

I am using The Following Code

var params1 = {
FTPPath: "/Scheduled/Queue/IP/" /* STRING */
};

// result: INFOTABLE dataShape: FTPServerListingShape
var filelist = Things["FTPConnector"].GetFileList(params1);
var filelistlength = filelist.getRowCount();
for (i=0; i<filelistlength; i++)
{
var singlefile=filelist[i].Name;
var params2 = {
FileRepository: Things["SystemRepository"].name /* THINGNAME */,
FTPFilePath: "/Scheduled/Queue/IP/"/* STRING */,
FTPFileName: singlefile /* STRING */
};

// result: STRING
var downloadFile = Things["FTPConnector"].DownloadFile(params2);


var params3 = {
path: "/"+singlefile /* STRING */
};

// result: JSON
var obj = Things["SystemRepository"].LoadJSON(params3);

}

Note:

 

Same code is working for different Location other than  "/Scheduled/Queue/IP/"

 

ACCEPTED SOLUTION

Accepted Solutions
sarathi
14-Alexandrite
(To:pgrodowski)

Thank you for your information @pgrodowski , I Changed  SystemRepository  to Some other Repository Thing after that Service Executed without Error

View solution in original post

4 REPLIES 4
pgrodowski
14-Alexandrite
(To:sarathi)

Hello,

 

From the error message it appears that a file does not exist in the location specified on the ftp server.

I would check the content of:

var filelist = Things["FTPConnector"].GetFileList(params1);
var filelistlength = filelist.getRowCount();

 

Maybe there is a blank / invalid line, not allowed characters in the file / path name, also check if the length matches the actual files. According to what ftp server is being used you should find filename restrictions in the manual. One more point would be to check file permissions to ensure the files can be accessed.

 

Another helpful way to debug this is to check at which file the call fails through logging.

 

Please let me know if this answered your questions or if you need any further information.

 

Regards,

Pascal

 

 

 

 

sarathi
14-Alexandrite
(To:pgrodowski)

Thank you for your information @pgrodowski , I Changed  SystemRepository  to Some other Repository Thing after that Service Executed without Error

pgrodowski
14-Alexandrite
(To:sarathi)

Thank you for getting back on this, I will mark your response as the answer. I still believe it could have to do with permission management to some extend as the files appear to be present, otherwise the other Repository would also fail to find them.

sarathi
14-Alexandrite
(To:pgrodowski)

Hi

@pgrodowski  Exactly i Cant able to find Root Cause of that Issue

In My case Both Thingworx and FTP Server on same Machine, I already given permission for FTP Folder and Thingworx Repository Folder ,In Thingworx Side I executed service with Administartor Credentials.

Exactly  I just created new Repository Thing in Thingworx and i didnt given any folder access from FTP server Side , I didnt Changed any files in that Folder after that same service was executed without error...

Reason for Error:

 

May be One of the file with same name already present in the  System Repository Folder, when i tried to download files with Same Name already present in systemrepository folder that above error are triggered

var params2 = {
FileRepository: Things["SystemRepository"].name /* THINGNAME */,
FTPFilePath: "/Scheduled/Queue/IP/"/* STRING */,
FTPFileName: singlefile /* STRING */
};

// result: STRING
var downloadFile = Things["FTPConnector"].DownloadFile(params2);

 

But I am not sure about it..

Announcements


Top Tags