我尝试使用memcached-session-manager版本1.6.3实现非粘性Tomcat会话共享。在我的桌面开发环境中,我想使用de.javakaffee.web.msm.DummyMemcachedBackupSessionManager
作为经理类,因为我没有在开发中设置memcached机队。
我遇到的问题是,DummyMemcachedBackupSessionManager
似乎粗略地实施,因为它每次尝试加载会话时都会导致NullPointerException
。我的日志中填充了像这样的堆栈跟踪:
May 06, 2015 5:24:59 PM de.javakaffee.web.msm.MemcachedSessionService loadFromMemcached
WARNING: Could not load session with id 0D66BAE28A0B302425186CD6B3F62DAA-n1 from memcached.
java.lang.NullPointerException
at de.javakaffee.web.msm.MemcachedSessionService.loadFromMemcached(MemcachedSessionService.java:1111)
at de.javakaffee.web.msm.MemcachedSessionService.findSession(MemcachedSessionService.java:597)
at de.javakaffee.web.msm.DummyMemcachedSessionService.findSession(DummyMemcachedSessionService.java:113)
at de.javakaffee.web.msm.MemcachedBackupSessionManager.findSession(MemcachedBackupSessionManager.java:196)
at org.apache.catalina.connector.Request.doGetSession(Request.java:2981)
at org.apache.catalina.connector.Request.getSession(Request.java:2378)
at org.apache.catalina.connector.RequestFacade.getSession(RequestFacade.java:897)
at com.amazon.sentry.TomcatSSOFilter.setSessionAttributes(TomcatSSOFilter.java:133)
...
我是否可以使用1.6.3版本来避免使用所有这些NPE污染我的日志?
作为参考,我的context.xml
看起来像这样:
<?xml version="1.0">
<Context>
<Manager className="de.javakaffee.web.msm.DummyMemcachedBackupSessionManager"
sticky="false"
lockingMode="none"
sessionBackupAsync="false"
memcachedNodes="n1:dummy-node:0"
requestUriIgnorePattern="\.(ico|png|gif|jpg|css|js)$"
/>
</Context>