我正在创建简单的Web应用程序。而且我在配置服务器时遇到了问题。尝试启动服务器时,收到错误消息:元素类型“主机”必须由匹配的结束标记“”终止
但是我的主机标签看起来像下面的方式(是的,它已经关闭了):
<?xml version="1.0" encoding="UTF-8"?>
<Server port="${base.shutdown.port}" shutdown="SHUTDOWN">
<Listener className="org.apache.catalina.core.JasperListener" />
<Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener" />
<Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener"/>
<Listener
className="com.springsource.tcserver.serviceability.deploy.TcContainerDeployer" />
<Listener accessFile="${catalina.base}/conf/jmxremote.access"
authenticate="true" bind="127.0.0.1"
className="com.springsource.tcserver.serviceability.rmi.JmxSocketListener"
passwordFile="${catalina.base}/conf/jmxremote.password" port="${base.jmx.port}"
useSSL="false" />
<GlobalNamingResources>
<Resource auth="Container" description="User database that can be updated and saved"
factory="org.apache.catalina.users.MemoryUserDatabaseFactory" name="UserDatabase"
pathname="conf/tomcat-users.xml" type="org.apache.catalina.UserDatabase" />
</GlobalNamingResources>
<Service name="Catalina">
<Executor maxThreads="300" minSpareThreads="50" name="tomcatThreadPool"
namePrefix="tomcat-http--" />
<Engine defaultHost="localhost" name="Catalina">
<Realm className="org.apache.catalina.realm.LockOutRealm">
<Realm className="org.apache.catalina.realm.UserDatabaseRealm" resourceName="UserDatabase" />
</Realm>
<Host appBase="webapps" autoDeploy="true" deployOnStartup="true"
deployXML="true" name="localhost" unpackWARs="true">
<Valve directory="logs" pattern="%h %l %u %t "%r" %s %b" prefix="localhost_access_log."
suffix=".txt" className="org.apache.catalina.valves.AccessLogValve"/>
<Context docBase="SimpleBlog" path="/simpleblog" reloadable="true"
source="org.eclipse.jst.jee.server:SimpleBlog"/>
</Host>
</Engine>
<Connector acceptCount="100" connectionTimeout="20000"
executor="tomcatThreadPool" maxKeepAliveRequests="15" port="${bio.http.port}"
protocol="org.apache.coyote.http11.Http11Protocol" redirectPort="${bio.https.port}" />
</Service>
<Listener className="org.apache.catalina.core.ThreadLocalLeakPreventionListener" />
</Server>
我有以下错误:
无法清除服务器上过时的文件:元素类型“主机”必须由匹配的结束标记“”终止。
元素类型“主机”必须由匹配的结束标记
"</Host>".**
终止但是,如果我以管理员(win7)的权限运行应用程序,怎么办?
完整的堆栈跟踪为:
SEVERE: Parse Fatal Error at line 22 column 11: The element type "Host" must be terminated by the matching end-tag "</Host>".
org.xml.sax.SAXParseException; systemId: file:/C:/Program%20Files/Spring%20Tool%20SUite/vfabric-tc-server-developer-2.7.1.RELEASE/spring-insight-instance/conf/server.xml; lineNumber: 22; columnNumber: 11; The element type "Host" must be terminated by the matching end-tag "</Host>".
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:198)
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:441)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:368)
at com.sun.org.apache.xerces.internal.impl.XMLScanner.reportFatalError(XMLScanner.java:1375)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanEndElement(XMLDocumentFragmentScannerImpl.java:1708)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2898)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:607)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:488)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:835)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:764)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:123)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1210)
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:568)
at org.apache.tomcat.util.digester.Digester.parse(Digester.java:1537)
at org.apache.catalina.startup.Catalina.load(Catalina.java:601)
at org.apache.catalina.startup.Catalina.load(Catalina.java:649)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.apache.catalina.startup.Bootstrap.load(Bootstrap.java:281)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:450)
最佳答案
问题是基本实例server.xml没有得到更新。因此,在基本实例下手动更新server.xml,例如C:\ sw \ STS \ vfabric-tc-server-developer-2.7.2.RELEASE \ base-instance \ conf
关于java - 元素类型“Host”必须以匹配的结束标记“</Host>”终止,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/12570934/