首页 文章

WSO2 VFS FTP代理不读取参数

提问于
浏览
3

我编写了一个代理服务并部署在WSO2 ESB 5上,通过http接收一些文件内容,并使用vfs transport将该内容传输到ftp服务器 . 当我正确指定连接参数时,服务按预期工作,但是当我在连接字符串上指定错误来模拟下行服务器时,我无法使用[1]中指定的参数来控制VFS传输的行为 . 我正在寻找的是缩短VFS中发生的错误与Axis捕获的故障异常之间的延迟;

正如您将在下面看到的那样,我在重试之间指定0次重试和0次等待时间,但似乎VFSTransportSender类无法以某种方式读取这些值,因为它始终执行相同的重试次数并且等待相同的秒数每次执行时,我也改变了值并放了其他但结果总是相同的,服务器总是重试3次,除了原始请求之外还有30秒的延迟,之后Axis能够收到一些相关的信息错误 .

这是我的代理服务,没有任何问题:

<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
       name="ftpProxy"
       startOnLoad="true"
       statistics="disable"
       trace="disable"
       transports="https,http">
   <target>
  <inSequence>
     <log level="full"/>
     <property expression="json-eval($.key)" name="file_name"/>
     <property name="OUT_ONLY" value="true"/>
     <property name="FORCE_SC_ACCEPTED" scope="axis2" value="true"/>
     <property name="HTTP_SC" scope="axis2" value="200"/>
     <property expression="fn:concat(get-property('file_name'), '.json')"
               name="transport.vfs.ReplyFileName"
               scope="transport"/>
     <property name="OUT_ONLY" value="true"/>
  </inSequence>
  <endpoint name="ftp_endpoint">
     <address uri="vfs:ftp://jairof_ftp:passftp@localhost:21">
        <timeout>
           <duration>2000</duration>
           <responseAction>fault</responseAction>
        </timeout>
        <suspendOnFailure>
           <errorCodes>-1</errorCodes>
           <progressionFactor>1.0</progressionFactor>
        </suspendOnFailure>
        <markForSuspension>
           <errorCodes>-1</errorCodes>
        </markForSuspension>
     </address>
  </endpoint>
   </target>
   <parameter name="transport.vfs.ReconnectTimeout">0</parameter>
   <parameter name="transport.vfs.MaxRetryCount">0</parameter>
   <description/>
</proxy>

当我想模拟服务器无法访问时,我只修改了地址URI,并将其放在用户不正确的位置:

<address uri="vfs:ftp://ja8irof_ftp:passftp@localhost:21">

我还尝试在调用 endpoints 之前将transport.vfs参数设置为属性,但结果完全相同

在这里,您可以检查部分日志文件,其中我剪切了堆栈跟踪的某些部分以使帖子简单:

[2016-10-29 12:23:01,134] ERROR - VFSTransportSender cannot resolve replyFile
org.apache.commons.vfs2.FileSystemException: Could not connect to FTP server on "localhost".
... (the rest of stack trace)
...
Caused by: org.apache.commons.vfs2.FileSystemException: Could not login to FTP server on "localhost" as user "ja8irof_ftp".
at org.apache.commons.vfs2.provider.ftp.FtpClientFactory.createConnection(FtpClientFactory.java:210)
... 29 more

[2016-10-29 12:23:34,223] ERROR - VFSTransportSender cannot resolve replyFile
org.apache.commons.vfs2.FileSystemException: Could not connect to FTP server on "localhost".
... (the rest of stack trace)
...
Caused by: org.apache.commons.vfs2.FileSystemException: Could not login to FTP server on "localhost" as user "ja8irof_ftp".
at org.apache.commons.vfs2.provider.ftp.FtpClientFactory.createConnection(FtpClientFactory.java:210)
... 29 more

[2016-10-29 12:24:07,842] ERROR - VFSTransportSender cannot resolve replyFile
org.apache.commons.vfs2.FileSystemException: Could not connect to FTP server on "localhost".
... (the rest of stack trace)
...
Caused by: org.apache.commons.vfs2.FileSystemException: Could not login to FTP server on "localhost" as user "ja8irof_ftp".
at org.apache.commons.vfs2.provider.ftp.FtpClientFactory.createConnection(FtpClientFactory.java:210)
... 29 more

[2016-10-29 12:24:07,844] ERROR - VFSTransportSender cannot resolve replyFile repeatedly: Could not connect to FTP server on "localhost".
org.apache.commons.vfs2.FileSystemException: Could not connect to FTP server on "localhost".        
... (the rest of stack trace)
...
Caused by: org.apache.commons.vfs2.FileSystemException: Could not login to FTP server on "localhost" as user "ja8irof_ftp".
at org.apache.commons.vfs2.provider.ftp.FtpClientFactory.createConnection(FtpClientFactory.java:210)
... 29 more

[2016-10-29 12:24:07,846] ERROR - Axis2Sender Unexpected error during sending message out
org.apache.axis2.AxisFault: cannot resolve replyFile repeatedly: Could not connect to FTP server on "localhost".
... (the rest of stack trace)
...
Caused by: org.apache.commons.vfs2.FileSystemException: Could not connect to FTP server on "localhost".
at org.apache.commons.vfs2.provider.ftp.FtpClientFactory.createConnection(FtpClientFactory.java:275)
at org.apache.commons.vfs2.provider.ftp.FTPClientWrapper.createClient(FTPClientWrapper.java:100)
at org.apache.commons.vfs2.provider.ftp.FTPClientWrapper.getFtpClient(FTPClientWrapper.java:134)
at org.apache.commons.vfs2.provider.ftp.FTPClientWrapper.<init>(FTPClientWrapper.java:59)
at org.apache.commons.vfs2.provider.ftp.FtpFileProvider.doCreateFileSystem(FtpFileProvider.java:128)
at org.apache.commons.vfs2.provider.AbstractOriginatingFileProvider.getFileSystem(AbstractOriginatingFileProvider.java:155)
at org.apache.commons.vfs2.provider.AbstractOriginatingFileProvider.findFile(AbstractOriginatingFileProvider.java:119)
at org.apache.commons.vfs2.provider.AbstractOriginatingFileProvider.findFile(AbstractOriginatingFileProvider.java:88)
at org.apache.commons.vfs2.impl.DefaultFileSystemManager.resolveFile(DefaultFileSystemManager.java:738)
at org.apache.commons.vfs2.impl.DefaultFileSystemManager.resolveFile(DefaultFileSystemManager.java:626)
at org.apache.synapse.transport.vfs.VFSTransportSender.writeFile(VFSTransportSender.java:233)
... 19 more
Caused by: org.apache.commons.vfs2.FileSystemException: Could not login to FTP server on "localhost" as user "ja8irof_ftp".
at org.apache.commons.vfs2.provider.ftp.FtpClientFactory.createConnection(FtpClientFactory.java:210)
... 29 more

请给我任何评论,建议...我非常感谢,提前感谢您的时间 .

[1] https://docs.wso2.com/display/ESB500/VFS+Transport

1 回答

  • 2

    尝试将参数附加到 endpoints URL,如下所示 .

    <address uri="vfs:ftp://ja8irof_ftp:passftp@localhost:21?transport.vfs.MaxRetryCount=0&amp;transport.vfs.ReconnectTimeout=0"/>
    

相关问题