2017-08-30 29 views
1

我想在啓動tomcat之前使上下文的unloadDelay屬性可配置。目前,我使用sed來替換該值。但是,我發現它可以通過Apache Ant-style variable substitution進行配置。我試圖找出-D語法參數名稱,但我沒有。 https://tomcat.apache.org/tomcat-8.0-doc/config/index.html如何在命令行中通過Apache Ant樣式變量替換來設置tomcat的上下文屬性?

那麼,有人可以告訴我配置unloadDelay或模式建立任何參數與tomcat配置相關的確切參數名?

回答

1

你可以試試這個: 啓動命令行你的tomcat:

bin/startup -app.unloadingDelay 60000 

修改conf/context.xml文件,並使用上述房產:

<Context unloadDelay="${app.unloadingDelay}"> 

<!-- Default set of monitored resources --> 
<WatchedResource>WEB-INF/web.xml</WatchedResource> 

<!-- Uncomment this to disable session persistence across Tomcat restarts --> 
<!-- 
<Manager pathname="" /> 
--> 

<!-- Uncomment this to enable Comet connection tacking (provides events 
    on session expiration as well as webapp lifecycle) --> 
<!-- 
<Valve className="org.apache.catalina.valves.CometConnectionManagerValve" /> 
--> 

不要使用任何關鍵字或屬性作爲屬性名稱。 參考: https://tomcat.apache.org/tomcat-7.0-doc/config/index.html

Tomcat配置文件被格式化爲無模式XML;元素和屬性區分大小寫。支持Apache Ant式變量替換;具有名稱propname的系統屬性可以使用語法$ {propname}在配置文件中使用。所有系統屬性都可用,包括使用-D語法設置的那些屬性,由JVM自動提供的那些屬性以及在$ CATALINA_BASE/conf/catalina.properties文件中配置的屬性。

詳細:

https://tomcat.apache.org/tomcat-3.3-doc/serverxml.html#substitution

+0

非常感謝你。最後,我使用了這個'-Dapp.unloadDelay = 60000'格式。 – Jeff

相關問題