开发者社区> 问答> 正文

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

在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)

展开
收起
爱吃鱼的程序员 2020-06-09 10:45:18 699 0
1 条回答
写回答
取消 提交回答
  • https://developer.aliyun.com/profile/5yerqm5bn5yqg?spm=a2c6h.12873639.0.0.6eae304abcjaIB
    java.lang.NoSuchFieldError:attributes

        atde.javakaffee.web.msm.MemcachedBackupSession.getAttributesFiltered(MemcachedBackupSession.


    试一下其他版本的jar

    换了好几个版本的jar包了,还是这样用Springsession吧,几行代码就可以实现session共享了

    题主这个问题解决了么?

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

    用粘性session是好的

    2020-06-09 10:45:36
    赞同 展开评论 打赏
问答排行榜
最热
最新

相关电子书

更多
WEB浏览器中即将发生的安全变化 立即下载
基于浏览器的实时构建探索之路 立即下载
基于浏览器的实时构建探索之路--玄寂 立即下载

相关实验场景

更多