OK, I'm running into a roadblock again. The last "caused by" error in my stack trace is

_Caused by: java.lang.ClassCastException: class org.apache.solr.handler.dataimport.DataImportHandler

_Searching the web, I see that this can be caused by having the DIH jar files loaded by more than one classloader, or by a different one, and that the solution is to remove the DIH jar files from the default Solr classpath, and put them in a separate directory, and then reference that directory in solrconfig.xml.

I removed the DIH jar files from /opt/apache-tomcat/lib/ and then put them into /etc/solr/lib/, with this line in solrconfig.xml

<lib dir="/etc/solr/lib" regex=".*\.jar" />

When I restarted Solr through my Tomcat application manager, I got a page that gave an error "resource not found", so I'm guessing that's because I removed the DIH files from the Tomcat classpath, not the Solr classpath, and that caused an error. Is this the actual problem, and if so, where are the files that I need to remove?
Brian

On 8/29/2013 10:02 AM, Jack Krupansky wrote:
"init failure" usually means you had a bad configuration parameter. You need to look for the last "caused by" in the stack trace and that should tell you what the parameter problem was.

-- Jack Krupansky

-----Original Message----- From: Brian Robinson
Sent: Thursday, August 29, 2013 10:43 AM
To: solr-user@lucene.apache.org
Subject: Can't get Solr to run with DataImportHandler

Hello,
I've been trying to get Solr to run with DataImportHandler. I've found
various issues and fixed them, but I'm still getting an error message,
and I can't find anything else to fix. Could someone please take a look
at my setup to see if I've done something wrong? When I go to the Solr
admin page, I get the following error:

_SolrCore 'collection1' is not available due to init failure:
RequestHandler init failure,trace=org.apache.solr.common.SolrException:
SolrCore 'collection1' is not available due to init failure:
RequestHandler init failure at
org.apache.solr.core.CoreContainer.getCore(CoreContainer.java:1212) at
org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:248)
at
_
There's more to the error, but it looks like it doesn't contain any
useful information, so please let me know if I should show more.

My core instance is in /etc/solr/collection1/ and I have the JDBC driver
in /etc/solr/lib/. The DataImportHandler jar files are in
/opt/solr/contrib/dataimporthandler/lib and /opt/solr/dist/. Here are
the RequestHandler and lib sections of my solrconfig.xml file, which is
in /etc/solr/collection1/conf/.

<requestHandler name="/dataimport"
class="org.apache.solr.handler.dataimport.DataImportHandler">
<lst name="defaults">
<str name="config">data-config.xml</str>
</lst>
</requestHandler>

  <lib dir="/opt/solr/contrib/dataimporthandler/lib" regex=".*\.jar" />
  <lib dir="/opt/solr/dist/"
regex="apache-solr-dataimporthandler-.*\.jar" />
  <lib dir="/etc/solr/lib" regex=".*\.jar" />

I've tried writing the file paths as if they were from the /etc/solr/
directory, and also as if they were from the /etc/solr/collection1/conf/
directory, and neither worked so I just started from the top.

----------------------------------------------------------------------------------

Here is my data-config.xml (also in the /etc/solr/collection1/conf/
directory). The keyword, catCatName, and brandCatName columns

<dataConfig>
    <dataSource type="JdbcDataSource" driver="com.mysql.jdbc.Driver"
url="jdbc:mysql://localhost/XXXXX" user="XXXXX" password="XXXXX"/>
    <document name="products">
        <entity name="product" query="select id, brand, prodName,
description, buyURL, imgURL, currency, price, salePrice, fanNum,
lastUpdate from product_CJ" pk="id" deltaImportQuery="select id, brand,
prodName, description, buyURL, imgURL, currency, price, salePrice,
fanNum, lastUpdate from product_CJ where id='${dih.delta.id}'"
deltaQuery="select id from product_CJ where lastUpdate &gt;
'${dih.last_index_time}'">
            <field column="id" name="id" />
            <field column="brand" name="brand" />
            <field column="prodName" name="prodName" />
            <field column="description" name="description" />
            <field column="buyURL" name="buyURL" />
            <field column="imgURL" name="imgURL" />
            <field column="currency" name="currency" />
            <field column="price" name="price" />
            <field column="salePrice" name="salePrice" />
            <field column="fanNum" name="fanNum" />
            <field column="lastUpdate" name="lastUpdate" />

            <entity name="brandInfo" query="select feedID, brandName,
