Tomcat - 如何指定可以在server.xml中扩展的属性 [英] Tomcat - How to specify properties that can be expanded in server.xml

查看:590
本文介绍了Tomcat - 如何指定可以在server.xml中扩展的属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

目前,我在我的server.xml:

Currently, I have in my server.xml:

<Connector port="8080" protocol="HTTP/1.1" 
           connectionTimeout="20000" 
           redirectPort="8443" />

我希望它变成:

<Connector port="${oms.ui.port}" protocol="HTTP/1.1" 
           connectionTimeout="20000" 
           redirectPort="8443" />

我把这个属性oms.ui.port放在apache-tomcat-7.0的属性文件中。 8 \lib
但找不到它,我得到:

I put this property oms.ui.port in a property file residing in apache-tomcat-7.0.8\lib but it does not find it, I get:


警告:[SetAllPropertiesRule] {Server / Service / Connector}将
属性'port'设置为'$ {oms.ui.port}'未找到匹配的属性。

WARNING: [SetAllPropertiesRule]{Server/Service/Connector} Setting property 'port' to '${oms.ui.port}' did not find a matching property.



<

Maybe someone with a better Tomcat experience can help me, please?

推荐答案

根据 Tomcat 7.0配置概述


支持Apache Ant样式变量替换;具有名称propname的系统属性可以在配置文件中使用语法$ {propname}来使用。所有系统属性都可用,包括使用-D语法设置的那些属性,JVM自动提供的属性和$ CATALINA_BASE / conf / catalina.properties文件中配置的属性。

Apache Ant-style variable substitution is supported; a system property with the name propname may be used in a configuration file using the syntax ${propname}. All system properties are available including those set using the -D syntax, those automatically made available by the JVM and those configured in the $CATALINA_BASE/conf/catalina.properties file.

因此,您可以使用JVM系统属性或 catalina.properties 声明您的变量并为其分配一个值。

So you can use either a JVM system property or catalina.properties to declare your variable and assign a value to it.

这篇关于Tomcat - 如何指定可以在server.xml中扩展的属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