1. 程式人生 > >Tomcat8.0啟動閃退報錯-元素型別 "Context" 必須由匹配的結束標記 "" 終止

Tomcat8.0啟動閃退報錯-元素型別 "Context" 必須由匹配的結束標記 "" 終止

首先看日誌

23-Apr-2018 09:49:53.912 WARNING [1] org.apache.catalina.startup.Catalina.load Catalina.start using conf/server.xml: 元素型別 "Context" 必須由匹配的結束標記 "</Context>" 終止。
23-Apr-2018 09:49:54.069 SEVERE [1] org.apache.tomcat.util.digester.Digester.fatalError Parse Fatal Error at line 143 column 9: 元素型別 "Context"
必須由匹配的結束標記 "</Context>" 終止。 org.xml.sax.SAXParseException; systemId: file:/C:/Tomcat%208.0/conf/server.xml; lineNumber: 143; columnNumber: 9; 元素型別 "Context" 必須由匹配的結束標記 "</Context>" 終止。 at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java
:203) at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalError(ErrorHandlerWrapper.java:177) at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:400) at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java
:327) at com.sun.org.apache.xerces.internal.impl.XMLScanner.reportFatalError(XMLScanner.java:1472) at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanEndElement(XMLDocumentFragmentScannerImpl.java:1749) at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2967) at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:602) at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:505) at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:841) at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:770) at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141) at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1213) at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:643) at org.apache.tomcat.util.digester.Digester.parse(Digester.java:1457) at org.apache.catalina.startup.Catalina.load(Catalina.java:551) at org.apache.catalina.startup.Catalina.start(Catalina.java:613) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:351) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:485) 23-Apr-2018 09:49:54.069 WARNING [1] org.apache.catalina.startup.Catalina.load Catalina.start using conf/server.xml: 元素型別 "Context" 必須由匹配的結束標記 "</Context>" 終止。 23-Apr-2018 09:49:54.084 SEVERE [1] org.apache.catalina.startup.Catalina.start Cannot start server. Server instance is not configured.

提取主要報錯

23-Apr-2018 09:49:53.912 WARNING [1] org.apache.catalina.startup.Catalina.load Catalina.start using conf/server.xml: 元素型別 "Context" 必須由匹配的結束標記 "</Context>" 終止。
23-Apr-2018 09:49:54.069 SEVERE [1] org.apache.tomcat.util.digester.Digester.fatalError Parse Fatal Error at line 143 column 9: 元素型別 "Context" 必須由匹配的結束標記 "</Context>" 終止。
 org.xml.sax.SAXParseException; systemId: file:/C:/Tomcat%208.0/conf/server.xml; lineNumber: 143; columnNumber: 9; 元素型別 "Context" 必須由匹配的結束標記 "</Context>" 終止。

檢查相關位置發現少了識別符號

修改前

<Context path="/PigstyWeb" docBase="C:\Users\Administrator\Desktop/PigstyWeb.war" reloadable="true">

修改後

<Context path="/PigstyWeb" docBase="C:\Users\Administrator\Desktop/PigstyWeb.war" reloadable="true"/>

其實就是在末尾處加上 />

/>

重新啟動伺服器就可以使用了,如果再報錯就看報錯原因。