solr3.6.2使用过程中过若干问题 记录

来源:互联网 发布:c语言的创始人 编辑:程序博客网 时间:2024/06/05 02:10

使用环境:solr3.6.2+tomcat6.0.37+jdk1.5

 

按照网上的说法部署solr,结果一直报错.出错reload currency.xml的时候出错.

信息: Reloading exchange rates from file currency.xml
2014-1-16 5:39:52 org.apache.solr.common.SolrException log
严重: java.lang.IllegalArgumentException
at java.util.Currency.getInstance(Currency.java:202)
at java.util.Currency.getInstance(Currency.java:168)

网上没有任何关于此xml出错的描述.这就是从apache-solr-3.6.2\example\solr下复制过来的.打开这个xml.内容很多....

<currencyConfig version="1.0">  <rates>    <!-- Updated from http://www.exchangerate.com/ at 2011-09-27 -->    <rate from="USD" to="ARS" rate="4.333871" comment="ARGENTINA Peso" />    <rate from="USD" to="AUD" rate="1.025768" comment="AUSTRALIA Dollar" />    <rate from="USD" to="EUR" rate="0.743676" comment="European Euro" />    <rate from="USD" to="BRL" rate="1.881093" comment="BRAZIL Real" />    <rate from="USD" to="CAD" rate="1.030815" comment="CANADA Dollar" />    <rate from="USD" to="CLP" rate="519.0996" comment="CHILE Peso" />    <rate from="USD" to="CNY" rate="6.387310" comment="CHINA Yuan" />    <rate from="USD" to="CZK" rate="18.47134" comment="CZECH REP. Koruna" />    <rate from="USD" to="DKK" rate="5.515436" comment="DENMARK Krone" />    <rate from="USD" to="HKD" rate="7.801922" comment="HONG KONG Dollar" />    <rate from="USD" to="HUF" rate="215.6169" comment="HUNGARY Forint" />    <rate from="USD" to="ISK" rate="118.1280" comment="ICELAND Krona" />    <rate from="USD" to="INR" rate="49.49088" comment="INDIA Rupee" />    <rate from="USD" to="XDR" rate="0.641358" comment="INTNL MON. FUND SDR" />    <rate from="USD" to="ILS" rate="3.709739" comment="ISRAEL Sheqel" />    <rate from="USD" to="JPY" rate="76.32419" comment="JAPAN Yen" />    <rate from="USD" to="KRW" rate="1169.173" comment="KOREA (SOUTH) Won" />    <rate from="USD" to="KWD" rate="0.275142" comment="KUWAIT Dinar" />    <rate from="USD" to="MXN" rate="13.85895" comment="MEXICO Peso" />    <rate from="USD" to="NZD" rate="1.285159" comment="NEW ZEALAND Dollar" />    <rate from="USD" to="NOK" rate="5.859035" comment="NORWAY Krone" />    <rate from="USD" to="PKR" rate="87.57007" comment="PAKISTAN Rupee" />    <rate from="USD" to="PEN" rate="2.730683" comment="PERU Sol" />    <rate from="USD" to="PHP" rate="43.62039" comment="PHILIPPINES Peso" />    <rate from="USD" to="PLN" rate="3.310139" comment="POLAND Zloty" />    <rate from="USD" to="RON" rate="3.100932" comment="ROMANIA Leu" />    <rate from="USD" to="RUB" rate="32.14663" comment="RUSSIA Ruble" />    <rate from="USD" to="SAR" rate="3.750465" comment="SAUDI ARABIA Riyal" />    <rate from="USD" to="SGD" rate="1.299352" comment="SINGAPORE Dollar" />    <rate from="USD" to="ZAR" rate="8.329761" comment="SOUTH AFRICA Rand" />    <rate from="USD" to="SEK" rate="6.883442" comment="SWEDEN Krona" />    <rate from="USD" to="CHF" rate="0.906035" comment="SWITZERLAND Franc" />    <rate from="USD" to="TWD" rate="30.40283" comment="TAIWAN Dollar" />    <rate from="USD" to="THB" rate="30.89487" comment="THAILAND Baht" />    <rate from="USD" to="AED" rate="3.672955" comment="U.A.E. Dirham" />    <rate from="USD" to="UAH" rate="7.988582" comment="UKRAINE Hryvnia" />    <rate from="USD" to="GBP" rate="0.647910" comment="UNITED KINGDOM Pound" />        <!-- Cross-rates for some common currencies -->    <rate from="EUR" to="GBP" rate="0.869914" />      <rate from="EUR" to="NOK" rate="7.800095" />      <rate from="GBP" to="NOK" rate="8.966508" />    </rates></currencyConfig>

妈蛋.从网上搜到的此xml没有这么玩意,全部删除了.只留下:

<currencyConfig version="1.0">  <rates><rate from="EUR" to="GBP" rate="0.869914" />      <rate from="EUR" to="NOK" rate="7.800095" />      <rate from="GBP" to="NOK" rate="8.966508" />    </rates></currencyConfig>

 

好了....

然后集成IKAnalyzer.在测试分词的时候爆了奇怪的错误.

