81991935 2016-08-04
参照:http://blog.csdn.net/wh0426/article/details/44699449
<dependency>
<groupId>de.javakaffee.msm</groupId>
<artifactId>memcached-session-manager</artifactId>
<version>1.8.3</version>
</dependency>
<!-- https://mvnrepository.com/artifact/de.javakaffee.msm/memcached-session-manager-tc8 -->
<dependency>
<groupId>de.javakaffee.msm</groupId>
<artifactId>memcached-session-manager-tc8</artifactId>
<version>1.8.3</version>
</dependency>
tomcat server.xml 添加,context。xml添加失败
<!-- https://mvnrepository.com/artifact/de.javakaffee.msm/msm-kryo-serializer -->
<dependency>
<groupId>de.javakaffee.msm</groupId>
<artifactId>msm-kryo-serializer</artifactId>
<version>1.8.3</version>
</dependency>
必要的jar
<Engine name="Catalina" defaultHost="localhost" jvmRoute="tomcat1"> <Context path="" docBase="/var/local/userSoft/apache-tomcat-8.5.4/webapps/ROOT" debug="0" reloadable="true" crossContext="true"> <Manager className="de.javakaffee.web.msm.MemcachedBackupSessionManager" memcachedNodes="n1:localhost:11211" requestUriIgnorePattern=".*\.(png|gif|jpg|css|js|ico|jpeg|htm|html)$" sessionBackupAsync="false" sessionBackupTimeout="1800000" copyCollectionsForSerialization="false" transcoderFactoryClass="de.javakaffee.web.msm.serializer.kryo.KryoTranscoderFactory"/> </Context> <!--For clustering, please take a look at documentation at: /docs/cluster-howto.html (simple how to) /docs/config/cluster.html (reference documentation) --> <!-- <Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster"/> --> <!-- Use the LockOutRealm to prevent attempts to guess user passwords via a brute-force attack --> <Realm className="org.apache.catalina.realm.LockOutRealm"> <!-- This Realm uses the UserDatabase configured in the global JNDI resources under the key "UserDatabase". Any edits that are performed against this UserDatabase are immediately available for use by the Realm. --> <Realm className="org.apache.catalina.realm.UserDatabaseRealm" resourceName="UserDatabase"/> </Realm> <Host name="localhost" appBase="webapps" unpackWARs="true" autoDeploy="true"> <!-- SingleSignOn valve, share authentication between web applications Documentation at: /docs/config/valve.html --> <!-- <Valve className="org.apache.catalina.authenticator.SingleSignOn" /> --> <!-- Access log processes all example. Documentation at: /docs/config/valve.html Note: The pattern used is equivalent to using pattern="common" --> <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs" prefix="localhost_access_log" suffix=".txt" pattern="%h %l %u %t "%r" %s %b" /> </Host> </Engine>