org.apache.commons.net.ftp.parser.ParserInitializationException: Unknown parser type: Linux

余生颓废 提交于 2019-12-11 11:58:28

问题


I am trying to connect to FTP server which is on Linux, I am getting below exception when I execute ftp.listFiles(remote);

SYST 215  Linux  Exception in thread "AWT-EventQueue-0"
org.apache.commons.net.ftp.parser.ParserInitializationException:
Unknown parser type:  Linux     at
org.apache.commons.net.ftp.parser.DefaultFTPFileEntryParserFactory.createFileEntryParser(DefaultFTPFileEntryParserFactory.java:165)
at
org.apache.commons.net.ftp.parser.DefaultFTPFileEntryParserFactory.createFileEntryParser(DefaultFTPFileEntryParserFactory.java:94)
at
org.apache.commons.net.ftp.FTPClient.initiateListParsing(FTPClient.java:3192)
at
org.apache.commons.net.ftp.FTPClient.listFiles(FTPClient.java:2857)

The same code is working fine when I connect to FTP server which is on Windows.

I searched for the solution of it but I guess no one has faced such issue with linux. Found one post here which recommends to use listNames() instead listfiles() but that too is not working with different error.

Please help.


回答1:


FTPClient ftp = new FTPClient()    
ftp.configure(new FTPClientConfig(FTPClientConfig.SYST_UNIX));

Try setting an FTPCientConfig that matches your system.



来源:https://stackoverflow.com/questions/16009094/org-apache-commons-net-ftp-parser-parserinitializationexception-unknown-parser

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!