用memcached实现session共享,tomcat启动不报错,浏览器访问就报错

醉枫染墨丷 发布于 2016/09/07 09:21
阅读 1K+
收藏 0

在ubuntu虚拟机上用nginx+tomcat做负载均衡,为了实现session的共享,安装了memcached服务,并在tomcat的lib目录下导入了下列jar包:

asm-3.2.jar,couchbase-client-1.2.2.jar,kryo-1.03.jar,kryo-serializers-0.11.jar,memcached-session-manager-1.6.5.jar,memcached-session-manager-tc7-1.6.5.jar,minlog-1.2.jar,msm-kryo-serializer-1.6.5.jar,reflectasm-0.9.jar,spymemcached-2.10.3.jar

在tomcat的context.xml里面添加如下:

<Manager className="de.javakaffee.web.msm.MemcachedBackupSessionManager"  
 memcachedNodes="n1:192.168.126.132:11211,n2:192.168.126.131:11211"
 sticky="false"
 sessionBackupAsync="false"
 lockingMode="auto" 
 requestUriIgnorePattern=".*\.(png|gif|jpg|css|js){1}quot"
 sessionBackupTimeout="1000"    
 transcoderFactoryClass="de.javakaffee.web.msm.serializer.kryo.KryoTranscoderFactory"  
/>

tomca启动的时候没有报错,但是访问的时候就会报下面的错误,有没有知道的,求解啊!

Sep 06, 2016 6:09:45 PM de.javakaffee.web.msm.LockingStrategy onBackupWithoutLoadedSession

WARNING: Found no validity info for session id 1F64837921904BFB8FA17328F56F75BC-n2
Sep 06, 2016 6:09:45 PM org.apache.coyote.http11.AbstractHttp11Processor process
SEVERE: Error processing request
java.lang.NoSuchFieldError: attributes
        at de.javakaffee.web.msm.MemcachedBackupSession.getAttributesFiltered(MemcachedBackupSession.java:514)
        at de.javakaffee.web.msm.BackupSessionTask.call(BackupSessionTask.java:108)
        at de.javakaffee.web.msm.BackupSessionTask.call(BackupSessionTask.java:50)
        at de.javakaffee.web.msm.BackupSessionService$SynchronousExecutorService.submit(BackupSessionService.java:346)
        at de.javakaffee.web.msm.BackupSessionService.backupSession(BackupSessionService.java:205)
        at de.javakaffee.web.msm.MemcachedSessionService.backupSession(MemcachedSessionService.java:1076)
        at de.javakaffee.web.msm.RequestTrackingHostValve.backupSession(RequestTrackingHostValve.java:244)
        at de.javakaffee.web.msm.RequestTrackingHostValve.invoke(RequestTrackingHostValve.java:173)
        at de.javakaffee.web.msm.RequestTrackingHostValve.invoke(RequestTrackingHostValve.java:138)
        at de.javakaffee.web.msm.RequestTrackingHostValve.invoke(RequestTrackingHostValve.java:138)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
        at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:956)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:442)
        at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1082)
        at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:623)
        at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:316)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
        at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
        at java.lang.Thread.run(Thread.java:745)

加载中
0
_Mr_Right_
_Mr_Right_
java.lang.NoSuchFieldError: attributes

        at de.javakaffee.web.msm.MemcachedBackupSession.getAttributesFiltered(MemcachedBackupSession.


试一下其他版本的 jar

醉枫染墨丷
醉枫染墨丷
换了好几个版本的jar包了,还是这样
0
java9
java9
用Spring session吧,几行代码就可以实现session共享了
0
落枫满地
落枫满地

题主这个问题解决了么?

我这边在配置成非粘性session以后也是这种问题.

用粘性session是好的

返回顶部
顶部