7

I've put the file apache-solr-3.5.0.war in folder C:\Program Files\Apache Software Foundation\Tomcat 6.0\webapps.

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 Files\Apache Software Foundation\Tomcat 6.0\webapps

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
Files\Apache Software Foundation\Tomcat
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 Files\Apache Software Foundation\Tomcat 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 Files\Apache Software Foundation\Tomcat 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:\Databases\solr-4.3.1\exam ple\solr
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:\Databases\solr-4.3.1\exam ple\solr
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
Files\Apache Software Foundation\Tomcat 6.0\bin;C:\Windows\Sun\Java\bin;C:\Windo
ws\system32;C:\Windows;C:\Program Files\Common Files\Microsoft Shared\Windows Li
ve;C:\Program Files (x86)\Common Files\Microsoft Shared\Windows Live;C:\Windows\
system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShe
ll\v1.0\;C:\Program Files\TortoiseSVN\bin;c:\msxsl;C:\Program Files (x86)\Window
s Live\Shared;C:\Program Files\Microsoft\Web Platform Installer\;C:\Program File
s (x86)\Microsoft ASP.NET\ASP.NET Web Pages\v1.0\;C:\Program Files (x86)\Windows
 Kits\8.0\Windows Performance Toolkit\;C:\Program Files\Microsoft SQL Server\110
\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\110\Tools\Binn\;C:\Prog
ram Files\Microsoft SQL Server\110\DTS\Binn\;C:\Program Files (x86)\Microsoft SQ
L Server\110\Tools\Binn\ManagementStudio\;C:\Program Files (x86)\Microsoft SQL S
erver\110\DTS\Binn\;C:\Program Files (x86)\Java\jre6\bin;C:\Program Files\Java\j
re631\bin;.
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.

Community
  • 1
  • 1
Adam
  • 6,041
  • 36
  • 120
  • 208
  • 1
    errors (in update 2) seem like problem with missing "jars"You can copy the jars from the C:/Databases/solr-4.3.1/example/lib/ext to the C:\Program Files\Apache Software Foundation\Tomcat 6.0\webapps\solr-4.3.1\lib\WEB-INF\lib directory... I do not remember doing that, but in this post they give instructions to do that in order to avoid your problem: http://liuweipingblog.cn/java/install-lucene-solar-with-tomcat-on-windows/ – emgsilva Jul 13 '13 at 12:33
  • possible duplicate of [Apache solr configuration with tomcat 6.0](http://stackoverflow.com/questions/10026014/apache-solr-configuration-with-tomcat-6-0) – kenorb Mar 29 '15 at 14:14

7 Answers7

7

It got solved for me by on a different forum, here are the steps I followed:

  1. Extract solr431 package. In my case I did in "E:\solr-4.3.1\example\solr"
  2. Now copied solr dir from extracted package (E:\solr-4.3.1\example\solr) into TOMCAT_HOME dir. In my case TOMCAT_HOME dir is pointed to E:\Apache\Tomcat 6.0.
  3. I can refer now SOLR_HOME as " E:\Apache\Tomcat 6.0\solr" (please remember this)
  4. Copy the solr.war file from extracted package to SOLR HOME dir i.e E:\Apache\Tomcat 6.0\solr. This is required to create the context. As I donot want to pass this as JAVA OPTS
  5. Also copy solr.war file into TOMCAT_HOME\webapps for deployment purpose
  6. If you start tomcat you will get errors as mentioned by Shawn. S0 you need to copy all the 5 jar files from solr extracted package ( E:\solr-4.3.1\example\lib\ext ) to TOMCAT_HOME\lib dir:

    1. jul-to-slf4j-1.6.6,
    2. jcl-over-slf4j-1.6.6,
    3. slf4j-log4j12-1.6.6,
    4. slf4j-api-1.6.6,
    5. log4j-1.2.16
  7. Also copy the log4js.properties file from E:\solr-4.3.1\example\resources dir to TOMCAT_HOME\lib dir.

  8. Now if you start the tomcat you wont having any problem.
SaidbakR
  • 13,303
  • 20
  • 101
  • 195
Adam
  • 6,041
  • 36
  • 120
  • 208
  • I am sorry, but I fail do not understand how these instructions differ from the ones I gave you (to your initial problem, and later as updates as you presented subsequent problems) and the link I gave with step-by-step instal details of Solr in Tomcat in windows. – emgsilva Jul 20 '13 at 08:57
  • I don't know what is different either, but I do know that when I followed the steps in your links it didn't work and with the steps that were provided elsewhere it does. I upvoted your helpful comments, but for me the steps in my answer were the solution :) – Adam Jul 20 '13 at 09:26
  • OK, it is fair... But they look almost the same (log4s.properties details seem to be the only difference as far as I can see, and that may be the problem). Nice you it is working now :) cheers! – emgsilva Jul 20 '13 at 09:30
  • Spent a day looking at the top voted answer and could not make it work, then realised top voted is not the accepted answer, redid everything, 10 minutes spent, I can see the solr up and running. – Kumar Dec 13 '16 at 04:06
7

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.0\example\solr") folder. Copy all those files into the C:\solr_home folder.(server shutting down exception will come)

5.Look into C:\solr-home\solr 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.0\example\lib\ext SLF4J and log4j.jar file to Tomcat Lib folder C:\Program Files\Apache Software Foundation\Tomcat 6.0\lib (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.0\dist" directory to webapps directory inside Tomcat.(C:\Program Files\Apache Software Foundation\Tomcat 6.0\webapps)

8.If tomact is already start then solr folder will create go to "C:\Program Files\Apache Software Foundation\Tomcat 6.0\webapps\solr\WEB-INF\web.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_home\solr</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

Rinkesh
  • 3,150
  • 28
  • 32
  • these instructions with step 6 modified as in the accepted answer worked: If you start tomcat you will get errors as mentioned by Shawn. S0 you need to copy all the 5 jar files from solr extracted package ( E:\solr-4.3.1\example\lib\ext ) to TOMCAT_HOME\lib dir: – chfw Jul 07 '15 at 11:24
1

According to my notes (I did that procedure some time ago), I had to add an extra line in the Tomcat "caralina.sh" (or catalina.bat if you use windows):

export JAVA_OPTS="$JAVA_OPTS -Dsolr.solr.home=/opt/solr/example/solr"

This is used to specify where the solr "configuration" and "data" directories (where your data will be stored). In my case it is "/opt/solr/example/solr", but you need to use the directory where you have the "configuration" files and "data" directory in your system. For example you should use "C:\solr-4.3.1\examples\solr\" if you extracted the downloaded Solr package in C: in windows. This means, that you will deploy the "Solr.war" in Tomcat (you already did that), but the configuration of Solr and "data" stored will be in that directory you specify in catalina.bat (JAVA_OPS, e.g.: C:\solr-4.3.1\examples\solr).


Good instructions to install Solr in a Tomcat in windows: http://liuweipingblog.cn/java/install-lucene-solar-with-tomcat-on-windows/

emgsilva
  • 3,047
  • 1
  • 17
  • 16
  • I'm coming from Cygwin, so this is my first Tomcat deployment, I first want to setup a basic Solr instance on Tomcat and then migrate my existing Solr configuration to that instance. Right now, with a default deployment of Solr4-3-1 I don't see any catalina.bat file in the webapps\solr-4.3.1 folder. Where can I find/place the catalina.bat file? – Adam Jul 12 '13 at 17:24
  • "/bin/" that is what you use to launch Tomcat... I think you can also add this to your JAVA_PATH, probably will also work. – emgsilva Jul 12 '13 at 17:30
  • Yes, my Tomcat is launched from there. What should I add to my JAVA_PATH? edit: when I come to think of it: if possible I'd rather not configure this in my path variables as it introduces another thing I need to be wary of when migrating servers in the future :) – Adam Jul 12 '13 at 17:55
  • OK, so I propose you add this to your "catalina.bat"... not sure if it is exactly like that in windows, but should be similar. – emgsilva Jul 12 '13 at 18:25
  • But then again: where can I find the Catalina.bat? :) – Adam Jul 12 '13 at 18:51
  • As I told you above, in the Tomcat directory, you have a sub-directory called "bin", it is in there you will find the "catalina.bat". Then you simply add this line there, right after all the "comments", and restart tomcat... hopefully this solves the problem :) – emgsilva Jul 12 '13 at 18:57
  • I saw that comment, but there's no catalina.bat in that folder (C:\Program Files\Apache Software Foundation\Tomcat 6.0\bin) – Adam Jul 12 '13 at 19:02
  • That is weird... look around for the "catalina.bat", it should be there. I am using a Tomcat 6 and there is a catalina.bat there... If you cannot find it, I would add the code to the starting script you are using to launch Tomcat (e.g.: "startup.bat"). From your log error I really suspect this is the problem. Remember, you need to put the "path" to the solr directory I mention (that comes with the Solr distribution). – emgsilva Jul 12 '13 at 19:08
  • Now I'm thinking something else went wrong...as I don't have an /opt folder. I updated my answer with the folders in my solr-4.3.1 folder. What can this be? – Adam Jul 12 '13 at 23:32
  • I have updated my answer, take a look. Basically you download the Solr zip file, you extracted and then placed the "war" in Tomcat... The configuration I refer (and you need to adapt) needs to "point" to the place you have extracted the Solr zip, e.g.: C:\solr-4.3.1\example\solr". Place that in your catalina.bat and it should work :) – emgsilva Jul 13 '13 at 09:39
  • Ah, in my case that would be: C:\Databases\solr-4.3.1\example\solr, but still I see no catalina.bat anywhere. Do you perhaps have an example of this file I can use? And where should I place it? – Adam Jul 13 '13 at 10:40
  • 1
    Apparently you have installed "tomcat as a service" (the windows installer)... I never used that. You can try (for the time being) set the JAVA_OPS in your "environment variable" in your windows... Alternatively I found this other question: http://stackoverflow.com/questions/9193131/setting-java-opts-to-tomcat-service-from-command-line. Based on that you could try to run your tomcat with: tomcat6.exe //US//tomcat6 "--JvmOptions=-Dsolr.solr.home=C:\Databases\solr-4.3.1\example\solr"... This is just a guess :p you need to explore to see how you can make such a configuration... – emgsilva Jul 13 '13 at 11:09
  • Ok, I did that and now I'm getting new errors (see update 2)...something with the Lucene version being wrong (which I think is weird since I used all latest apps, both Tomcat and Solr) – Adam Jul 13 '13 at 12:00
  • @Floran replied on your question, and furthermore added a new link to my answer, which seems to give a very nice step by step instructions to make it work on windows (look on step 5 to solve the last issue). – emgsilva Jul 13 '13 at 14:20
  • Turned out that the lucene version errors were due to a previous 3.5.0 instance that was deployed in this same instance, after removing it, the errors are gone. I also went through the steps in your link. However, now I'm getting the error HTTP Status 503 - Server is shutting down. Any idea what that may be? – Adam Jul 14 '13 at 12:52
  • @Floran I do not know about that specific error. My suggestion would be to install everything from scratch (follow the instructions in the list of my answer), so that you avoid all these conflicts from previous versions installed and any other issues. – emgsilva Jul 14 '13 at 14:47
  • @Floran did this help? if so you should close this question. I think your problem is not a different issue. – emgsilva Jul 19 '13 at 08:39
