Error while importing msql db into solr -
i have tried import mysql db contains location, user, post, comment among many other tables. wish build search engine web app using solr search posts , comments. added following: 1)to db-data-config.xml
<dataconfig> <datasource type="jdbcdatasource" driver="com.mysql.jdbc.driver" url="jdbc:mysql://localhost/apnistreet" user="root" password="password" /> <document> <entity name="location" query="select id location"> <entity name="user" query="select id user location_id=${location.id}"> <entity name="post" query="select id,post,user_id post user_id=${user.id} order time desc"> <field column="post" name="post"/> <entity name="comment" query="select comment,id,post_id,user_id comment post_id={post.id} order time desc"> <field column="comment" name="comment"/> </entity> </entity> </entity> </entity> </document> </dataconfig>
the tables contain many other columns require these fields returned thought didn't need add them.
2)to solrconfig.xml file added:
<requesthandler name="/dataimport" class="org.apache.solr.handler.dataimport.dataimporthandler"> <lst name="defaults"> <str name="config">db-data-config.xml</str> </lst> </requesthandler> <lib dir="../../../lib/" regex="mysql-connector-java-5.1.29-bin.jar" /> <lib dir="../../../dist/" regex="solr-dataimporthandler-\d.*\.jar" /> <lib dir="../../../contrib/dataimporthandler/lib" regex=".*\.jar" />
3) schema.xml added:
<field name="id" type="int" indexed="true" stored="true" required="true" multivalued="false" /> <field name="location_id" type="int" indexed="true" stored="true" required="true" multivalued="false" /> <field name="user_id" type="int" indexed="true" stored="true" required="true" multivalued="false" /> <field name="post_id" type="int" indexed="true" stored="true" required="true" multivalued="false" /> <field name="post" type="text_general" indexed="true" stored="true" multivalued="true"/> <field name="comment" type="text_general" indexed="true" stored="true" multivalued="true"/> <field name="time" type="long" indexed="false" stored="true" multivalued="true"/>
then ran java -jar start.jar
and load data went url localhost:8983/solr/dataimport?command=full-import
but gave following error dont know how go about:
http error 500 problem accessing /solr/. reason: {msg=solrcore 'collection1' not available due init failure: error opening new searcher,trace=org.apache.solr.common.solrexception: solrcore 'collection1' not available due init failure: error opening new searcher @ org.apache.solr.core.corecontainer.getcore(corecontainer.java:827) @ org.apache.solr.servlet.solrdispatchfilter.dofilter(solrdispatchfilter.java:305) @ org.apache.solr.servlet.solrdispatchfilter.dofilter(solrdispatchfilter.java:205) @ org.eclipse.jetty.servlet.servlethandler$cachedchain.dofilter(servlethandler.java:1419) @ org.eclipse.jetty.servlet.servlethandler.dohandle(servlethandler.java:455) @ org.eclipse.jetty.server.handler.scopedhandler.handle(scopedhandler.java:137) @ org.eclipse.jetty.security.securityhandler.handle(securityhandler.java:557) @ org.eclipse.jetty.server.session.sessionhandler.dohandle(sessionhandler.java:231) @ org.eclipse.jetty.server.handler.contexthandler.dohandle(contexthandler.java:1075) @ org.eclipse.jetty.servlet.servlethandler.doscope(servlethandler.java:384) @ org.eclipse.jetty.server.session.sessionhandler.doscope(sessionhandler.java:193) @ org.eclipse.jetty.server.handler.contexthandler.doscope(contexthandler.java:1009) @ org.eclipse.jetty.server.handler.scopedhandler.handle(scopedhandler.java:135) @ org.eclipse.jetty.server.handler.contexthandlercollection.handle(contexthandlercollection.java:255) @ org.eclipse.jetty.server.handler.handlercollection.handle(handlercollection.java:154) @ org.eclipse.jetty.server.handler.handlerwrapper.handle(handlerwrapper.java:116) @ org.eclipse.jetty.server.server.handle(server.java:368) @ org.eclipse.jetty.server.abstracthttpconnection.handlerequest(abstracthttpconnection.java:489) @ org.eclipse.jetty.server.blockinghttpconnection.handlerequest(blockinghttpconnection.java:53) @ org.eclipse.jetty.server.abstracthttpconnection.headercomplete(abstracthttpconnection.java:942) @ org.eclipse.jetty.server.abstracthttpconnection$requesthandler.headercomplete(abstracthttpconnection.java:1004) @ org.eclipse.jetty.http.httpparser.parsenext(httpparser.java:640) @ org.eclipse.jetty.http.httpparser.parseavailable(httpparser.java:235) @ org.eclipse.jetty.server.blockinghttpconnection.handle(blockinghttpconnection.java:72) @ org.eclipse.jetty.server.bio.socketconnector$connectorendpoint.run(socketconnector.java:264) @ org.eclipse.jetty.util.thread.queuedthreadpool.runjob(queuedthreadpool.java:608) @ org.eclipse.jetty.util.thread.queuedthreadpool$3.run(queuedthreadpool.java:543) @ java.lang.thread.run(thread.java:744) caused by: org.apache.solr.common.solrexception: error opening new searcher @ org.apache.solr.core.solrcore.<init>(solrcore.java:844) @ org.apache.solr.core.solrcore.<init>(solrcore.java:630) @ org.apache.solr.core.corecontainer.createfromlocal(corecontainer.java:562) @ org.apache.solr.core.corecontainer.create(corecontainer.java:597) @ org.apache.solr.core.corecontainer$1.call(corecontainer.java:258) @ org.apache.solr.core.corecontainer$1.call(corecontainer.java:250) @ java.util.concurrent.futuretask.run(futuretask.java:262) @ java.util.concurrent.executors$runnableadapter.call(executors.java:471) @ java.util.concurrent.futuretask.run(futuretask.java:262) @ java.util.concurrent.threadpoolexecutor.runworker(threadpoolexecutor.java:1145) @ java.util.concurrent.threadpoolexecutor$worker.run(threadpoolexecutor.java:615) ... 1 more caused by: org.apache.solr.common.solrexception: error opening new searcher @ org.apache.solr.core.solrcore.opennewsearcher(solrcore.java:1521) @ org.apache.solr.core.solrcore.getsearcher(solrcore.java:1633) @ org.apache.solr.core.solrcore.<init>(solrcore.java:827) ... 11 more caused by: java.lang.numberformatexception: input string: "1.gen" @ java.lang.numberformatexception.forinputstring(numberformatexception.java:65) @ java.lang.long.parselong(long.java:441) @ org.apache.lucene.index.segmentinfos.generationfromsegmentsfilename(segmentinfos.java:248) @ org.apache.lucene.index.segmentinfos.getlastcommitgeneration(segmentinfos.java:183) @ org.apache.lucene.index.segmentinfos$findsegmentsfile.run(segmentinfos.java:746) @ org.apache.lucene.index.segmentinfos$findsegmentsfile.run(segmentinfos.java:694) @ org.apache.lucene.index.segmentinfos.read(segmentinfos.java:400) @ org.apache.lucene.index.indexwriter.<init>(indexwriter.java:746) @ org.apache.solr.update.solrindexwriter.<init>(solrindexwriter.java:77) @ org.apache.solr.update.solrindexwriter.create(solrindexwriter.java:64) @ org.apache.solr.update.defaultsolrcorestate.createmainindexwriter(defaultsolrcorestate.java:267) @ org.apache.solr.update.defaultsolrcorestate.getindexwriter(defaultsolrcorestate.java:110) @ org.apache.solr.core.solrcore.opennewsearcher(solrcore.java:1484) ... 13 more ,code=500} powered jetty://
does error come wrong technique of declaring entities , fields or other reasons. plz me sort out.
i have sorted out problem sneaky one:
<lib dir="../../../lib/" regex="mysql-connector-java-5.1.29-bin.jar" /> <lib dir="../../../dist/" regex="solr-dataimporthandler-\d.*\.jar" /> <lib dir="../../../contrib/dataimporthandler/lib" regex=".*\.jar" />
should first line @ last mysql-connector jar should strictly called after calling dih.
<lib dir="../../../dist/" regex="solr-dataimporthandler-\d.*\.jar" /> <lib dir="../../../contrib/dataimporthandler/lib" regex=".*\.jar" /> <lib dir="../../../lib/" regex="mysql-connector-java-5.1.29-bin.jar" />
Comments
Post a Comment