this is my tomcat option:
in the context.xml is:
<Context>
<!-- Default set of monitored resources -->
<WatchedResource>WEB-INF/web.xml</WatchedResource>
<!-- Uncomment this to disable session persistence across Tomcat
restarts -->
<!--
<Manager pathname="" />
-->
<!-- -->
<Manager
className="de.javakaffee.web.msm.MemcachedBackupSessionManager"
memcachedNodes="n1:localhost:11211"
requestUriIgnorePattern=".*\.(png|gif|jpg|css|js)$"
sessionBackupAsync="false"
sticky="true"
sessionBackupTimeout="100"
transcoderFactoryClass="de.javakaffee.web.msm.serializer.javolution.JavolutionTranscoderFactory"
copyCollectionsForSerialization="false"
/>
<!-- Uncomment this to enable Comet connection tacking (provides
events
on session expiration as well as webapp lifecycle) -->
<!--
<Valve
className="org.apache.catalina.valves.CometConnectionManagerValve" />
-->
</Context>
i did a whalin memcached java client and get the session by sessionId
as key but throwe exception:
58 MemCachedClient mcc = new MemCachedClient();
59 MemcachedItem item = mcc.gets("166066000F3726BC85FFE8426F978AF8-
n1.tomcat1");
60 HttpSession session = (HttpSession)item.getValue();
61 System.out.println("sessionID: "+session.getId());
62 System.out.println("current_user:
"+session.getAttribute("current_user"));
83 [main] ERROR com.danga.MemCached.MemCachedClient - ++++ exception
thrown while trying to get object from cache for key:
166066000F3726BC85FFE8426F978AF8-n1.tomcat1
114 [main] ERROR com.danga.MemCached.MemCachedClient - Value out of
range. Value:"2048" Radix:10
java.lang.NumberFormatException: Value out of range. Value:"2048"
Radix:10
at java.lang.Byte.parseByte(Byte.java:153)
at java.lang.Byte.parseByte(Byte.java:108)
at com.schooner.MemCached.AscIIClient.gets(AscIIClient.java:881)
at com.schooner.MemCached.AscIIClient.gets(AscIIClient.java:638)
at com.schooner.MemCached.AscIIClient.gets(AscIIClient.java:634)
at com.danga.MemCached.MemCachedClient.gets(MemCachedClient.java:
1087)
at Test2.main(Test2.java:59)
Exception in thread "main" java.lang.NullPointerException
at Test2.main(Test2.java:60)
On 12月26日, 下午3时04分, Martin Grotzke wrote:Please provide details regarding the configuration. Are there any warnings
in the logs? Is the user object serializable?
Cheers,
Martin
Am 26.12.2011 07:56 schrieb "miwucc" <xxlfor...@gmail.com>:
last week,i find memcached-session-manager can help me to store
session in memcached.so i had a try.
i use spring-mvc as my web controler.
when the customer login on the web i did this:
--------------------------------------------------------------------------- -------------
User loginUser = userService.dealLogin(user);
System.out.println("sessionId: "+request.getSession().getId());
HttpSession session = request.getSession();
session.setAttribute(Constant.CURRENT_USER, loginUser);
System.out.println("user:
"+session.getAttribute(Constant.CURRENT_USER));
--------------------------------------------------------------------------- ------------------------------------------
from now on,the session is ok and i can get the attirbute
"Constant.CURRENT_USER".
But then i send another request,the request was catched by zhe
springmvc‘s interceptor(i use it for authfilter).
------------------------------------
System.out.println("sessionId: "+sesion.getId());
System.out.println("user:
"+sesion.getAttribute(Constant.CURRENT_USER));
---------------------------------------------------
i get the session and the sessionId equal the first sessionId.
but i get the attribute Constant.CURRENT_USER,it return null ~ !
this is why?somebody who can help me !