2017-08-30 99 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

相关问题