1

我正在创建简单的网络应用程序。而且我在服务器配置方面遇到了问题。当我尝试启动服务器时,我收到一个错误元素类型“主机”必须由匹配的结束标签“”终止
但我的主机标签看起来像以下方式(并且,是的,它已关闭):

<?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 &quot;%r&quot; %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)
4

4 回答 4

2

问题是基础实例 server.xml 没有得到更新。所以手动更新基本实例下的 server.xml 例如 C:\sw\STS\vfabric-tc-server-developer-2.7.2.RELEASE\base-instance\conf

于 2012-12-15T18:56:02.830 回答
0

我遇到了这个问题,并发现我定义了一个未在任何用户中使用的角色。当我删除角色时,一切正常。

于 2017-05-06T00:31:13.267 回答
0

对于后代,@user1575688 的回答是非常正确的,它可能被搁置的原因之一是您的磁盘是否已满(可能是由于崩溃导致的突然核心转储)。您可以将 server.xml(或导致错误的其他 xml 文件)从您复制workspace/Servers/<server-config>/conf/$CATALINA_BASE/conf/

于 2016-01-09T02:43:26.060 回答
-1

现在 c in className(in element Valve) 是一个 16 位字符。那会使解析器崩溃。

于 2012-09-24T20:23:31.007 回答