Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
663 views
in Technique[技术] by (71.8m points)

windows - How to Install Solr in Tomcat?

I've put the file apache-solr-3.5.0.war in folder C:Program FilesApache Software FoundationTomcat 6.0webapps.

A folder "apache-solr-3.5.0" is created automatically. And when I go to: http://localhost:8080/apache-solr-3.5.0/ .

I can see the message "Welcome to Solr!".

Now, when I do the exact same with the file solr-4.3.1.war in the folder C:Program FilesApache Software FoundationTomcat 6.0webapps

A folder solr-4.3.1 is created automatically. But now when I go to:

http://localhost:8080/solr-4.3.1/ OR to http://localhost:8080/solr-4.3.1/admin.html

I see the error:

HTTP Status 404 - type Status report

Message: description The requested resource is not available.

Apache Tomcat/6.0.37

What am I missing?

Update:

This is shown in the Tomcat console window:

INFO: Solr
home set to 'solr/' 12-jul-2013 18:27:36
org.apache.solr.core.SolrResourceLoader <init> INFO: Solr home set to
'solr.' 12-jul-2013 18:27:36 org.apache.solr.common.SolrException
log SEVERE: java.lang.RuntimeException: Can't find resource
'solrconfig.xml' in class sath or 'solr.conf/', cwd=C:Program
FilesApache Software FoundationTomcat
6.0
        at org.apache.solr.core.SolrResourceLoader.openResource(SolrResourceLoad
er.java:268)


12-jul-2013 18:27:36 org.apache.solr.servlet.SolrDispatchFilter init
INFO: user.dir=C:Program FilesApache Software FoundationTomcat 6.0
12-jul-2013 18:27:36 org.apache.solr.servlet.SolrDispatchFilter init
INFO: SolrDispatchFilter.init() done 12-jul-2013 18:27:36
org.apache.solr.servlet.SolrServlet init INFO: SolrServlet.init()
12-jul-2013 18:27:36 org.apache.solr.core.SolrResourceLoader
locateSolrHome INFO: No /solr/home in JNDI 12-jul-2013 18:27:36
org.apache.solr.core.SolrResourceLoader locateSolrHome INFO: solr home
defaulted to 'solr/' (could not find system property or JNDI)
12-jul-2013 18:27:36 org.apache.solr.servlet.SolrServlet init INFO:
SolrServlet.init() done 12-jul-2013 18:27:36
org.apache.solr.core.SolrResourceLoader locateSolrHome INFO: No
/solr/home in JNDI 12-jul-2013 18:27:36
org.apache.solr.core.SolrResourceLoader locateSolrHome INFO: solr home
defaulted to 'solr/' (could not find system property or JNDI)
12-jul-2013 18:27:36 org.apache.solr.servlet.SolrUpdateServlet init
INFO: SolrUpdateServlet.init() done 12-jul-2013 18:27:36
org.apache.catalina.startup.HostConfig deployWAR INFO: Deploying web
application archive solr-4.3.1.war 12-jul-2013 18:27:36
org.apache.catalina.core.StandardContext start SEVERE: Error
filterStart 12-jul-2013 18:27:36
org.apache.catalina.core.StandardContext start SEVERE: Context
[/solr-4.3.1] startup failed due to previous errors 12-jul-2013
18:27:36 org.apache.catalina.startup.HostConfig deployDirectory INFO:
Deploying web application directory ROOT 12-jul-2013 18:27:36
org.apache.coyote.http11.Http11Protocol start INFO: Starting Coyote
HTTP/1.1 on http-8080 12-jul-2013 18:27:36
org.apache.jk.common.ChannelSocket init INFO: JK: ajp13 listening on
/0.0.0.0:8009 12-jul-2013 18:27:36 org.apache.jk.server.JkMain start
INFO: Jk running ID=0 time=0/56  config=null 12-jul-2013 18:27:36
org.apache.catalina.startup.Catalina start INFO: Server startup in 880
ms

My unpacked Solr folder contains these folders:

css  
img  
js  
META-INF  
tpl  
WEB-INF  

Update

After adding this to my environment variables:

