本文介绍了检测到重复的基于 HTTP 的 FlexSession,通常是由于远程主机禁用了会话 cookie的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

场景描述:我的程序是通过flex+java+blazeDS+activeMQ实现的,它通过Flex Consumer从activeMQ订阅jms消息,目前我交付了两个tomcat同一个服务器,它们都包含我的程序,而 ActiveMQ 在另一台服务器上,现在我在同一种浏览器中打开这两个应用程序,例如作为 IE 或 Chrome,无论如何,url 就像 http://localhost:8080/HelloWord/index.html, http://localhost:>8181/HelloWord/index.html

scene description: my program is implemented by flex+java+blazeDS+activeMQ,it subscribe the jms message from activeMQ by Flex Consumer,Currently i deliver two tomcat inthe same Server,them are all contains my program ,and the ActiveMQ is in another server,now time i open the two applications in the same kind of browser,suchas IE or Chrome,whatever,the url just like http://localhost:8080/HelloWord/index.html, http://localhost:8181/HelloWord/index.html

问题:第一个应用程序 url 是 http://localhost:8080/HelloWord/index.html,我在 ie 打开它,它可以很好地订阅消息,但是当我打开第二个第二个应用程序的 url 是 http://localhost:8181/HelloWord/index.html 在即,意外发生,两个应用程序无法订阅消息.

Problem: the first application url is http://localhost:8080/HelloWord/index.html, i open it in ie,and it can subscribe message very well,but when i open the secondsecond application whose url is http://localhost:8181/HelloWord/index.html in ie, accident happens,two of the applications cannot subscribe message.

错误日志:1.flex 客户端日志(flash.log):检测到重复的基于 HTTP 的 FlexSession,通常是由于远程主机禁用了会话 cookie.必须启用会话 cookie 才能正确管理客户端连接2.java控制台日志:flex.messaging.client.FlexClientNotSubscribedException:客户端在端点my-polling-amf"上没有活动订阅.在 flex.messaging.client.FlexClient.throwNotSubscribedException(FlexClient.java:1789)在 flex.messaging.client.FlexClient.pollWithWait(FlexClient.java:967)在 flex.messaging.endpoints.BasePollingHTTPEndpoint.handleFlexClientPoll(BasePollingHTTPEndpoint.java:538)在 flex.messaging.endpoints.AbstractEndpoint.handleFlexClientPollCommand(AbstractEndpoint.java:1151)在 flex.messaging.endpoints.AbstractEndpoint.serviceMessage(AbstractEndpoint.java:965)在 flex.messaging.endpoints.AbstractEndpoint$$FastClassByCGLIB$$1a3ef066.invoke()在 net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:191)在 org.springframework.aop.framework.Cglib2AopProxy$CglibMethodInvocation.invokeJoinpoint(Cglib2AopProxy.java:692)在 org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)在 org.springframework.flex.core.MessageInterceptionAdvice.invoke(MessageInterceptionAdvice.java:66)在 org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)在 org.springframework.aop.framework.adapter.ThrowsAdviceInterceptor.invoke(ThrowsAdviceInterceptor.java:124)在 org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)在 org.springframework.aop.framework.Cglib2AopProxy$FixedChainStaticTargetInterceptor.intercept(Cglib2AopProxy.java:576)在 flex.messaging.endpoints.AMFEndpoint$$EnhancerByCGLIB$$3ae4b8ad.serviceMessage()在 flex.messaging.endpoints.amf.MessageBrokerFilter.invoke(MessageBrokerFilter.java:103)在 flex.messaging.endpoints.amf.LegacyFilter.invoke(LegacyFilter.java:158)在 flex.messaging.endpoints.amf.SessionFilter.invoke(SessionFilter.java:44)在 flex.messaging.endpoints.amf.BatchProcessFilter.invoke(BatchProcessFilter.java:67)在 flex.messaging.endpoints.amf.SerializationFilter.invoke(SerializationFilter.java:166)在 flex.messaging.endpoints.BaseHTTPEndpoint.service(BaseHTTPEndpoint.java:291)在 flex.messaging.endpoints.AMFEndpoint$$EnhancerByCGLIB$$3ae4b8ad.service()在 org.springframework.flex.servlet.MessageBrokerHandlerAdapter.handle(MessageBrokerHandlerAdapter.java:108)在 org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:771)在 org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:716)在 org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:647)在 org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:563)在 javax.servlet.http.HttpServlet.service(HttpServlet.java:641)在 javax.servlet.http.HttpServlet.service(HttpServlet.java:722)在 org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:304)在 org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)在 org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:240)在 org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:164)在 org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:462)在 org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164)在 org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)在 org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:563)在 org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)在 org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:403)在 org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:286)在 org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:272)在 org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:1730)在 java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)在 java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)

