tags:

views:

215

answers:

2

I had Solr 1.2 up and running at port 8983 and using liferay 5.1.1 the question is how to configure solr to search at liferay JournalArticle table I've already installed solr-web plugin for liferay but it throws this exception

[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)

and BTW here is my 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>

and what would the schema.xml would looklike in this case

A: 

Seems you must have more than one portal-kernel.jar file in your app server.

This jar cannot be duplicated within the context of at least the ear containing the portal app and plugins in an app server, or the global classpath if running in a servlet container like tomcat.

Ray
no, the problem is not in the jar,I searched the tomcat directory for and found only one copy of portal-kernel.jar but the problem only happen when I install solr pluginthe situation as follows :I had solr server up and running at port 8983 and liferay server at 8080 and when I installed solr plugin I configured the update and select URLs for solr and then i got the exception thrown above
Mustafa Zidan
A: 

he HttpUtils Class was actually altered to suite the requirements so the solution to this one was to replace original kernel class with the one we modified

Mustafa Zidan