Make the Solr classes available to the container. In many cases, the Solr Web application archive (WAR) file can be placed into a special directory of the application container. In the case of Tomcat, you need to place the Solr WAR file in Tomcat's webapps directory. If you installed Tomcat with Solr, take a look in tomcat/webapps:you'll see the solr.war file is already there.
Point Solr to the Solr home directory that contains conf/solrconfig.xml and conf/schema.xml. There are a few ways to get this done. One of the best is to define the solr.solr.home Java system property. With Tomcat, the best way to do this is via a shell environment variable, JAVA_OPTS. Tomcat puts the value of this variable on the command line upon startup
从这里可以看出,指向的目录需要包含conf/solrconfig.xml和conf/schema.xml这两个文件,也就意味着在所指向的目录中需要有conf子目录,我就是因为官网的这段解释,搞了半天没有成功,其实是我理解错了,我认为在solr.solr.home目录下必须要有子目录conf,conf里面包含solrconfig.xml和schema.xml。但是其实conf目录是放在collection1目录下面的,collection是solr的一个Instance实例,solr中可以配置多个collection,可以有独立的配置文件。
我这边web.xml的配置为:
solr/homeD:/Installed Applications/solr-4.9.0/solr-4.9.0/examplejava.lang.String
特别需要注意配置里面使用的是反斜杠"/",而不是windows下默认的""。
这里我是直接指向example文件夹。
方法二(个人推荐):
在$TOMCAT_HOME/conf/Catalina/localhost目录下新建solr.xml文件,内容为:
湘ICP备2022002427号-10 湘公网安备:43070202000427号
© 2013~2024 haote.com 好特网