熱點推薦:
您现在的位置: 電腦知識網 >> 編程 >> Java編程 >> Java核心技術 >> 正文

實現在tomcat中跑多個服務器實例

2022-06-13   來源: Java核心技術 

  Serverxml 注釋

  Server

  Server只能有一個它代表整個JVMserver可以包含一個或者多個service

  Service

  service包含一個或者多個connector和container

  Conector:

  connector用來為container接收請求和返回響應的

  Engine

  engine是頂層container它可以包含一個或者多個host

  Host

  host是虛擬主機它可以包含一個或者多個context

  Context

  context對應一個web application

  最近抽時間研究了一下tomcat的源碼發現可以增加多個Service到serverxml中實現在tomcat中跑多個服務器實例在Serverxml中增加如下配置信息

  Xml代碼

  <Service name=Catalina>

  <Connector port=

  maxThreads= minSpareThreads= maxSpareThreads=

  enableLookups=false redirectPort= acceptCount=

  debug= connectionTimeout=

  disableUploadTimeout=true />

  <Connector port=

  enableLookups=false redirectPort= debug=

  protocol=AJP/ />

  <Engine name=Catalina defaultHost=localhost debug=>

  <Logger className=orgapachecatalinaloggerFileLogger

  prefix=catalina_log suffix=txt

  timestamp=true/>

  <Realm className=orgapachecatalinarealmUserDatabaseRealm

  debug= resourceName=UserDatabase/>

  <Host name=localhost debug= appBase=webapps

  unpackWARs=true autoDeploy=true

  xmlValidation=false xmlNamespaceAware=false>

  <Logger className=orgapachecatalinaloggerFileLogger

  directory=logs   prefix=localhost_log suffix=txt

  timestamp=true/>

  </Host>

  </Engine>

  </Service>


From:http://tw.wingwit.com/Article/program/Java/hx/201311/26270.html
    推薦文章
    Copyright © 2005-2022 電腦知識網 Computer Knowledge   All rights reserved.