当我尝试从ftp服务器获取文件以使用tikaEntityProcessor提取一些元数据时,我遇到了一些麻烦。
我需要一种方法将一些凭据传递给UrlDataSource。
请有人,请告诉我该怎么做?
示例值:
网址: ftp://localhost/Oreilly.Mercurial.The.Definitive.Guide.Jun.2009.pdf
ftp用户:alex
ftp密码:传递
这是我的Data-config.xml
<dataConfig>
<dataSource type="BinURLDataSource" name="binSource"
baseUrl="ftp://localhost:21/" onError="skip" />
<dataSource type="JdbcDataSource"
driver="org.postgresql.Driver"
url="jdbc:postgresql://localhost:5432/files"
user="postgres"
password="admin"
readOnly="true"
autoCommit="false"
transactionIsolation="TRANSACTION_READ_COMMITTED"
holdability="CLOSE_CURSORS_AT_COMMIT"/>
<document>
<entity name="item" query="select* from filesfromftp"
deltaQuery="select url from filesfromftp"
rootEntity="false"
transformer="RegexTransformer">
<field column="url" name="id" />
<entity name="tika-test"
processor="TikaEntityProcessor"
url="${item.url}"
format="none"
dataSource="binSource"
onError="skip">
<field column="Author" name="author" meta="true"/>
<field column="title" name="title" meta="true"/>
<field column="pdf:docinfo:title" name="title" meta="true"/>
<field column="xmpTPg:NPages" name="numPages" meta="true"/>
<field column="Creation-Date" name="createdDate" meta="true"/>
</entity>
</entity>
</document>
</dataConfig>
当我执行数据导入处理程序时,我收到此错误:
Exception in entity : tika-test:org.apache.solr.handler.dataimport.DataImportHandlerException: Exception in invoking url ftp://localhost/jnioche-bristoljavameetup20150310-150311041443-conversion-gate01.pdf Processing Document # 1
at org.apache.solr.handler.dataimport.DataImportHandlerException.wrapAndThrow(DataImportHandlerException.java:69)
at org.apache.solr.handler.dataimport.BinURLDataSource.getData(BinURLDataSource.java:89)
at org.apache.solr.handler.dataimport.BinURLDataSource.getData(BinURLDataSource.java:38)
at org.apache.solr.handler.dataimport.TikaEntityProcessor.nextRow(TikaEntityProcessor.java:128)
at org.apache.solr.handler.dataimport.EntityProcessorWrapper.nextRow(EntityProcessorWrapper.java:244)
at org.apache.solr.handler.dataimport.DocBuilder.buildDocument(DocBuilder.java:475)
at org.apache.solr.handler.dataimport.DocBuilder.buildDocument(DocBuilder.java:516)
at org.apache.solr.handler.dataimport.DocBuilder.buildDocument(DocBuilder.java:414)
at org.apache.solr.handler.dataimport.DocBuilder.doFullDump(DocBuilder.java:329)
at org.apache.solr.handler.dataimport.DocBuilder.execute(DocBuilder.java:232)
at org.apache.solr.handler.dataimport.DataImporter.doFullImport(DataImporter.java:416)
at org.apache.solr.handler.dataimport.DataImporter.runCmd(DataImporter.java:475)
at org.apache.solr.handler.dataimport.DataImporter.lambda$runAsync$0(DataImporter.java:458)
at java.lang.Thread.run(Thread.java:745)
Caused by: sun.net.ftp.FtpLoginException: Invalid username/password
at sun.net.www.protocol.ftp.FtpURLConnection.connect(FtpURLConnection.java:308)
at sun.net.www.protocol.ftp.FtpURLConnection.getInputStream(FtpURLConnection.java:393)
at org.apache.solr.handler.dataimport.BinURLDataSource.getData(BinURLDataSource.java:86)
... 12 more
请问,如何在SolrDIH中与FtpServer建立连接?
有没有办法将一些凭据传递给UrlDataSource?