Intellij IDEA多个项目部署tomcat设置session共享

Intellij IDEA多个项目部署tomcat设置session共享

1.tomcat中sever.xml配置

用Intellij IDEA开发Java代码过程中的配置,需要基于以上tomcat/conf/server.xml文件,因此在server.xml中的Host标签中写好Context配置,假定此时向tomcat中发布两个war包:skye_client.war 和 skye_cnmy.war如图所示

<Host name="localhost"  appBase="webapps"
            unpackWARs="true" autoDeploy="true">

        <!-- SingleSignOn valve, share authentication between web applications
             Documentation at: /docs/config/valve.html -->
        <!--
        <Valve className="org.apache.catalina.authenticator.SingleSignOn" />
        -->

        <!-- Access log processes all example.
             Documentation at: /docs/config/valve.html
             Note: The pattern used is equivalent to using pattern="common" -->
        <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
               prefix="localhost_access_log" suffix=".txt"
               pattern="%h %l %u %t &quot;%r&quot; %s %b" />
        <Context path="/skye_client" crossContext="true" docBase="./skye_client" debug="0" reloadable="true"  />
        <Context path="/cnmy" crossContext="true" docBase="./skye_cnmy" debug="0" reloadable="true"  />

      </Host>

2 修改发布路径

将Intellij IDEA编译后的工程发布到tomcat/webapps目录下,所以需要修改Intellij IDEA的Output directory属性。请打开Project Structure -> Aritifacts,操作界面如下

intellij_cnmy

intellij_client

到此就结束了,亲测没有问题!

猜你喜欢

转载自blog.csdn.net/deng11408205/article/details/79713340