2014-06-28 79 views
5

我在Mac上設置了Tomcat服務器。 使用默認端口8080,tomcat服務器啓動正常。但是,當我改變了端口9999,我得到下面的錯誤更改端口時出現Tomcat安裝錯誤

org.apache.tomcat.util.digester.Digester fatalError 
SEVERE: Parse Fatal Error at line 70 column 21: Open quote is expected for attribute "{1}" associated with an element type "port". 
org.xml.sax.SAXParseException: Open quote is expected for attribute "{1}" associated with an element type "port". 
    at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:195) 

下面是我的server.xml文件

<!-- A "Connector" represents an endpoint by which requests are received 
     and responses are returned. Documentation at : 
     Java HTTP Connector: /docs/config/http.html (blocking & non-blocking) 
     Java AJP Connector: /docs/config/ajp.html 
     APR (HTTP/AJP) Connector: /docs/apr.html 
     Define a non-SSL HTTP/1.1 Connector on port 8080 
    --> 
    <Connector port=「9999」 protocol="HTTP/1.1" 
       connectionTimeout="20000" 
       redirectPort="8443" /> 
    <!-- A "Connector" using the shared thread pool--> 
    <!-- 
    <Connector executor="tomcatThreadPool" 
       port="8080" protocol="HTTP/1.1" 
       connectionTimeout="20000" 
       redirectPort="8443" /> 
    --> 
    <!-- Define a SSL HTTP/1.1 Connector on port 8443 
     This connector uses the BIO implementation that requires the JSSE 
     style configuration. When using the APR/native implementation, the 
     OpenSSL style configuration is required as described in the APR/native 
     documentation --> 
    <!-- 
    <Connector port="8443" protocol="org.apache.coyote.http11.Http11Protocol" 
       maxThreads="150" SSLEnabled="true" scheme="https" secure="true" 
       clientAuth="false" sslProtocol="TLS" /> 
    --> 

使用下面的命令來運行Tomcat

./catalina。 sh run

回答

6

這很簡單...請僅在記事本中打開此文件..您使用的報價與Tomcat預期的報價之間存在差異。

就是了這是什麼port="9999" ,並使用了不同的報價port=「9999」請參閱報價的差異。

+0

兩個引號的ASCII值存在差異,因此SAX解析器會拋出異常。 發生這種情況是因爲在高級文本編輯器中打開了Servers.xml文件。所以文本編輯器添加了一個花式看起來的報價。或者只需複製粘貼正確的報價從我的答案。 – Oliver

+0

只需複製粘貼正確的報價從我的答案。 – Oliver