In the previous article, we first met Solr and learned about the startup mode of jetty, and looked at SOLR's management interface, which we implemented to deploy on Tomcat to run SOLR.
Deployment environment:
Window7
Jdk1.6.0_14
Solr-4.7.2
tomcat-6.0.37
SOLR's installation configuration, SOLR home, mainly describes the Jndi-based configuration, and other ways to refer to the SOLR wiki.
Based on Jndi configuration
1: First set up a SOLR run directory.
C:\solr-tomcat
Copy the SOLR directory under D:\work\work-tools\solr\solr-4.7.2\solr-4.7.2\example\ in the unpacked package to C:\solr-tomcat.
2: Establish Jndi file
Create a Solr.xml file under Tomcat's D:\work\work-tools\webserver\tomcat-6.0.37\conf\Catalina\localhost.
The contents are as follows:
View Sourceprint?
1.
<?xml version=
"1.0"
encoding=
"UTF-8"
standalone=
"yes"
?>
2.
<Context docBase=
"D:\work\work-tools\webserver\tomcat-6.0.37\webapps\solr.war"
debug=
"0"
crossContext=
"true"
>
3.
? <Environment name=
"solr/home"
type=
"java.lang.String"
value=
"C:\solr-tomcat\solr"
override=
"true"
/>
4.
</Context>
3: Modify URI encoding for Server.xml
Edit Server.xml under Tomcat's D:\work\work-tools\webserver\tomcat-6.0.37\conf
View Sourceprint?
1.
<Connector port=
"8080"
protocol=
"HTTP/1.1"
2.
connectionTimeout=
"20000"
3.
redirectPort=
"8443"
URIEncoding=
"UTF-8"
/>
4: Deploy the Solr.war Package
Change the Solr-4.7.2.war under D:\work\work-tools\solr\solr-4.7.2\solr-4.7.2\dist to Solr.war copy to D:\work\work-tools\webserver\ Under the Tomcat-6.0.37\webapp.
5: Configuration Log
This step is critical, and the following error occurs if you do not configure
Error Filterstart
Context [/SOLR] startup failed due to previous errors
There is no way to see what is wrong, basically only know when the start CONTEXT/SOLR, there was a configuration error before, but what configuration we do not know, this time can look at the Tomcat \tomcat-6.0.37\ Logs directory to view the Localhost.2014-08-23.log log, we will see detailed error messages.
View Sourceprint?
1.
严重: Exception starting filter SolrRequestFilter
2.
java.lang.NoClassDefFoundError: Failed to initialize Apache Solr: Could not find necessary SLF4j logging jars. If using Jetty, the SLF4j logging jars need to go in the jetty lib/ext directory. For other containers, the corresponding directory should be used. For more information, see: http:
//wiki.apache.org/solr/SolrLogging
It is clear that the jar of slf4j is not, we went to Solr-4.7.2\example\lib\ext under the Tomcat\lib directory of all the bags.
6: Start Tomcat
6: View SOLR's admin page HTTP://127.0.0.1:8080/SOLR
Summary: These configurations are described on the SOLR wiki and are categorized by Linux and Windows, in fact SOLR's real production environment is still deployed on Linux, because SOLR provides some shell scripts for testing and managing and maintaining more convenient This is very handy in the Linux operations Solr.
Note: wiki address Http://wiki.apache.org/solr/SolrTomcat
SOLR Learning notes deployed on Tomcat run SOLR