爲了嘗試爲我現有的應用程序外化tomcat會話,我正在嘗試Spring會話Redis解決方案。下面的步驟後,包括在pom.xml中必要的依賴,像這樣:春季會話Redis序列化器SerializationException
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>${org.springframework-version}</version>
</dependency>
<dependency>
<groupId>org.springframework.session</groupId>
<artifactId>spring-session-data-redis</artifactId>
<version>1.2.1.RELEASE</version>
</dependency>
加入springSessionRepositoryFilter在web.xml是這樣的:
<filter>
<filter-name>springSessionRepositoryFilter</filter-name>
<filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
</filter>
<filter-mapping>
<filter-name>springSessionRepositoryFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
,並添加在Spring XML配置以下
<bean class="org.springframework.session.data.redis.config.annotation.web.http.RedisHttpSessionConfiguration"/>
<context:property-placeholder location="classpath:application.properties"/>
<bean class="org.springframework.data.redis.connection.jedis.JedisConnectionFactory" p:port="${spring.redis.port}"/>
並且構建和部署到tomcat上,t他是我得到的錯誤:
org.springframework.data.redis.serializer.SerializationException: Cannot serialize; nested exception is org.springframework.core.serializer.support.SerializationFailedException: Failed to serialize object using DefaultSerializer; nested exception is java.io.NotSerializableException: com.sun.jersey.client.apache.ApacheHttpClient
任何建議或幫助是極大的讚賞。謝謝 !! 還附有是我的pom.xml的條目: pom.xml entries
你能發佈異常的完整堆棧跟蹤嗎? –
'java.io.NotSerializableException'我猜你試圖保存的任何對象,因爲會話狀態是不可序列化的。發佈更多關於保存會話狀態 –