tomcat可以正常启动,能够访问localhost:8080,不能访问localhost:8080/solr

来源:互联网 发布:讯猫软件 编辑:程序博客网 时间:2024/05/16 03:40

I have big problems installing Solr 4.3 under Ubuntu 12.04. Firstly i installed tomcat. I can access tomcat via browser on localhost:8080. Into "Tomcat Web Application Manager" i try to install Solr 4.3 via 2solr.war" file. The file is been uploaded an deployed. But i cant get it started. "FAIL - Application at context path /solr could not be started".

The log file (localhost.log) look like:

07.05.2013 11:05:36 org.apache.catalina.core.ApplicationContext logINFO: HTMLManager: start: Starting web application at '/solr'07.05.2013 11:05:36 org.apache.catalina.core.StandardContext filterStartSCHWERWIEGEND: Exception starting filter SolrRequestFilterorg.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. For more information, see: http://wiki.apache.org/solr/SolrLogging    at org.apache.solr.servlet.SolrDispatchFilter.<init>(SolrDispatchFilter.java:105)    ... 33 more07.05.2013 11:05:36 org.apache.catalina.core.ApplicationContext logINFO: HTMLManager: list: Listing contexts for virtual host 'localhost'07.05.2013 11:05:36 org.apache.catalina.core.StandardContext filterStartSCHWERWIEGEND: Exception starting filter SolrRequestFilterorg.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. For more information, see: http://wiki.apache.org/solr/SolrLogging    at org.apache.solr.servlet.SolrDispatchFilter.<init>(SolrDispatchFilter.java:105)    ... 21 more

catalina.....log

07.05.2013 11:05:36 org.apache.catalina.core.StandardContext startSCHWERWIEGEND: Error filterStart07.05.2013 11:05:36 org.apache.catalina.core.StandardContext startSCHWERWIEGEND: Context [/solr] startup failed due to previous errors07.05.2013 11:05:36 org.apache.catalina.startup.HostConfig checkResourcesINFO: Reloading context [/solr]07.05.2013 11:05:36 org.apache.catalina.core.StandardContext stopINFO: Container org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/solr] has not been started07.05.2013 11:05:36 org.apache.catalina.core.StandardContext startSCHWERWIEGEND: Error filterStart07.05.2013 11:05:36 org.apache.catalina.core.StandardContext startSCHWERWIEGEND: Context [/solr] startup failed due to previous errors

解决办法:As the logs say - Could not find necessary SLF4j logging jars.

You are missing the slf4j jars.

Place the slf4j jars in the $CATALINA_BASE/lib folder.

Copy the SLF4j logging jars from <solr>/example/lib/ext/*.jar into Tomcat Lib (e.g. TOMCAT_HOME/lib/usr/share/tomcat/lib) or Webapp Lib directory (e.g. TOMCAT_HOME/webapps/solr/WEB-INF/lib). These jars will set up SLF4J and log4j.

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

In other words to make your Solr working properly with Tomcat, you need to:

  1. Copy the SLF4j logging jars from <solr>/example/lib/ext/*.jar into Tomcat Lib (e.g. TOMCAT_HOME/lib/usr/share/tomcat/lib) or Webapp Lib directory (e.g. TOMCAT_HOME/webapps/solr/WEB-INF/lib). These jars will set up SLF4J and log4j.

    For a Debian or Ubuntu server using the Tomcat package available from the OS vendor, this is likely to be /usr/share/tomcat6/lib or /usr/share/tomcat7/lib.

    For example:

    # cp -v /opt/solr-4.10.4/example/lib/ext/*.jar /usr/share/tomcat?/lib/

    or:

    # cp -v /opt/solr-4.10.4/example/lib/ext/*.jar /var/lib/tomcat7/webapps/solr/WEB-INF/lib/

    Alternatively set-up your CLASSPATH to point to your jar files.

  2. Copy the logging config from solr/example/resources/log4j.properties into a location on the classpath. Usually you can use the same location as the jar files above and edit the configuration file for your preferred log destination.

    Optionally, if you did not place log4j.properties on the classpath, set java option: -Dlog4j.configuration=file:///path/to/log4j.properties

  3. Restart Tomcat (e.g. sudo /etc/init.d/tomcat7 restart).

If you still have the problems, it might help to start the server with -Dlog4j.debug=true to see more details.

See: Using the example logging setup in containers other than Jetty

最终解决办法:

1.sudo cp -v /usr/local/solr-4.10.3/example/lib/ext/*.jar /usr/local/apache-tomcat-8.0.33/lib

2.sudo cp -v /usr/local/solr-4.10.3/example/resources/log4j.properties /usr/local/apache-tomcat-8.0.33/lib

3.sudo ./shutdown.sh

4.sudo ./startup.sh

0 0