bcxs051 / memcached-session-manager

Automatically exported from code.google.com/p/memcached-session-manager
0 stars 0 forks source link

No thread-bound request found: Are you referring to request attributes outside of an actual web request, or processing a request outside of the originally receiving thread. #204

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Enable msm logger as per document

2. Add following line in cataclina.sh
 CATALINA_OPTS="$CATALINA_OPTS -Dnet.spy.log.LoggerImpl=net.spy.memcached.compat.log.SunLogger" 

3. Add following lines in CATALINA_HOME/conf/logging.properties
de.javakaffee.web.msm.level=FINE
# A handler's log level threshold can be set using SEVERE, WARNING, INFO, 
CONFIG, FINE, FINER, FINEST or ALL
net.spy.memcached.level = FINE
# To make only the MemcachedConnection less verbose:
net.spy.memcached.MemcachedConnection.level = FINE

What is the expected output? What do you see instead?
User session should be stored in Memcached server, instead I see "Could not 
store session 9B5C8BF8A55A37A93785F86B75DF2D0A-n2 in memcached."

What version of the product are you using? On what operating system?
spymemcached-2.10.2.jar
memcached-session-manager-tc6-1.8.1.jar
memcached-session-manager-1.8.1.jar
tomcat-6.0.39

Please provide any additional information below.

Error Stack trace. If I disable the logger this issue goes away.

INFO: Could not store session 9B5C8BF8A55A37A93785F86B75DF2D0A-n2 in memcached.
java.util.concurrent.ExecutionException: 
org.springframework.beans.factory.BeanCreationException: Error creating bean 
with name 'scopedTarget.sessUser': Scope 'session' is not active for the 
current thread; consider defining a scoped proxy for this bean if you intend to 
refer to it from a singleton; nested exception is 
java.lang.IllegalStateException: No thread-bound request found: Are you 
referring to request attributes outside of an actual web request, or processing 
a request outside of the originally receiving thread? If you are actually 
operating within a web request and still receive this message, your code is 
probably running outside of DispatcherServlet/DispatcherPortlet: In this case, 
use RequestContextListener or RequestContextFilter to expose the current 
request.
        at de.javakaffee.web.msm.BackupSessionService$SynchronousExecutorService.submit(BackupSessionService.java:348)
        at de.javakaffee.web.msm.BackupSessionService.backupSession(BackupSessionService.java:205)
        at de.javakaffee.web.msm.MemcachedSessionService.backupSession(MemcachedSessionService.java:1040)
        at de.javakaffee.web.msm.RequestTrackingHostValve.backupSession(RequestTrackingHostValve.java:230)
        at de.javakaffee.web.msm.RequestTrackingHostValve.invoke(RequestTrackingHostValve.java:159)
        at de.javakaffee.web.msm.RequestTrackingHostValve.invoke(RequestTrackingHostValve.java:124)
        at de.javakaffee.web.msm.RequestTrackingHostValve.invoke(RequestTrackingHostValve.java:124)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
        at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:861)
        at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:606)
        at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
        at java.lang.Thread.run(Thread.java:722)
Caused by: org.springframework.beans.factory.BeanCreationException: Error 
creating bean with name 'scopedTarget.sessUser': Scope 'session' is not active 
for the current thread; consider defining a scoped proxy for this bean if you 
intend to refer to it from a singleton; nested exception is 
java.lang.IllegalStateException: No thread-bound request found: Are you 
referring to request attributes outside of an actual web request, or processing 
a request outside of the originally receiving thread? If you are actually 
operating within a web request and still receive this message, your code is 
probably running outside of DispatcherServlet/DispatcherPortlet: In this case, 
use RequestContextListener or RequestContextFilter to expose the current 
request.
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:342)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193)
        at org.springframework.aop.target.SimpleBeanTargetSource.getTarget(SimpleBeanTargetSource.java:33)
        at org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.getTarget(Cglib2AopProxy.java:654)
        at org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:605)
        at com.etrade.ser.issue.controller.User$$EnhancerByCGLIB$$7342260b.toString(<generated>)
        at java.lang.String.valueOf(String.java:2902)
        at java.lang.StringBuilder.append(StringBuilder.java:128)
        at de.javakaffee.web.msm.JavaSerializationTranscoder.writeAttributes(JavaSerializationTranscoder.java:140)
        at de.javakaffee.web.msm.JavaSerializationTranscoder.serializeAttributes(JavaSerializationTranscoder.java:99)
        at de.javakaffee.web.msm.TranscoderService.serializeAttributes(TranscoderService.java:155)
        at de.javakaffee.web.msm.BackupSessionTask.serializeAttributes(BackupSessionTask.java:176)
        at de.javakaffee.web.msm.BackupSessionTask.call(BackupSessionTask.java:110)
        at de.javakaffee.web.msm.BackupSessionTask.call(BackupSessionTask.java:51)

        at de.javakaffee.web.msm.BackupSessionTask.call(BackupSessionTask.java:110)
        at de.javakaffee.web.msm.BackupSessionTask.call(BackupSessionTask.java:51)
        at de.javakaffee.web.msm.BackupSessionService$SynchronousExecutorService.submit(BackupSessionService.java:346)
        ... 13 more
Caused by: java.lang.IllegalStateException: No thread-bound request found: Are 
you referring to request attributes outside of an actual web request, or 
processing a request outside of the originally receiving thread? If you are 
actually operating within a web request and still receive this message, your 
code is probably running outside of DispatcherServlet/DispatcherPortlet: In 
this case, use RequestContextListener or RequestContextFilter to expose the 
current request.
        at org.springframework.web.context.request.RequestContextHolder.currentRequestAttributes(RequestContextHolder.java:131)
        at org.springframework.web.context.request.SessionScope.get(SessionScope.java:90)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:328)
        ... 27 more

Mar 25, 2014 2:26:32 PM net.spy.memcached.MemcachedConnection addOperation

Original issue reported on code.google.com by yoga.und...@gmail.com on 25 Mar 2014 at 9:57

GoogleCodeExporter commented 9 years ago
Can you provide a simple spring app with a session scoped bean that I could use 
to debug this?

Original comment by martin.grotzke on 27 Mar 2014 at 7:41

GoogleCodeExporter commented 9 years ago
Hi Martin,

No more I getting this issue, please close this issue.

It was happening due to an error while getting a proxy instance in my code, 
after I correct the error in the code, now I'm able to see the msm logs are 
getting logged.

Thanks
Yoga

Original comment by yoga.und...@gmail.com on 27 Mar 2014 at 6:26

GoogleCodeExporter commented 9 years ago
Ok

Original comment by martin.grotzke on 27 Mar 2014 at 8:10