1

The way that logging works with Solr was updated with Solr 4.3.0 (and higher). If you check your Tomcat logs you will most likely see a "Filter Exception" error. Please refer to the Solr Logging - Using the example logging setup in containers other than Jetty for the steps required to get Solr 4.3.0 and higher to run on Tomcat.

Paige Cook
  • 22,415
  • 3
  • 57
  • 68
1

This error is occurred due to the separate logging mechanism of solr. After researching I have found that, you need to add slf4j log jar in your tomcat lib. ( as per my local machine it is : C:\xampp\tomcat\lib )

download from below url and copy the jar file in tomcat lib

http://www.slf4j.org/download.html

After doing the above step it is working fine in my local system.

0

The errors about the lucene version indicate that you are still deploying the 3.5 version. I mean, I'm sure you put the 4.x war but for somewhat reason (forgot to delete the war, tmp files) the 3.5 is still there. When you indicates the solr.home using a system property it will be read by "all" solr you are deploying. So in your case, the 4.3.1 is happy about the given solr home (which contains LUCENE43) but the 3.5 throws the exception (4.3 is unknown to 3.5)

Andrea
  • 2,714
  • 3
  • 27
  • 38
0

It includes few steps

  1. Download solr-XXX.zip and extract into solr-XXX.

  2. Copy solr-XXX.war (from solr-XXX/dist folder after unzipping the .zip) into Tomcat/webapps. Then unzip the .war file (using WinZip etc.). This will create folder solr-XXX. Copy log4j-XXX.jar,slf4j-api-XXX.jar,slf4j-log4j12-XXX.jar,commons-logging-XXX.jar into Tomcat/webapps/solr-XXX/WEB-INF/lib. And create a folder Tomcat/webapps/solr-XXX/WEB-INF/classes and copy log4j.properties here from solr-XXX\example\resources

  3. Create a directory MySolrHome anywhere and copy content of solr-XXX\example\solr folder here

  4. Add JAVA_OPTS=-Dsolr.solr.home=Path/to/MySolrHome/

Start Tomcat

Abhishek Chatterjee
  • 1,962
  • 2
  • 23
  • 31