答案 0 :(得分:3)
我认为你是在正确的轨道上,但你只是缺少Service元素规范中列出的一些子元素。
我认为您只是忘记引擎和主机元素,它们分别是上下文元素的祖父母和父母。
<Service name="stable">
<Connector port="80" protocol="HTTP/1.1"
maxThreads="150" connectionTimeout="20000"/>
<Engine name="stable" defaultHost="localhost">
<Host name="localhost1" appBase="webapp1">
<Context docBase="C:\websites\test\stable\" />
</Host>
</Engine>
</Service>
<Service name="release">
<Connector port="81" protocol="HTTP/1.1"
maxThreads="150" connectionTimeout="20000"/>
<Engine name="release" defaultHost="localhost2">
<Host name="localhost2" appBase="webapp2">
<Context docBase="C:\websites\test\release\" />
</Host>
</Engine>
</Service>
有关更多信息和更详细的示例(定义两个Service元素,一个在端口8080上,另一个在端口9080上),请参阅此邮件列表帖子:
http://www.mail-archive.com/users@tomcat.apache.org/msg44729.html
答案 1 :(得分:0)
这对我有用:
<Service name="Stable">
<Connector
port="80"
protocol="HTTP/1.1"
connectionTimeout="20000" />
<Engine name="Stable" defaultHost="localhost">
<Host
name="localhost"
appBase="C:\websites\test\stable\">
<Context docBase="C:\websites\test\stable\" path="" />
</Host>
</Engine>