14-1-16 6:01:48 org.apache.solr.common.SolrException log
严重: java.lang.NoSuchMethodError: java.util.Arrays.binarySearch([Ljava/lang/Object;IILjava/lang/Object;)I
at org.wltea.analyzer.dic.DictSegment.lookforSegment(DictSegment.java:229)
at org.wltea.analyzer.dic.DictSegment.fillSegment(DictSegment.java:199)
at org.wltea.analyzer.dic.DictSegment.fillSegment(DictSegment.java:170)

官方的说法是IKAnalyzer2012不支持1.5...额.好吧.换成3.2.8吧.

最后一个问题就是

严重: org.apache.solr.common.SolrException: Error loading class 'org.wltea.analyzer.solr.IKTokenizerFactory'
at org.apache.solr.core.SolrResourceLoader.findClass(SolrResourceLoader.java:394)
at org.apache.solr.core.SolrResourceLoader.newInstance(SolrResourceLoader.java:409)
at org.apache.solr.util.plugin.AbstractPluginLoader.create(AbstractPluginLoader.java:83)
at org.apache.solr.util.plugin.AbstractPluginLoader.load(AbstractPluginLoader.java:140)
at org.apache.solr.schema.IndexSchema.readAnalyzer(IndexSchema.java:986)
at org.apache.solr.schema.IndexSchema.access$100(IndexSchema.java:60)
at org.apache.solr.schema.IndexSchema$1.create(IndexSchema.java:443)

jar包没有正确加载.放在solr_home下面的lib里面加载不到.直接丢项目下的lib可以加载....

 

导入数据库中的BLOB字段,配置和网上的一样.

<dataSource name="localorcl" type="JdbcDataSource" driver="oracle.jdbc.driver.OracleDriver" url="jdbc:oracle:thin:@localhost:1521:ORCL" user="scott" password="a" /><dataSource name="file" type="FieldStreamDataSource" />  <entity dataSource="localorcl" name="DP_TEMPLATE" query="select TPL_ID,CONTENT from DP_TEMPLATE" >   <field column="TPL_ID" name="ID" />    <entity dataSource="file" processor="TikaEntityProcessor" url="CONTENT" dataField="DP_TEMPLATE.CONTENT" >     <field column="text" name="DOCCONTENT"/>    </entity>    </entity>    

1.url貌似是没用的.

2.blob字段的name还不能和数据库的相同(未证实,从网上看到的).

3.solr3.6.2下的apache-solr-3.6.2\contrib\extraction\lib目录下的包,导入.只有一部分有用,懒得去分辨了.网上找到的说是找tika-app-0.9.jar,官网上只有1.4的版本,导入会报错说Version不对.

4.开始的时候一直报错说不能加载TikaEntityProcessor.前前后后找了很多包,也不对,最后谷歌一把,发现原来是还有一个包没导入.apache-solr-dataimporthandler-extras-3.6.2.jar.这个玩意,没有导入.导入一切正常.可以从数据库导入blob字段.

 

 

使用正常的db-data-config.xml

<dataConfig><dataSource name="localorcl" type="JdbcDataSource" driver="oracle.jdbc.driver.OracleDriver" url="jdbc:oracle:thin:@localhost:1521:ORCL" user="scott" password="a" /><dataSource name="localmysql" type="JdbcDataSource" driver="com.mysql.jdbc.Driver" url="jdbc:mysql://localhost:3306/imageshow" user="root" password="root" /><dataSource name="file" type="FieldStreamDataSource" /><dataSource name="myfilereader" type="FileDataSource"/>    <dataSource name="bin" type="BinFileDataSource" />    <document><!--导入文件内容-->        <entity name="f" dataSource="null" rootEntity="false" processor="FileListEntityProcessor" baseDir="F:\test\small"  fileName=".*" onError="skip" recursive="true"><field column="fileAbsolutePath" name="path" />            <field column="fileSize" name="size" />            <field column="fileLastModified" name="lastmodified" /><field column="fileAbsolutePath" name="ID"/>            <entity name="tika-test" dataSource="bin" processor="TikaEntityProcessor" url="${f.fileAbsolutePath}" format="text" onError="skip">                <field column="Author" name="author" meta="true"/>                <field column="title" name="title" meta="true"/>                <field column="text" name="DOCCONTENT" />                    </entity>        </entity><!--导入大字段--><entity dataSource="localorcl" name="DP_TEMPLATE" query="select TPL_ID,CONTENT from DP_TEMPLATE" ><field column="TPL_ID" name="ID" /><entity dataSource="file" processor="TikaEntityProcessor" url="CONTENT" dataField="DP_TEMPLATE.CONTENT" > <field column="text" name="DOCCONTENT"/>              </entity>  </entity> <entity dataSource="localorcl" name="PORTAL_DETAIL_INFO" query="select ID,TITLE,TYPE_ID,CREATOR,CRE_DATE,DELFLAG from PORTAL_DETAIL_INFO" ></entity>   <entity dataSource="localorcl" name="YS_ERRLOG" query="select * from YS_ERRLOG" ><field column="LOGID" name="ID" />   </entity>  <entity dataSource="localmysql" name="images" query="select * from images"><field column="id" name="id" />  <field column="imagename" name="imagename" /><field column="type" name="type" /><field column="keyword" name="keyword" />   </entity>     </document></dataConfig>


 

0 0