Liferay 5.1.1 solr插件ClassCastException

时间:2010-03-22 16:21:16

标签: solr liferay

我有Solr 1.2并在端口8983上运行并使用liferay 5.1.1问题是如何配置solr来搜索liferay JournalArticle表我已经为liferay安装了solr-web插件但它抛出了这个异常

[SolrIndexSearcherImpl:79] Error while sending request to Solr
java.lang.ClassCastException: com.liferay.portal.kernel.util.HttpUtil cannot be cast to com.liferay.portal.kernel.util.HttpUtil
        at com.liferay.portal.kernel.util.HttpUtil._getUtil(HttpUtil.java:317)
        at com.liferay.portal.kernel.util.HttpUtil.getHttp(HttpUtil.java:96)
        at com.liferay.portal.kernel.util.HttpUtil.addParameter(HttpUtil.java:68)
        at com.liferay.portal.search.solr.SolrIndexSearcherImpl.search(SolrIndexSearcherImpl.java:71)
        at com.liferay.portal.search.solr.SolrSearchEngineUtil.search(SolrSearchEngineUtil.java:78)
        at com.liferay.portal.search.solr.messaging.SolrReaderMessageListener.doCommandSearch(SolrReaderMessageListener.java:92)
        at com.liferay.portal.search.solr.messaging.SolrReaderMessageListener.doReceive(SolrReaderMessageListener.java:75)
        at com.liferay.portal.search.solr.messaging.SolrReaderMessageListener.receive(SolrReaderMessageListener.java:46)
        at com.liferay.portal.kernel.messaging.InvokerMessageListener.receive(InvokerMessageListener.java:69)
        at com.liferay.portal.kernel.messaging.ParallelDestination$1.run(ParallelDestination.java:59)
        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
        at java.lang.Thread.run(Thread.java:619)
16:08:16,174 ERROR [SolrReaderMessageListener:49] Unable to process message com.liferay.portal.kernel.messaging.Message@2c591d98
com.liferay.portal.kernel.search.SearchException: java.lang.ClassCastException: com.liferay.portal.kernel.util.HttpUtil cannot be cast to com.liferay.portal.kernel.util.HttpUtil
        at com.liferay.portal.search.solr.SolrIndexSearcherImpl.search(SolrIndexSearcherImpl.java:81)
        at com.liferay.portal.search.solr.SolrSearchEngineUtil.search(SolrSearchEngineUtil.java:78)
        at com.liferay.portal.search.solr.messaging.SolrReaderMessageListener.doCommandSearch(SolrReaderMessageListener.java:92)
        at com.liferay.portal.search.solr.messaging.SolrReaderMessageListener.doReceive(SolrReaderMessageListener.java:75)
        at com.liferay.portal.search.solr.messaging.SolrReaderMessageListener.receive(SolrReaderMessageListener.java:46)
        at com.liferay.portal.kernel.messaging.InvokerMessageListener.receive(InvokerMessageListener.java:69)
        at com.liferay.portal.kernel.messaging.ParallelDestination$1.run(ParallelDestination.java:59)
        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)

和BTW这里是我的solr-web solr-spring.xml

<beans>
    <bean id="indexSearcher" class="com.liferay.portal.search.solr.SolrIndexSearcherImpl">
     <property name="serverURL" value="http://localhost:8983/solr/select" />
    </bean>
    <bean id="indexWriter" class="com.liferay.portal.search.solr.SolrIndexWriterImpl">
     <property name="serverURL" value="http://localhost:8983/solr/update" />
    </bean>
    <bean id="searchEngine" class="com.liferay.portal.search.solr.SolrSearchEngineImpl">
  <property name="name" value="Solr" />
     <property name="searcher" ref="indexSearcher" />
     <property name="writer" ref="indexWriter" />
     <property name="indexReadOnly" value="false" />
    </bean>

 <bean id="searchEngineUtil" class="com.liferay.portal.search.solr.SolrSearchEngineUtil" lazy-init="false">
     <constructor-arg ref="searchEngine" />
     <constructor-arg ref="searchReaderMessageListener" />
     <constructor-arg ref="searchWriterMessageListener" />
    </bean>

在这种情况下schema.xml会是什么样子

2 个答案:

答案 0 :(得分:0)

似乎您的应用服务器中必须有多个portal-kernel.jar文件。

这个jar不能在至少包含应用服务器中的门户应用和插件的耳朵的上下文中复制,或者如果在像tomcat这样的servlet容器中运行则不能在全局类路径中复制。

答案 1 :(得分:0)

他实际上改变了HttpUtils类以满足要求,因此解决这个问题的方法是用我们修改的内核类替换原始内核类