error log: 1.flex client log(flash.log): Detected duplicate HTTP-based FlexSessions, generally due to the remote host disabling session cookies. Session cookies must be enabled to manage the client connection correctly 2.java console log: flex.messaging.client.FlexClientNotSubscribedException: The client has no active subscriptions over endpoint 'my-polling-amf'. at flex.messaging.client.FlexClient.throwNotSubscribedException(FlexClient.java:1789) at flex.messaging.client.FlexClient.pollWithWait(FlexClient.java:967) at flex.messaging.endpoints.BasePollingHTTPEndpoint.handleFlexClientPoll(BasePollingHTTPEndpoint.java:538) at flex.messaging.endpoints.AbstractEndpoint.handleFlexClientPollCommand(AbstractEndpoint.java:1151) at flex.messaging.endpoints.AbstractEndpoint.serviceMessage(AbstractEndpoint.java:965) at flex.messaging.endpoints.AbstractEndpoint$$FastClassByCGLIB$$1a3ef066.invoke() at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:191) at org.springframework.aop.framework.Cglib2AopProxy$CglibMethodInvocation.invokeJoinpoint(Cglib2AopProxy.java:692) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150) at org.springframework.flex.core.MessageInterceptionAdvice.invoke(MessageInterceptionAdvice.java:66) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) at org.springframework.aop.framework.adapter.ThrowsAdviceInterceptor.invoke(ThrowsAdviceInterceptor.java:124) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) at org.springframework.aop.framework.Cglib2AopProxy$FixedChainStaticTargetInterceptor.intercept(Cglib2AopProxy.java:576) at flex.messaging.endpoints.AMFEndpoint$$EnhancerByCGLIB$$3ae4b8ad.serviceMessage() at flex.messaging.endpoints.amf.MessageBrokerFilter.invoke(MessageBrokerFilter.java:103) at flex.messaging.endpoints.amf.LegacyFilter.invoke(LegacyFilter.java:158) at flex.messaging.endpoints.amf.SessionFilter.invoke(SessionFilter.java:44) at flex.messaging.endpoints.amf.BatchProcessFilter.invoke(BatchProcessFilter.java:67) at flex.messaging.endpoints.amf.SerializationFilter.invoke(SerializationFilter.java:166) at flex.messaging.endpoints.BaseHTTPEndpoint.service(BaseHTTPEndpoint.java:291) at flex.messaging.endpoints.AMFEndpoint$$EnhancerByCGLIB$$3ae4b8ad.service() at org.springframework.flex.servlet.MessageBrokerHandlerAdapter.handle(MessageBrokerHandlerAdapter.java:108) at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:771) at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:716) at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:647) at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:563) at javax.servlet.http.HttpServlet.service(HttpServlet.java:641) at javax.servlet.http.HttpServlet.service(HttpServlet.java:722) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:304) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:240) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:164) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:462) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100) at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:563) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:403) at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:286) at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:272) at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:1730) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)

我做过的测试:1.FlexClient.getInstance().id = UIDUtil.createUID();无效的2.FlexClient.getInstance().id = null;无效的3.使用不同类型的浏览器,一个用IE,一个用Chrome,打开两个应用都可以;4.一机一tomcat,用同款浏览器ie打开,没问题;5.使用flex MXML中的customer AMFChannel或flex-config.xml中默认的AMFChannel定义,无效;

the test i have done: 1.FlexClient.getInstance().id = UIDUtil.createUID(); invalid 2.FlexClient.getInstance().id = null; invalid 3.use different kinds of browser,one use Ie,the other use Chrome, to open the two applications,them are ok; 4.one server one tomcat, use the same kind brower ie to open them ,them are ok; 5.use customer AMFChannel in flex MXML or the default AMFChannel definition in flex-config.xml, invalid;

网络朋友的预付款:1.http://blogs.adobe.com/lin/2011/05/duplication-session-error.html2.http://stackoverflow.com/questions/7659775/duplicate-session-error-when-perform-proxy-lookup两者均无效;

network friends's advance: 1.http://blogs.adobe.com/lin/2011/05/duplication-session-error.html 2.http://stackoverflow.com/questions/7659775/duplicate-session-error-when-perform-proxy-lookup the two is invalid;

以前有人遇到过这种情况吗?任何建议我都会很感激.

is there anybody meeting this situation before? any advice i will appreciate.

推荐答案

今天我也遇到了一个 Flex 会话问题并遇到了这个 SO 问题.

Today I ran into a Flex Session Problem as well and encountered this SO question.

嗯,这个问题已经很老了,所以我想原始海报可能不再需要任何帮助,但是对于偶然发现这篇文章的人,我也许以下信息可以帮助您.

Well, the question is quite old, so I guess the original poster probably does not require any help any more, but for whoever stumbles across this post, I maybe the following info could help you.

Flex 应用程序需要来自 Web 应用程序容器(此处为 tomcat)的有效会话 ID,并将实际 AMF 请求中找到的 clientOID 绑定到此 sessionID.

A Flex App requires a valid session ID from the web app container (here tomcat), and it binds the clientOID found in the actual AMF request to this sessionID.

所以原发帖者的问题可能是他试图在两个 tomcat 实例上使用相同的会话 ID,这是行不通的,因为每个 tomcat 实例都为自己和内存保留了会话.

So the problem of the original poster probably was that he tried to use the same session ID on two tomcat instances, that will not work since every tomcat instance keeps the sessions for itself and in memory.

我的问题是我有一个记录的 jmeter 测试,它不接受记录的 AMF 消息中的 clientID 和 URL 中的 sessionID 的组合.但是,返回的 AMF 错误消息在标头部分中包含有效的新会话 ID.该错误消息的 AMF 标头如下所示(至少对我而言):

My problem was that I had a recorded jmeter test and it would not accept the combination of clientID in the recorded AMF message and sessionID in the URL.However, the AMF error message that is returned contains a valid new session ID in the header section. The AMF header of that error message looks like that (at least for me):

Version: 3
(Header #0 name=AppendToGatewayUrl, mustUnderstand=true)
 ";jsessionid=OLD_SESSION_ID;jsessionid=NEW_SESSION_ID"

所以我所做的是从 AMF 标头中提取新的会话 ID,并将其用于其余请求.

So what I did is to extract the new session ID from the AMF header and used that for the rest of the requests.

希望对大家有用...

这篇关于检测到重复的基于 HTTP 的 FlexSession,通常是由于远程主机禁用了会话 cookie的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-05 00:49