2015-06-11 66 views
0

相同的上下文路徑我有兩個Web應用程序的戰爭STORE_ABC.warSTORE_DEF.war和單JBoss服務器在我的機器上運行。我想按照以下方式在我的jboss中部署兩個具有相同上下文路徑的戰爭。DEPLOYE兩戰不同的域名,但在相同的jboss-4.0.3

http://localhost:8080/home對於STORE_ABC.war

http://testsite1:8080/homeSTORE_DEF.war

jboss-web.xmlSTORE_ABC.warSTORE_DEF.war

<jboss-web> 
    <context-root>/</context-root> 
</jboss-web> 

我怎麼能實現上述的配置?

回答

1

我加入了另一臺主機vhost2server.xml文件夾裏面${jboss-home}server\default\deploy\jbossweb-tomcat55.sar文件夾如下:

<Server> 
<Service name="jboss.web" 
    className="org.jboss.web.tomcat.tc5.StandardService"> 
    <Connector port="8080" address="${jboss.bind.address}" 
    maxThreads="250" strategy="ms" maxHttpHeaderSize="8192" 
    emptySessionPath="true" 
    enableLookups="false" redirectPort="443" acceptCount="100" 
    connectionTimeout="20000" disableUploadTimeout="true"/> 

    <Connector protocol="HTTP/1.1" port="8081" address="${jboss.bind.address}" 
    redirectPort="${jboss.web.https.port}" /> 


    <Connector port="8089" address="${jboss.bind.address}" 
    emptySessionPath="true" enableLookups="false" redirectPort="443" 
    protocol="AJP/1.3"/> 

    <Connector port="8445" address="${jboss.bind.address}" 
     maxThreads="100" strategy="ms" maxHttpHeaderSize="8192" 
     emptySessionPath="true" 
     scheme="https" secure="true" clientAuth="false" 
     keystoreFile="${jboss.server.home.dir}/conf/bookstore.keystore" 
     keystorePass="bookstore" sslProtocol = "TLS" allowTrace="true"/> 

    <Engine name="jboss.web" defaultHost="localhost"> 
    <Realm className="org.jboss.web.tomcat.security.JBossSecurityMgrRealm" 
     certificatePrincipal="org.jboss.security.auth.certs.SubjectDNMapping" 
     /> 
    <Host name="localhost" 
     autoDeploy="false" deployOnStartup="false" deployXML="false"> 
    </Host> 
    <Host name="vhost2" autoDeploy="false" 
       deployOnStartup="false" deployXML="false"> 
        <Alias>testsite1</Alias> 
      <Valve className="org.apache.catalina.valves.AccessLogValve" 
        prefix="vhost2" suffix=".log" pattern="common" 
        directory="${jboss.server.home.dir}/log"/> 
      <DefaultContext cookies="true" crossContext="true" override="true"/> 
     </Host> 
    </Engine> 
</Service> 
</Server> 

然後我添加了一個新的文件jboss-web.xmlSTORE-DEF.warWEB-INF文件夾內,如下所示:

<jboss-web> 
    <context-root>/</context-root> 
    <virtual-host>testsite1</virtual-host> 
</jboss-web> 

現在我我能夠從URL http://localhost:8080/homeSTORE-DEF.war從URL http://testsite1:8080/home訪問STORE-ABC.war

注意 - 不要忘了在hosts文件中添加127.0.0.1 testsite1

相關問題