产生原因:最近开发项目两个项目部署采用同一个tomcat 部署  (当两个tomcat部署时也会产生)由于部署时候两个项目访问域名相同  localhost:8080/     localhost:8090/两个项目访问路径完全相同只用端口不通

出现情况:当点击项目a内部就退出到登陆页重新登录

问题:由于两个项目采用同一浏览器  当A项目访问时候会创建一个cookie 保存jeesessionId 当访问项目B的时候同一浏览器会携带项目A保存在cookie中的jeessionId 假如jessionId=123  当在次访问B项目服务器时  B项目服务器会根据携带的jeessionId 是否存在   由于不存在  B项目服务器会给jeesession 重新创建一个值 456保存到cookie中 这时候当浏览器在次访问A项目服务器时候由于jesssionId值被改变  所以导致会退出当前登录

解决方案:

可以修改toncat context.xml文件    context上配置sessionCookieName="workSessionId"

<?xml version='1.0' encoding='utf-8'?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<!-- The contents of this file will be loaded for each web application -->
<Context sessionCookieName="workSessionId"> <!-- Default set of monitored resources -->
<WatchedResource>WEB-INF/web.xml</WatchedResource> <!-- Uncomment this to disable session persistence across Tomcat restarts -->
<!--
<Manager pathname="" />
--> <!-- Uncomment this to enable Comet connection tacking (provides events
on session expiration as well as webapp lifecycle) -->
<!--
<Valve className="org.apache.catalina.valves.CometConnectionManagerValve" />
--> </Context>

最新文章

  1. RESTful API 设计最佳实践
  2. ASP.NET Core中的依赖注入(5): ServiceProvider实现揭秘 【总体设计 】
  3. 详解.Net消息队列(MSMQ)应用
  4. mysql 与 mycat集成读写分离
  5. Razor练习1
  6. BZOJ2322: [BeiJing2011]梦想封印
  7. 转--CSS选择器详解(一)常用选择器
  8. VB 读取csv文件数据
  9. C#实现图书馆程序导入ISO-2709格式(MARC)功能
  10. 数码管字符产生器GenSym 1.0发布
  11. [转]c# xml.Load() locking file on disk causing errors
  12. ffmpeg windows 雪花声解决方法
  13. VB逆向
  14. MyEclipse 下用link 方式安装插件
  15. Cocoa深入学习:NSOperationQueue、NSRunLoop和线程安全
  16. Hadoop学习笔记(4)hadoop集群模式安装
  17. ventBroker简单实现
  18. [jstips]向数组中插入一个元素
  19. 使用U盘为龙芯笔记本安装操作系统
  20. 谱聚类(Spectral Clustring)原理

热门文章

  1. pandas:数据分析
  2. Java JDBC链接Oracle数据库
  3. Linux uart程序
  4. MyDebugeer 一个简单调试器的实现
  5. pat乙级1060
  6. SAP Netweaver的负载均衡消息服务器 vs CloudFoundry的App Router
  7. python实现栈的算法
  8. 在Spark集群中,集群的节点个数、RDD分区个数、​cpu内核个数三者与并行度的关系
  9. iOS 真机报错 Command CodeSign failed with a nonzero exit code
  10. Express框架 --router/app.use