简体   繁体   English

TomEE中的Tomcat 7不维护会话; JSESSIONID cookie未发送

[英]Tomcat 7 within TomEE Not Maintaining Session; JSESSIONID cookie not being sent

We're using TomEE 1.7.0, which uses Tomcat 7.0.55. 我们使用的是TomEE 1.7.0,后者使用的是Tomcat 7.0.55。 When we deploy our application, the session is not being maintained -- every time the application is accessed from a browser, the server creates a new session so any session variables (like authentication, etc) are lost. 当我们部署应用程序时,不会维护会话-每次从浏览器访问该应用程序时,服务器都会创建一个新会话,因此所有会话变量(例如身份验证等)都会丢失。 We tracked the HTTP requests, and the problem appears to be that the JSESSIONID cookie is being sent back to the browser, but is not being sent back to the server. 我们跟踪了HTTP请求,问题似乎是JSESSIONID cookie被发送回浏览器,但没有被发送回服务器。 In Internet Explorer, Fiddler shows that the "Cookies/Login" section of the request header is "DNT: 1" and in Chrome, it's just empty. 在Internet Explorer中,Fiddler显示请求标头的“ Cookies / Login”部分为“ DNT:1”,而在Chrome中,它为空。 If I run the exact same application, using the exact same browsers in an earlier version of Tomcat, it works perfectly -- we can access the session and we can see that the JSESSIONID cookies are correctly sent back and forth. 如果我在早期版本的Tomcat中使用完全相同的浏览器运行完全相同的应用程序,则它可以正常工作-我们可以访问该会话,并且可以看到JSESSIONID cookie可以正确地来回发送。 That leads us to believe that it's something in the Tomcat server and not in the browser configurations. 这使我们相信这是Tomcat服务器中的内容,而不是浏览器配置中的内容。

We are stuck here; 我们被困在这里; anybody have any ideas? 有人有什么想法吗? Thanks in advance. 提前致谢。

Answering my own question in case someone runs into the same issue! 如果有人遇到相同问题,请回答我自己的问题!

The issue was that Tomcat 7 is now configured to send all cookies back as secured, so in our non-secured development environment the JSESSIONID cookie was not being stored. 问题在于,Tomcat 7现在已配置为将所有cookie发送回安全状态,因此在我们的非安全开发环境中,未存储JSESSIONID cookie。 The solution is to go into the server.xml file, find the non-secure connector and remove the secure="true" attribute in development. 解决方案是进入server.xml文件,找到非安全连接器,并在开发中删除secure =“ true”属性。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM