gpt4 book ai didi

tomcat - 我在 netbeans IDE 中添加 tomcat 服务器但发生错误

转载 作者:行者123 更新时间:2023-11-28 23:57:13 25 4
gpt4 key购买 nike

CATALINA_HOME 的值 = 'C:\Program Files\Apache Software Foundation\Tomcat 7.0

value of CATALINA_HOME = 'C:\Program Files\Apache Software Foundation\Tomcat 7.0'. click here to see

i want to add server to the netbeans IDE but when im going to add the server then i get an error message that the server.xml file in the config folder is seems to be corrupted. i add an screenshot for better understanding my problem of the error which im facing. and also the code of the server.xml file as the text format.

<?xml version="1.0" encoding="UTF-8"?>
-<Server shutdown="SHUTDOWN" port="8005">
<Listener className="org.apache.catalina.startup.VersionLoggerListener"/>
<Listener className="org.apache.catalina.core.AprLifecycleListener"
SSLEngine="on"/>
<Listener className="org.apache.catalina.core.JasperListener"/>
<Listener
className="org.apache.catalina.core.JreMemoryLeakPreventionListener"/>
<Listener
className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener"/>
<Listener
className="org.apache.catalina.core.ThreadLocalLeakPreventionListener"/>
-<GlobalNamingResources>
<Resource pathname="conf/tomcat-users.xml"
factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
description="User
database that can be updated and saved"
type="org.apache.catalina.UserDatabase" auth="Container"
name="UserDatabase"/>
</GlobalNamingResources>
-<Service name="Catalina">
<Connector port="8080" redirectPort="8443" connectionTimeout="20000"
protocol="HTTP/1.1"/>
<Connector port="8009" redirectPort="8443" protocol="AJP/1.3"/>
-<Engine name="Catalina" defaultHost="localhost">
-<Realm className="org.apache.catalina.realm.LockOutRealm">
<Realm className="org.apache.catalina.realm.UserDatabaseRealm"
resourceName="UserDatabase"/>
</Realm>
-<Host name="localhost" autoDeploy="true" unpackWARs="true"
appBase="webapps">
<Valve className="org.apache.catalina.valves.AccessLogValve" pattern="%h %l
%u %t &quot;%r&quot; %s %b" suffix=".txt" prefix="localhost_access_log"
directory="logs"/>

</Host>

</Engine>

</Service>

</Server>

最佳答案

我通过从您的 server.xml 复制单个更改,在工作的 Tomcat 配置上重现了您的错误:

corruptServerXml

更改是从 pattern 复制的<Valve> 的属性(property)server.xml 屏幕截图中的元素:

pattern="%h %l %u %t "%r" %s %b"

该值是无效的 XML,因为它包含嵌套引号 ("%r")。

修复很简单:用 character entity reference 替换嵌套引号等价物,因此 pattern属性看起来像这样:

pattern="%h %l %u %t &quot;%r&quot; %s %b"

完成更改后,您应该能够添加 Tomcat 服务器。

附注我在您的 server.xml 文件中注意到的另一个不相关的差异是 prefix 的值<Valve> 的属性元素是 "localhost_access_log."但是 Tomcat 9 默认是 "localhost_access_log" (没有尾随句点)。

关于tomcat - 我在 netbeans IDE 中添加 tomcat 服务器但发生错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51022270/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com