概述
Install tomcat7
#sudo apt-get update
#sudo apt-get install tomcat7
#sudo apt-get install tomcat7-admin
http://localhost:8080/
#sudo vi /etc/tomcat7/tomcat-users.xml
<tomcat-users>
<user username="admin" password="password" roles="manager-gui,admin-gui"/>
</tomcat-users>
#sudo service tomcat7 restart
http://your_ip_address:8080/manager/html
Change tomcat max heap size
sudo vi /etc/default/tomcat7
# You may pass JVM startup parameters to Java here. If unset, the default # options will be: -Djava.awt.headless=true -Xmx128m -XX:+UseConcMarkSweepGC # # Use "-XX:+UseConcMarkSweepGC" to enable the CMS garbage collector (improved # response time). If you use that option and you run Tomcat on a machine with # exactly one CPU chip that contains one or two cores, you should also add # the "-XX:+CMSIncrementalMode" option. JAVA_OPTS="-Djava.awt.headless=true -Xms256m -Xmx1024m -XX:+UseConcMarkSweepGC"
Deploy Solr to tomcat
#cp solr.jar /var/lib/tomcat7/webapps/
#cp example/solr/* ~/SolrHome/
#sudo serivce tomcat7 restart
but there is a error
Jul 09, 2014 5:38:36 PM org.apache.catalina.core.StandardContext startInternal SEVERE: Error filterStart Jul 09, 2014 5:38:36 PM org.apache.catalina.core.StandardContext startInternal SEVERE: Context [/solr] startup failed due to previous e
To solve this error:
#sudo cp example/lib/ext/*.jar /usr/share/tomcat7/lib/
or cp these jars to solr/WEB-INF/lib/
#sudo cp example/resources/log4j.properties /usr/share/tomcat7/lib/
restart tomcat
Now I can access solr by http://localhost:8080/solr
but error:
HTTP Status 500 - {msg=SolrCore 'collection1' is not available due to init failure: Error opening new searcher,trace=org.apache.solr.common.SolrException: SolrCore 'collection1' is not available due to init failure: Error opening new searcher at org.apache.solr.core.CoreContainer.getCore( CoreContainer.java:827) at org.apache.solr.servlet.SolrDispatchFilter.doFilter (SolrDispatchFilter.java:317) at org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:217) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99) at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:936) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407) at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1004) at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589) at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:312) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:744) Caused by: org.apache.solr.common.SolrException: Error opening new searcher at org.apache.solr.core.SolrCore.<init>(SolrCore.java:844) at org.apache.solr.core.SolrCore.<init>(SolrCore.java:630) at org.apache.solr.core.CoreContainer.createFromLocal(CoreContainer.java:562) at org.apache.solr.core.CoreContainer.create(CoreContainer.java:597) at org.apache.solr.core.CoreContainer$1.call(CoreContainer.java:258) at org.apache.solr.core.CoreContainer$1.call(CoreContainer.java:250) at java.util.concurrent.FutureTask.run(FutureTask.java:262) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) at java.util.concurrent.FutureTask.run(FutureTask.java:262) ... 3 more Caused by: org.apache.solr.common.SolrException: Error opening new searcher at org.apache.solr.core.SolrCore.openNewSearcher(SolrCore.java:1521) at org.apache.solr.core.SolrCore.getSearcher(SolrCore.java:1633) at org.apache.solr.core.SolrCore.<init>(SolrCore.java:827) ... 11 more Caused by: org.apache.lucene.store.LockObtainFailedException: Lock obtain timed out: NativeFSLock@/home/zhaohj/SolrHome/collection1/data/index/write.lock: java.io.FileNotFoundException: /home/zhaohj/SolrHome/collection1/data/index/write.lock (Permission denied) at org.apache.lucene.store.Lock.obtain(Lock.java:89) at org.apache.lucene.index.IndexWriter.<init>(IndexWriter.java:702) at org.apache.solr.update.SolrIndexWriter.<init>(SolrIndexWriter.java:77) at org.apache.solr.update.SolrIndexWriter.create(SolrIndexWriter.java:64) at
------------------------------------------
All above errors are due to permission causes.
Solution:#sudo mkdir /home/tomcat7/SolrHome
#sudo cp example/solr/* /home/tomcat7/SolrHome/
#cd /home
#sudo chown -R tomcat7.tomcaty tomcat7
Edit solr's web.xml in /var/lib/tomcat7/webapps/solr/WEB-INF/web.xml
<env-entry> <env-entry-name>solr/home</env-entry-name> <env-entry-value>/home/tomcat7/SolrHome</env-entry-value> <env-entry-type>java.lang.String</env-entry-type> </env-entry>
#sudo service tomcat7 restart
every is ok.
----------------------------------------------------------------------------------------------------------------------------------
Chinese Tokenizer
1. cp jcseg related jars (core and solr) to /var/lib/tomcat7/webapps/solr/WEB-INF/lib/
2. cp jcseg lexicon dir to the same dir
3. modify schema.xml in each core conf dir
-----------------
Apache Tomcat 7: Error listenerStart msg
http://www.vegaasen.com/blog/?p=184
http://mail-archives.apache.org/mod_mbox/lucene-solr-user/201305.mbox/%3C51A7AD64.4000208@jhu.edu%3E
http://www.cnblogs.com/hupengcool/archive/2013/05/11/3072573.html
https://wiki.apache.org/solr/SolrLogging
References
https://www.digitalocean.com/community/tutorials/how-to-install-apache-tomcat-7-on-ubuntu-14-04-via-apt-get
https://cwiki.apache.org/confluence/display/solr/Running+Solr+on+Tomcat
最后
以上就是温婉小丸子为你收集整理的Solr:Deploy solr to tomcatApache Tomcat 7: Error listenerStart msg的全部内容,希望文章能够帮你解决Solr:Deploy solr to tomcatApache Tomcat 7: Error listenerStart msg所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
发表评论 取消回复