kickbackBase, kickbackMax, kickbackFlat, kickbackType, feed from
brands_inactive where feedID='${product.brand}'">
                <field name="feedID" column="feedID" />
                <field name="brandName" column="brandName" />
                <field name="kickbackBase" column="kickbackBase" />
                <field name="kickbackMax" column="kickbackMax" />
                <field name="kickbackFlat" column="kickbackFlat" />
                <field name="kickbackType" column="kickbackType" />
                <field name="feed" column="feed" />
            </entity>

            <entity name="keywords" query="select keyword from
productKeywords where prodID='${product.id}'">
                <field column="keyword" name="keyword" />
            </entity>

            <entity name="catIDs" query="select catID from prod_cat
where prodID='${product.id}'">
                <entity name="catMaps" query="select defCatID from
cat_cat_maps where catID='${catIDs.catID}'">
                  <entity name="catCatNames" query="select catName AS
catCatName from definedCategories where defCatID='${catMaps.defCatID}'">
                  <field column="catCatName" name="catCatName" />
                </entity>
              </entity>
            </entity>

            <entity name="brandMaps" query="select defCatID from
brand_cat_maps where brandID='${product.brand}'">
              <entity name="brandCatNames" query="select catName AS
brandCatName from definedCategories where defCatID='${brandMaps.defCatID}'">
                <field column="brandCatName" name="brandCatName" />
              </entity>
            </entity>
        </entity>
    </document>
    </dataConfig>

----------------------------------------------------------------------------------

And here is my schema.xml

 <fields>
   <field name="id" type="int" indexed="true" stored="true"
required="true" multiValued="false" />
   <field name="prodName" type="text_general" indexed="true"
stored="true" required="true"/>
   <field name="brand" type="int" indexed="false" stored="true"
required="true"/>
   <field name="brandName" type="text_general" indexed="true"
stored="true" required="true"/>
<field name="currency" type="currency" indexed="true" stored="true" />
   <field name="price" type="float" indexed="false" stored="true"/>
   <field name="salePrice"  type="float" indexed="false" stored="true"/>
   <field name="fanNum" type="int" indexed="false" stored="true" />
   <field name="feedID" type="int" indexed="false" stored="false"
required="true" />
<field name="kickbackBase" type="float" indexed="false" stored="true" /> <field name="kickbackMax" type="float" indexed="false" stored="true" /> <field name="kickbackFlat" type="float" indexed="false" stored="true" />
   <field name="kickbackType" type="string" indexed="false"
stored="true" />
   <field name="feed" type="string" indexed="false" stored="true" />
   <field name="keyword" type="text_general" indexed="true"
stored="true" multiValued="true"/>
   <field name="catCatName" type="text_general" indexed="true"
stored="true" multiValued="true"/>
   <field name="brandCatName" type="text_general" indexed="true"
stored="true" multiValued="true"/>
   <field name="buyURL" type="text_general" indexed="false"
stored="true" required="true"/>
<field name="imgURL" type="text_general" indexed="false" stored="true"/> <field name="lastUpdate" type="string" indexed="false" stored="true"/>
   <field name="description" type="text_general" indexed="false"
stored="true"/>
   <field name="text" type="text_general" indexed="true" stored="false"
multiValued="true"/>
   <field name="text_rev" type="text_general_rev" indexed="true"
stored="false" multiValued="true"/>
   <field name="brand_exact" type="text_general" indexed="true"
stored="false"/>
</fields>

<uniqueKey>id</uniqueKey>

   <copyField source="catCatName" dest="text"/>
   <copyField source="brandCatName" dest="text"/>
   <copyField source="prodName" dest="text"/>
   <copyField source="brandName" dest="brand_exact"/>
   <copyField source="description" dest="text"/>
   <copyField source="keyword" dest="text"/>

Does anyone see anything that I'm doing wrong?
Brian
_
_





Reply via email to