我在 Windows Server 2008 R2 上运行 Solr 4.1。Solr 部署在 Tomcat 上。但是今天它突然停止,并且在访问 Solr 时出现以下错误。
HTTP Status 503 - Server is shutting down
type Status report
message Server is shutting down
description The requested service is not currently available.
进一步查看日志后,我们得到以下内容:
日志文件:tomcat7-stderr.2013-05-09.txt
May 09, 2013 8:00:40 PM org.apache.solr.core.CoreContainer finalize
SEVERE: CoreContainer was not shutdown prior to finalize(), indicates a bug -- POSSIBLE RESOURCE LEAK!!! instance=2221663
日志文件:catalina.2013-05-09.txt
May 09, 2013 7:59:25 PM org.apache.solr.core.SolrResourceLoader <init>
INFO: new SolrResourceLoader for directory: 'c:\solrdir\'
May 09, 2013 7:59:29 PM org.apache.solr.common.SolrException log
SEVERE: Exception during parsing file: null:org.xml.sax.SAXParseException; systemId: file:/c:/solr/solr.xml; lineNumber: 2; columnNumber: 6; The processing instruction target matching "[xX][mM][lL]" is not allowed.
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source)
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalError(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLScanner.reportFatalError(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLScanner.scanPIData(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanPIData(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLScanner.scanPI(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(Unknown Source)
at org.apache.solr.core.Config.<init>(Config.java:121)
at org.apache.solr.core.CoreContainer.load(CoreContainer.java:428)
at org.apache.solr.core.CoreContainer.load(CoreContainer.java:404)
at org.apache.solr.core.CoreContainer$Initializer.initialize(CoreContainer.java:336)
at org.apache.solr.servlet.SolrDispatchFilter.init(SolrDispatchFilter.java:98)
at org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:281)
at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:262)
at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:107)
at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4656)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5309)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:633)
at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:977)
at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1655)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
May 09, 2013 7:59:29 PM org.apache.solr.servlet.SolrDispatchFilter init
SEVERE: Could not start Solr. Check solr/home property and the logs
May 09, 2013 7:59:29 PM org.apache.solr.common.SolrException log
SEVERE: null:org.apache.solr.common.SolrException:
at org.apache.solr.core.CoreContainer.load(CoreContainer.java:431)
at org.apache.solr.core.CoreContainer.load(CoreContainer.java:404)
at org.apache.solr.core.CoreContainer$Initializer.initialize(CoreContainer.java:336)
at org.apache.solr.servlet.SolrDispatchFilter.init(SolrDispatchFilter.java:98)
at org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:281)
at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:262)
at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:107)
at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4656)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5309)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:633)
at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:977)
at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1655)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: org.xml.sax.SAXParseException; systemId: file:/c:/solrdir/solr.xml; lineNumber: 2; columnNumber: 6; The processing instruction target matching "[xX][mM][lL]" is not allowed.
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source)
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalError(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLScanner.reportFatalError(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLScanner.scanPIData(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanPIData(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLScanner.scanPI(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(Unknown Source)
at org.apache.solr.core.Config.<init>(Config.java:121)
at org.apache.solr.core.CoreContainer.load(CoreContainer.java:428)
... 20 more
May 09, 2013 7:59:29 PM org.apache.solr.servlet.SolrDispatchFilter init
INFO: SolrDispatchFilter.init() done
May 09, 2013 7:59:29 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory C:\Program Files (x86)\Apache Software Foundation\Tomcat 7.0\webapps\docs
May 09, 2013 7:59:30 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory C:\Program Files (x86)\Apache Software Foundation\Tomcat 7.0\webapps\manager
May 09, 2013 7:59:30 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory C:\Program Files (x86)\Apache Software Foundation\Tomcat 7.0\webapps\ROOT
May 09, 2013 7:59:30 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-bio-8983"]
May 09, 2013 7:59:30 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["ajp-bio-8009"]
May 09, 2013 7:59:30 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 9578 ms
May 09, 2013 8:00:40 PM org.apache.solr.core.CoreContainer finalize
SEVERE: CoreContainer was not shutdown prior to finalize(), indicates a bug -- POSSIBLE RESOURCE LEAK!!! instance=2221663
知道可能出现什么问题以及如何解决吗?
答案1
我通过删除 solr.xml 文件顶部的空白行解决了这个问题。但现在出现了一个不同的错误,尽管 Solr 现在似乎正在运行。
这帮助我弄清楚了这个问题:
答案2
我在复制核心时遇到了同样的问题。
O 复制了文件夹,在我的情况下是将用户复制到 qa。
当我改变名称=用户到名称=qa里面核心属性文件,一切恢复正常。
每一点都很重要,而且遗憾的是,由于 Solr 是用 Java 编写的,所以错误消息通常毫无价值。
为了保证 XML 的安全,请使用类似http://www.xmlvalidation.com/以确保这不是一个简单的语法错误,毁了你的一天。
答案3
尝试关闭 solr.xml 中的核心标签;例如:
<core name="eg1" instanceDir="eg1Dir"/>
答案4
只是为了记录这个替代解决方案,以防其他人遇到这个问题(但是,没有在 Solr 的应用程序服务器日志中看到“SAXParseException”):
您将看到,如果它无法初始化任何核心,它将返回 HTTP 503
if (this.cores == null) {
((HttpServletResponse)response).sendError( 503, "Server is shutting down" );
return;
}
在我看来,这有点误导,但这基本上意味着你的 SolrCloud 中没有任何核心/分片(即,有人可能在干扰你的 Zookeeper 服务器),这是我遇到的根本原因,再次强调,只是为了分享,以防有人遇到同样的问题。