JAVA_OPTS = $JAVA_OPTS -Dsolr.solr.home=C:/Databases/solr-4.3.1/example/solr

I get these 2 errors after startup:

SEVERE: org.apache.solr.common.SolrException: Invalid luceneMatchVersion 'LUCENE_43', valid values are: [LUCENE_20, LUCENE_21, LUCENE_22, LUCENE_23, LUCENE_24,LUCENE_29, LUCENE_30, LUCENE_31, LUCENE_32, LUCENE_33, LUCENE_34,LUCENE_35, LUCENE_CURRENT] or a string in format 'V.V'


SEVERE: Exception starting filter SolrRequestFilter org.apache.solr.common.SolrException: 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.

Full log:

SEVERE: org.apache.solr.common.SolrException: Invalid luceneMatchVersion 'LUCENE _43', valid values are: [LUCENE_20, LUCENE_21, LUCENE_22, LUCENE_23, LUCENE_24, LUCENE_29, LUCENE_30, LUCENE_31, LUCENE_32, LUCENE_33, LUCENE_34, LUCENE_35, LUC ENE_CURRENT] or a string in format 'V.V'
    at org.apache.solr.core.Config.parseLuceneVersionString(Config.java:353)

13-jul-2013 13:46:02 org.apache.solr.servlet.SolrDispatchFilter init INFO: user.dir=C:Program FilesApache Software FoundationTomcat 6.0
13-jul-2013 13:46:02 org.apache.solr.servlet.SolrDispatchFilter init INFO: SolrDispatchFilter.init() done 13-jul-2013 13:46:02 org.apache.solr.servlet.SolrServlet init INFO: SolrServlet.init()
13-jul-2013 13:46:02 org.apache.solr.core.SolrResourceLoader locateSolrHome INFO: No /solr/home in JNDI 13-jul-2013 13:46:02 org.apache.solr.core.SolrResourceLoader locateSolrHome INFO: using system property solr.solr.home: C:Databasessolr-4.3.1exam plesolr
13-jul-2013 13:46:02 org.apache.solr.servlet.SolrServlet init INFO: SolrServlet.init() done 13-jul-2013 13:46:02 org.apache.solr.core.SolrResourceLoader locateSolrHome INFO: No /solr/home in JNDI 13-jul-2013 13:46:02 org.apache.solr.core.SolrResourceLoader locateSolrHome INFO: using system property solr.solr.home: C:Databasessolr-4.3.1exam plesolr
13-jul-2013 13:46:02 org.apache.solr.servlet.SolrUpdateServlet init INFO: SolrUpdateServlet.init() done
13-jul-2013 13:46:02 org.apache.catalina.startup.HostConfig deployWAR INFO: Deploying web application archive solr-4.3.1.war 13-jul-2013 13:46:03 org.apache.catalina.core.StandardContext filterStart SEVERE: Exception starting filter SolrRequestFilter org.apache.solr.common.SolrException: Could not find necessary SLF4j logging jar s. If using Jetty, the SLF4j logging jars need to go in the jetty lib/ext direct ory. For other containers, the corresponding
directory should be used. For more information, see:
http://wiki.apache.org/solr/SolrLogging

UPDATE 3

I'm now getting a "HTTP Status 503 - Server is shutting down" error.

14-jul-2013 14:21:57 org.apache.catalina.core.AprLifecycleListener init
INFO: The APR based Apache Tomcat Native library which allows optimal performanc
e in production environments was not found on the java.library.path: C:Program
FilesApache Software FoundationTomcat 6.0in;C:WindowsSunJavain;C:Windo
wssystem32;C:Windows;C:Program FilesCommon FilesMicrosoft SharedWindows Li
ve;C:Program Files (x86)Common FilesMicrosoft SharedWindows Live;C:Windows
system32;C:Windows;C:WindowsSystem32Wbem;C:WindowsSystem32WindowsPowerShe
llv1.0;C:Program FilesTortoiseSVNin;c:msxsl;C:Program Files (x86)Window
s LiveShared;C:Program FilesMicrosoftWeb Platform Installer;C:Program File
s (x86)Microsoft ASP.NETASP.NET Web Pagesv1.0;C:Program Files (x86)Windows
 Kits8.0Windows Performance Toolkit;C:Program FilesMicrosoft SQL Server110
