简体   繁体   中英

The element type “Host” must be terminated by the matching end-tag “</Host>”

I'm creating simple web-application. And I've got a problem with server configuring. When I tried to start the server, I've received an error The element type "Host" must be terminated by the matching end-tag ""
But my Host Tag looks like the following way (and, yes, it's closed):

<?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>

And I've got the following error:

Could not clean server of obsolete files: The element type "Host" must be terminated by the matching end-tag "".

The element type "Host" must be terminated by the matching end-tag "</Host>".** But how does it possible, if i'm running application with the rights of the Administrator (win7)?

The full stacktrace is:

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)

Issue is Base instance server.xml is not getting updated. So manually update the server.xml under base instance eg C:\\sw\\STS\\vfabric-tc-server-developer-2.7.2.RELEASE\\base-instance\\conf

For posterity, answer by @user1575688 is quite correct and one of the reasons why it may have been left in limbo is if your disk got full (probably due to a sudden core dump from a crash). You can copy the server.xml (or the other xml file that is causing the error) from your workspace/Servers/<server-config>/conf/ to the $CATALINA_BASE/conf/

I had this problem, and discovered that I had a role defined that was not used in any of the users. When I deleted the role, everything worked fine.

Now the c in className (in element Valve) is a 16 bit character. That would crash the parser.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM