2013-04-15 92 views
0

當我嘗試從DIH使用DIH導入數據,我得到了這個錯誤。HTTP錯誤500:Solr配置中的嚴重錯誤.Ruby on rails

HTTP ERROR 500 

Problem accessing /solr/dataimport. Reason: 

    Severe errors in solr configuration. 

Check your log files for more detailed information on what may be wrong. 

If you want solr to continue after configuration errors, change: 



    <abortOnConfigurationError>false</abortOnConfigurationError> 

in solr.xml 

    org.apache.solr.common.SolrException: Error loading class 'org.apache.solr.handler.dataimport.DataImportHandler' 
     at org.apache.solr.core.SolrResourceLoader.findClass(SolrResourceLoader.java:389) 
     at org.apache.solr.core.SolrCore.createInstance(SolrCore.java:425) 
     at org.apache.solr.core.SolrCore.createRequestHandler(SolrCore.java:461) 
     at org.apache.solr.core.RequestHandlers.initHandlersFromConfig(RequestHandlers.java:157) 
     at org.apache.solr.core.SolrCore.<init>(SolrCore.java:565) 
     at org.apache.solr.core.CoreContainer.create(CoreContainer.java:463) 
     at org.apache.solr.core.CoreContainer.load(CoreContainer.java:316) 
     at org.apache.solr.core.CoreContainer$Initializer.initialize(CoreContainer.java:133) 
     at org.apache.solr.servlet.SolrDispatchFilter.init(SolrDispatchFilter.java:94) 
     at org.mortbay.jetty.servlet.FilterHolder.doStart(FilterHolder.java:97) 
     at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50) 
     at org.mortbay.jetty.servlet.ServletHandler.initialize(ServletHandler.java:713) 
     at org.mortbay.jetty.servlet.Context.startContext(Context.java:140) 
     at org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1282) 
     at org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:518) 
     at org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:499) 
     at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50) 
     at org.mortbay.jetty.handler.HandlerCollection.doStart(HandlerCollection.java:152) 
     at org.mortbay.jetty.handler.ContextHandlerCollection.doStart(ContextHandlerCollection.java:156) 
     at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50) 
     at org.mortbay.jetty.handler.HandlerCollection.doStart(HandlerCollection.java:152) 
     at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50) 
     at org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:130) 
     at org.mortbay.jetty.Server.doStart(Server.java:224) 
     at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50) 
     at org.mortbay.xml.XmlConfiguration.main(XmlConfiguration.java:985) 
     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) 
     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 
     at java.lang.reflect.Method.invoke(Method.java:616) 
     at org.mortbay.start.Main.invokeMain(Main.java:194) 
     at org.mortbay.start.Main.start(Main.java:534) 
     at org.mortbay.start.Main.start(Main.java:441) 
     at org.mortbay.start.Main.main(Main.java:119) 
    Caused by: java.lang.ClassNotFoundException: org.apache.solr.handler.dataimport.DataImportHandler 
     at java.net.URLClassLoader$1.run(URLClassLoader.java:217) 
     at java.security.AccessController.doPrivileged(Native Method) 
     at java.net.URLClassLoader.findClass(URLClassLoader.java:205) 
     at java.lang.ClassLoader.loadClass(ClassLoader.java:321) 
     at java.net.FactoryURLClassLoader.loadClass(URLClassLoader.java:615) 
     at java.lang.ClassLoader.loadClass(ClassLoader.java:266) 
     at java.lang.Class.forName0(Native Method) 
     at java.lang.Class.forName(Class.java:264) 
     at org.apache.solr.core.SolrResourceLoader.findClass(SolrResourceLoader.java:373) 
     ... 33 more 

這裏是我的schema.xml代碼

<fields> 
    <field name="brands_test_id" type="string" indexed="true" stored="true" required="true" /> 
    <field name="categories_test_id" type="string" indexed="true" stored="true" required="true" /> 
    </fields> 

而且數據-config.xml中有這樣的代碼:

<dataConfig> 
    <dataSource type="JdbcDataSource" 
       driver="com.mysql.jdbc.Driver" 
       url="jdbc:mysql://localhost/Webpage"  
       user="test" 
       password="test123"/> 
    <document name="Products"> 
     <entity name="products" query="select brands_test_id,categories_test_id from products" 
      <field name="brands_test_id" column="brands_test_id" 
      <field name="categories_test_id" column="categories_test_id" 
      <entity name="brands_test" query="select name from brands_test where id='$products.brands_test_id' " 
        <field name="brands_test" column="brands_test"/> 
      </entity> 
      <entity name="categories_test" query="select name from categories_test where id='$products.categories_test_id' " 
        <field name="categories_test" column="categories_test"/> 
      </entity> 
     </entity> 
    </document> 
</dataConfig> 

這裏是solrconfig.xml中的文件

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

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

我下載了mysql-connector-ja va-3.1.14.tar.gz並解壓縮並複製到lib目錄。 Ami正確定義文件目錄?請幫我解決這個問題。

回答