ToolsBinn;C:Program Files (x86)Microsoft SQL Server110ToolsBinn;C:Prog
ram FilesMicrosoft SQL Server110DTSBinn;C:Program Files (x86)Microsoft SQ
L Server110ToolsBinnManagementStudio;C:Program Files (x86)Microsoft SQL S
erver110DTSBinn;C:Program Files (x86)Javajre6in;C:Program FilesJavaj
re631in;.
14-jul-2013 14:21:57 org.apache.coyote.http11.Http11Protocol init
INFO: Initializing Coyote HTTP/1.1 on http-8080
14-jul-2013 14:21:57 org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 283 ms
14-jul-2013 14:21:57 org.apache.catalina.core.StandardService start
INFO: Starting service Catalina
14-jul-2013 14:21:57 org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/6.0.37
14-jul-2013 14:21:57 org.apache.catalina.startup.HostConfig deployDescriptor
INFO: Deploying configuration descriptor manager.xml
14-jul-2013 14:21:57 org.apache.catalina.startup.HostConfig deployWAR
INFO: Deploying web application archive solr-4.3.1.war
log4j:WARN No appenders could be found for logger (org.apache.solr.servlet.SolrD
ispatchFilter).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more in
fo.
14-jul-2013 14:21:58 org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory ROOT
14-jul-2013 14:21:58 org.apache.coyote.http11.Http11Protocol start
INFO: Starting Coyote HTTP/1.1 on http-8080
14-jul-2013 14:21:58 org.apache.jk.common.ChannelSocket init
INFO: JK: ajp13 listening on /0.0.0.0:8009
14-jul-2013 14:21:58 org.apache.jk.server.JkMain start
INFO: Jk running ID=0 time=0/55  config=null
14-jul-2013 14:21:58 org.apache.catalina.startup.Catalina start
INFO: Server startup in 719 ms

I read something on this error here, but after adding my logging.properties.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Install Solr in Tomcat

Pre Requirements

1 – Machine with Windows OS (Windows 7,8,Xp.. ..etc)

2 – Java 6 or Above

3 - Solr 4.0.0 or Above

4 – Apache-tomcat 6 or Above.

Steps to get Solr up on Tomcat Server

1.Install Tomcat on your machine and make sure it is ready to start.(Check using localhost:8080)

2.Install Solr4.0 distribution package apache-solr-4.0.0.zip and unzip it in your local directory like C:apache-solr-4.0.0.

3.Make a folder with name solr-home in your local machine like C:solr_home.

4.Go back to the solr distribution package that you downloaded C:apache-solr-4.0.0. Have a peek inside the Examples/solr ("C:solr-4.4.0examplesolr") folder. Copy all those files into the C:solr_home folder.(server shutting down exception will come)

5.Look into C:solr-homesolr and you will see two folders with name collection1 and bin, copy these two folders a step up to C:solr_home.(if lib not copy "severe error filterstart" Exception come)

6.Copy lib from C:apache-solr-4.0.0examplelibext SLF4J and log4j.jar file to Tomcat Lib folder C:Program FilesApache Software FoundationTomcat 6.0lib (https://wiki.apache.org/solr/SolrLogging#Using_the_example_logging_setup_in_containers_other_than_Jetty)

7.Copy apache-solr-4.0.war (rename to solr.war) from "C:solr-4.4.0dist" directory to webapps directory inside Tomcat.(C:Program FilesApache Software FoundationTomcat 6.0webapps)

8.If tomact is already start then solr folder will create go to "C:Program FilesApache Software FoundationTomcat 6.0webappssolrWEB-INFweb.xml" edit web.xml uncomment entry and edit like following(Exception SolrCore 'collection1' is not available due to init failure)

<env-entry>
   <env-entry-name>solr/home</env-entry-name>
   <env-entry-value>C:solr_homesolr</env-entry-value>
   <env-entry-type>java.lang.String</env-entry-type>
</env-entry>

9.Start Tomcat and check localhost:8080/solr dashBoard will come


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...