0

我使用 Hazelcast 进行带有弹簧安全性的会话复制。我正在创建会话复制和集群使用 Wildfly。但是春季安全日志记录中的问题。当我登录 node1 并传递 node2 时,我应该重新登录!为了解决这个问题,我使用了 Hazelcast,但遇到了一个问题

我的依赖:

<dependency>
    <groupId>com.hazelcast</groupId>
    <artifactId>hazelcast-all</artifactId>
    <version>3.4.2</version>
</dependency>


<dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>io.spring.platform</groupId>
            <artifactId>platform-bom</artifactId>
            <version>1.1.2.RELEASE</version>
            <type>pom</type>
            <scope>import</scope>
        </dependency>
    </dependencies>
</dependencyManagement>

web.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" version="2.5">
    <filter>
        <filter-name>hazelcast-filter</filter-name>
        <filter-class>com.hazelcast.web.spring.SpringAwareWebFilter</filter-class>
        <init-param>
            <param-name>map-name</param-name>
            <param-value>my-sessions</param-value>
        </init-param>
        <init-param>
            <param-name>config-location</param-name>
            <param-value>/WEB-INF/hazelcast.xml</param-value>
        </init-param>
    </filter>
    <filter-mapping>
        <filter-name>hazelcast-filter</filter-name>
        <url-pattern>/*</url-pattern>
        <dispatcher>FORWARD</dispatcher>
        <dispatcher>INCLUDE</dispatcher>
        <dispatcher>REQUEST</dispatcher>
    </filter-mapping>
    <listener>
        <listener-class>com.hazelcast.web.SessionListener</listener-class>
    </listener>
    <context-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>classpath:application-context.xml,
            classpath:security-context.xml
        </param-value>
    </context-param>
    <listener>
        <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
    </listener>


    <servlet>
        <servlet-name>Faces Servlet</servlet-name>
        <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet-mapping>
        <servlet-name>Faces Servlet</servlet-name>
        <url-pattern>*.xhtml</url-pattern>
    </servlet-mapping>
    <filter>
        <filter-name>springSecurityFilterChain</filter-name>
        <filter-class>org.springframework.web.filter.DelegatingFilterProxy
        </filter-class>
    </filter>
    <filter-mapping>
        <filter-name>springSecurityFilterChain</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>
    <session-config>
        <session-timeout>10</session-timeout>
    </session-config>
</web-app>

应用程序上下文.xml

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:p="http://www.springframework.org/schema/p"
       xmlns:jpa="http://www.springframework.org/schema/data/jpa"
       xmlns:context="http://www.springframework.org/schema/context"
       xmlns:jee="http://www.springframework.org/schema/jee"
       xmlns:tx="http://www.springframework.org/schema/tx" xmlns:beans="http://www.springframework.org/schema/util"
       xsi:schemaLocation="http://www.springframework.org/schema/beans
       http://www.springframework.org/schema/beans/spring-beans.xsd
       http://www.springframework.org/schema/context
       http://www.springframework.org/schema/context/spring-context.xsd
       http://www.springframework.org/schema/data/jpa
       http://www.springframework.org/schema/data/jpa/spring-jpa.xsd
       http://www.springframework.org/schema/tx
       http://www.springframework.org/schema/tx/spring-tx.xsd
       http://www.springframework.org/schema/jee
       http://www.springframework.org/schema/jee/spring-jee.xsd http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd"
        >
    <bean id="sessionRegistry"
          class="org.springframework.security.core.session.SessionRegistryImpl" />

    <context:annotation-config/>
    <context:component-scan base-package="kz.astonline.ehospital"/>
    <jpa:repositories base-package="kz.astonline.ehospital.repository"/>

    <bean class="org.springframework.beans.factory.config.CustomScopeConfigurer">
        <property name="scopes">
            <map>
                <entry key="view">
                    <bean class="kz.astonline.ehospital.spring.scope.ViewScope"/>
                </entry>
            </map>
        </property>
    </bean>    
</beans>

安全上下文.xml

<?xml version="1.0" encoding="UTF-8"?>
<beans:beans xmlns="http://www.springframework.org/schema/security"
             xmlns:beans="http://www.springframework.org/schema/beans"
             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xsi:schemaLocation="http://www.springframework.org/schema/beans
                 http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
                 http://www.springframework.org/schema/security
                 http://www.springframework.org/schema/security/spring-security-3.2.xsd">

    <global-method-security secured-annotations="enabled"/>    
    <http auto-config="true" use-expressions="true" access-denied-page="/error404.xhtml" >
        <intercept-url pattern="/javax.faces.resource/**" access="permitAll"/>

        <form-login login-page="/login.xhtml" default-target-url="/view/home.xhtml"/>

        <logout invalidate-session="true" logout-success-url="/login.xhtml"/>
        <remember-me/>
    </http>

    <authentication-manager alias="authenticationManager">
        <authentication-provider user-service-ref="customUserDetailsService">
            <password-encoder ref="encoder"/>
        </authentication-provider>
    </authentication-manager>

</beans:beans>

堆栈跟踪:

2015-06-12 03:29:12,729] Artifact e-hospital: Artifact is deployed successfully
[2015-06-12 03:29:12,729] Artifact e-hospital: Deploy took 71 147 milliseconds
15:29:13,536 INFO  [com.hazelcast.config.UrlXmlConfig] (default task-1) Configuring Hazelcast from 'file:/D:/App/wildfly-8.2.0.Final/standalone/tmp/vfs/temp/tempccbe393383ab3028/e-hospital.war-60b2ff86b3469eb1/WEB-INF/hazelcast.xml'.
15:29:15,770 INFO  [com.hazelcast.web.HazelcastInstanceLoader] (default task-1) Creating a new HazelcastInstance for session replication
15:29:15,823 INFO  [com.hazelcast.instance.DefaultAddressPicker] (default task-1) [LOCAL] [dev] [3.4.2] Prefer IPv4 stack is true.
15:29:15,980 INFO  [com.hazelcast.instance.DefaultAddressPicker] (default task-1) [LOCAL] [dev] [3.4.2] Picked Address[192.168.0.117]:5701, using socket ServerSocket[addr=/0:0:0:0:0:0:0:0,localport=5701], bind any local is true
15:29:16,425 INFO  [com.hazelcast.spi.OperationService] (default task-1) [192.168.0.117]:5701 [dev] [3.4.2] Backpressure is disabled
15:29:16,432 INFO  [com.hazelcast.spi.impl.BasicOperationScheduler] (default task-1) [192.168.0.117]:5701 [dev] [3.4.2] Starting with 4 generic operation threads and 8 partition operation threads.
15:29:16,581 INFO  [com.hazelcast.system] (default task-1) [192.168.0.117]:5701 [dev] [3.4.2] Hazelcast 3.4.2 (20150326 - f6349a4) starting at Address[192.168.0.117]:5701
15:29:16,582 INFO  [com.hazelcast.system] (default task-1) [192.168.0.117]:5701 [dev] [3.4.2] Copyright (C) 2008-2014 Hazelcast.com
15:29:16,894 INFO  [com.hazelcast.instance.Node] (default task-1) [192.168.0.117]:5701 [dev] [3.4.2] Creating MulticastJoiner
15:29:16,899 INFO  [com.hazelcast.core.LifecycleService] (default task-1) [192.168.0.117]:5701 [dev] [3.4.2] Address[192.168.0.117]:5701 is STARTING
15:29:21,020 INFO  [com.hazelcast.cluster.impl.MulticastJoiner] (default task-1) [192.168.0.117]:5701 [dev] [3.4.2] 


Members [1] {
    Member [192.168.0.117]:5701 this
}

15:29:21,098 INFO  [com.hazelcast.core.LifecycleService] (default task-1) [192.168.0.117]:5701 [dev] [3.4.2] Address[192.168.0.117]:5701 is STARTED
15:29:25,799 INFO  [com.hazelcast.util.HealthMonitor] (hz._hzInstance_1_dev.HealthMonitor) [192.168.0.117]:5701 [dev] [3.4.2] processors=8, physical.memory.total=7,9G, physical.memory.free=1,5G, swap.space.total=21,3G, swap.space.free=3,5G, heap.memory.used=748,0M, heap.memory.free=276,0M, heap.memory.total=1024,0M, heap.memory.max=1024,0M, heap.memory.used/total=73,04%, heap.memory.used/max=73,04%, minor.gc.count=12, minor.gc.time=584ms, major.gc.count=0, major.gc.time=0ms, load.process=6,00%, load.system=45,00%, load.systemAverage=-100,00%, thread.count=357, thread.peakCount=357, event.q.size=0, executor.q.async.size=0, executor.q.client.size=0, executor.q.query.size=0, executor.q.scheduled.size=0, executor.q.io.size=0, executor.q.system.size=0, executor.q.operation.size=0, executor.q.priorityOperation.size=0, executor.q.response.size=0, operations.remote.size=0, operations.running.size=0, proxy.count=0, clientEndpoint.count=0, connection.active.count=0, client.connection.count=0, connection.count=0
15:29:41,806 INFO  [com.hazelcast.partition.InternalPartitionService] (default task-43) [192.168.0.117]:5701 [dev] [3.4.2] Initializing cluster partition table first arrangement...
15:29:55,825 INFO  [com.hazelcast.util.HealthMonitor] (hz._hzInstance_1_dev.HealthMonitor) [192.168.0.117]:5701 [dev] [3.4.2] processors=8, physical.memory.total=7,9G, physical.memory.free=1,5G, swap.space.total=21,3G, swap.space.free=3,5G, heap.memory.used=763,3M, heap.memory.free=260,7M, heap.memory.total=1024,0M, heap.memory.max=1024,0M, heap.memory.used/total=74,54%, heap.memory.used/max=74,54%, minor.gc.count=12, minor.gc.time=584ms, major.gc.count=0, major.gc.time=0ms, load.process=1,00%, load.system=11,00%, load.systemAverage=-100,00%, thread.count=417, thread.peakCount=417, event.q.size=0, executor.q.async.size=0, executor.q.client.size=0, executor.q.query.size=0, executor.q.scheduled.size=0, executor.q.io.size=0, executor.q.system.size=0, executor.q.operation.size=0, executor.q.priorityOperation.size=0, executor.q.response.size=0, operations.remote.size=0, operations.running.size=0, proxy.count=1, clientEndpoint.count=0, connection.active.count=0, client.connection.count=0, connection.count=0
15:30:17,196 SEVERE [javax.enterprise.resource.webcontainer.jsf.application] (default task-107) Error Rendering View[/login.xhtml]: com.hazelcast.nio.serialization.HazelcastSerializationException: java.io.NotSerializableException: java.util.WeakHashMap
    at com.hazelcast.nio.serialization.SerializationServiceImpl.handleException(SerializationServiceImpl.java:419) [hazelcast-all-3.4.2.jar:3.4.2]
    at com.hazelcast.nio.serialization.SerializationServiceImpl.toData(SerializationServiceImpl.java:224) [hazelcast-all-3.4.2.jar:3.4.2]
    at com.hazelcast.nio.serialization.SerializationServiceImpl.toData(SerializationServiceImpl.java:203) [hazelcast-all-3.4.2.jar:3.4.2]
    at com.hazelcast.map.impl.AbstractMapServiceContextSupport.toData(AbstractMapServiceContextSupport.java:68) [hazelcast-all-3.4.2.jar:3.4.2]
    at com.hazelcast.map.impl.DefaultMapServiceContext.toData(DefaultMapServiceContext.java:28) [hazelcast-all-3.4.2.jar:3.4.2]
    at com.hazelcast.map.impl.proxy.MapProxySupport.toData(MapProxySupport.java:1042) [hazelcast-all-3.4.2.jar:3.4.2]
    at com.hazelcast.map.impl.proxy.MapProxyImpl.set(MapProxyImpl.java:195) [hazelcast-all-3.4.2.jar:3.4.2]
    at com.hazelcast.map.impl.proxy.MapProxyImpl.set(MapProxyImpl.java:183) [hazelcast-all-3.4.2.jar:3.4.2]
    at com.hazelcast.web.WebFilter$HazelcastHttpSession.setAttribute(WebFilter.java:759) [hazelcast-all-3.4.2.jar:3.4.2]
    at com.sun.faces.context.SessionMap.put(SessionMap.java:143) [jsf-impl-2.2.8-jbossorg-1.jar:]
    at com.sun.faces.context.SessionMap.put(SessionMap.java:61) [jsf-impl-2.2.8-jbossorg-1.jar:]
    at kz.astonline.ehospital.spring.scope.ViewScope.registerDestructionCallback(ViewScope.java:80) [classes:]
    at org.springframework.beans.factory.support.AbstractBeanFactory.registerDisposableBeanIfNecessary(AbstractBeanFactory.java:1575) [spring-beans-4.1.6.RELEASE.jar:4.1.6.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:580) [spring-beans-4.1.6.RELEASE.jar:4.1.6.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:476) [spring-beans-4.1.6.RELEASE.jar:4.1.6.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory$2.getObject(AbstractBeanFactory.java:342) [spring-beans-4.1.6.RELEASE.jar:4.1.6.RELEASE]
    at kz.astonline.ehospital.spring.scope.ViewScope.get(ViewScope.java:33) [classes:]
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:337) [spring-beans-4.1.6.RELEASE.jar:4.1.6.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194) [spring-beans-4.1.6.RELEASE.jar:4.1.6.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:956) [spring-context-4.1.6.RELEASE.jar:4.1.6.RELEASE]
    at org.springframework.beans.factory.access.el.SpringBeanELResolver.getValue(SpringBeanELResolver.java:55) [spring-beans-4.1.6.RELEASE.jar:4.1.6.RELEASE]
    at com.sun.faces.el.DemuxCompositeELResolver._getValue(DemuxCompositeELResolver.java:176) [jsf-impl-2.2.8-jbossorg-1.jar:]
    at com.sun.faces.el.DemuxCompositeELResolver.getValue(DemuxCompositeELResolver.java:203) [jsf-impl-2.2.8-jbossorg-1.jar:]
    at com.sun.el.parser.AstIdentifier.getValue(AstIdentifier.java:116) [javax.el-3.0.1-b05.jar:]
    at com.sun.el.parser.AstValue.getBase(AstValue.java:151) [javax.el-3.0.1-b05.jar:]
    at com.sun.el.parser.AstValue.getValue(AstValue.java:200) [javax.el-3.0.1-b05.jar:]
    at com.sun.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:226) [javax.el-3.0.1-b05.jar:]
    at org.jboss.weld.el.WeldValueExpression.getValue(WeldValueExpression.java:50) [weld-core-impl-2.2.6.Final.jar:2014-10-03 10:05]
    at org.jboss.weld.el.WeldValueExpression.getValue(WeldValueExpression.java:50) [weld-core-impl-2.2.6.Final.jar:2014-10-03 10:05]
    at com.sun.faces.facelets.el.TagValueExpression.getValue(TagValueExpression.java:109) [jsf-impl-2.2.8-jbossorg-1.jar:]
    at javax.faces.component.ComponentStateHelper.eval(ComponentStateHelper.java:194) [jboss-jsf-api_2.2_spec-2.2.8.jar:2.2.8]
    at javax.faces.component.ComponentStateHelper.eval(ComponentStateHelper.java:182) [jboss-jsf-api_2.2_spec-2.2.8.jar:2.2.8]
    at javax.faces.component.UIOutput.getValue(UIOutput.java:174) [jboss-jsf-api_2.2_spec-2.2.8.jar:2.2.8]
    at javax.faces.component.UIInput.getValue(UIInput.java:291) [jboss-jsf-api_2.2_spec-2.2.8.jar:2.2.8]
    at org.primefaces.util.ComponentUtils.getValueToRender(ComponentUtils.java:77) [primefaces-5.1.jar:5.1]
    at org.primefaces.component.inputtext.InputTextRenderer.encodeMarkup(InputTextRenderer.java:71) [primefaces-5.1.jar:5.1]
    at org.primefaces.component.inputtext.InputTextRenderer.encodeEnd(InputTextRenderer.java:52) [primefaces-5.1.jar:5.1]
    at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:919) [jboss-jsf-api_2.2_spec-2.2.8.jar:2.2.8]
    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1863) [jboss-jsf-api_2.2_spec-2.2.8.jar:2.2.8]
    at javax.faces.render.Renderer.encodeChildren(Renderer.java:176) [jboss-jsf-api_2.2_spec-2.2.8.jar:2.2.8]
    at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:889) [jboss-jsf-api_2.2_spec-2.2.8.jar:2.2.8]
    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1856) [jboss-jsf-api_2.2_spec-2.2.8.jar:2.2.8]
    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1859) [jboss-jsf-api_2.2_spec-2.2.8.jar:2.2.8]
    at com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:456) [jsf-impl-2.2.8-jbossorg-1.jar:]
    at com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:133) [jsf-impl-2.2.8-jbossorg-1.jar:]
    at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:337) [jboss-jsf-api_2.2_spec-2.2.8.jar:2.2.8]
    at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:337) [jboss-jsf-api_2.2_spec-2.2.8.jar:2.2.8]
    at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:337) [jboss-jsf-api_2.2_spec-2.2.8.jar:2.2.8]
    at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:337) [jboss-jsf-api_2.2_spec-2.2.8.jar:2.2.8]
    at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:337) [jboss-jsf-api_2.2_spec-2.2.8.jar:2.2.8]
    at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:337) [jboss-jsf-api_2.2_spec-2.2.8.jar:2.2.8]
    at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:120) [jsf-impl-2.2.8-jbossorg-1.jar:]
    at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101) [jsf-impl-2.2.8-jbossorg-1.jar:]
    at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:219) [jsf-impl-2.2.8-jbossorg-1.jar:]
    at javax.faces.webapp.FacesServlet.service(FacesServlet.java:647) [jboss-jsf-api_2.2_spec-2.2.8.jar:2.2.8]
    at io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:85) [undertow-servlet-1.1.0.Final.jar:1.1.0.Final]
    at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:130) [undertow-servlet-1.1.0.Final.jar:1.1.0.Final]
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330) [spring-security-web-3.2.7.RELEASE.jar:3.2.7.RELEASE]
    at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:118) [spring-security-web-3.2.7.RELEASE.jar:3.2.7.RELEASE]
    at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:84) [spring-security-web-3.2.7.RELEASE.jar:3.2.7.RELEASE]
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) [spring-security-web-3.2.7.RELEASE.jar:3.2.7.RELEASE]
    at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:113) [spring-security-web-3.2.7.RELEASE.jar:3.2.7.RELEASE]
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) [spring-security-web-3.2.7.RELEASE.jar:3.2.7.RELEASE]
    at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:103) [spring-security-web-3.2.7.RELEASE.jar:3.2.7.RELEASE]
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) [spring-security-web-3.2.7.RELEASE.jar:3.2.7.RELEASE]
    at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:113) [spring-security-web-3.2.7.RELEASE.jar:3.2.7.RELEASE]
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) [spring-security-web-3.2.7.RELEASE.jar:3.2.7.RELEASE]
    at org.springframework.security.web.authentication.rememberme.RememberMeAuthenticationFilter.doFilter(RememberMeAuthenticationFilter.java:139) [spring-security-web-3.2.7.RELEASE.jar:3.2.7.RELEASE]
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) [spring-security-web-3.2.7.RELEASE.jar:3.2.7.RELEASE]
    at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:154) [spring-security-web-3.2.7.RELEASE.jar:3.2.7.RELEASE]
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) [spring-security-web-3.2.7.RELEASE.jar:3.2.7.RELEASE]
    at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:45) [spring-security-web-3.2.7.RELEASE.jar:3.2.7.RELEASE]
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) [spring-security-web-3.2.7.RELEASE.jar:3.2.7.RELEASE]
    at org.springframework.security.web.authentication.www.BasicAuthenticationFilter.doFilter(BasicAuthenticationFilter.java:150) [spring-security-web-3.2.7.RELEASE.jar:3.2.7.RELEASE]
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) [spring-security-web-3.2.7.RELEASE.jar:3.2.7.RELEASE]
    at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:199) [spring-security-web-3.2.7.RELEASE.jar:3.2.7.RELEASE]
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) [spring-security-web-3.2.7.RELEASE.jar:3.2.7.RELEASE]
    at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:110) [spring-security-web-3.2.7.RELEASE.jar:3.2.7.RELEASE]
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) [spring-security-web-3.2.7.RELEASE.jar:3.2.7.RELEASE]
    at org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:50) [spring-security-web-3.2.7.RELEASE.jar:3.2.7.RELEASE]
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-4.1.6.RELEASE.jar:4.1.6.RELEASE]
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) [spring-security-web-3.2.7.RELEASE.jar:3.2.7.RELEASE]
    at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:87) [spring-security-web-3.2.7.RELEASE.jar:3.2.7.RELEASE]
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) [spring-security-web-3.2.7.RELEASE.jar:3.2.7.RELEASE]
    at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:192) [spring-security-web-3.2.7.RELEASE.jar:3.2.7.RELEASE]
    at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:160) [spring-security-web-3.2.7.RELEASE.jar:3.2.7.RELEASE]
    at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:344) [spring-web-4.1.6.RELEASE.jar:4.1.6.RELEASE]
    at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:261) [spring-web-4.1.6.RELEASE.jar:4.1.6.RELEASE]
    at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:60) [undertow-servlet-1.1.0.Final.jar:1.1.0.Final]
    at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:132) [undertow-servlet-1.1.0.Final.jar:1.1.0.Final]
    at com.hazelcast.web.WebFilter.doFilter(WebFilter.java:463) [hazelcast-all-3.4.2.jar:3.4.2]
    at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:60) [undertow-servlet-1.1.0.Final.jar:1.1.0.Final]
    at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:132) [undertow-servlet-1.1.0.Final.jar:1.1.0.Final]
    at io.undertow.servlet.handlers.FilterHandler.handleRequest(FilterHandler.java:85) [undertow-servlet-1.1.0.Final.jar:1.1.0.Final]
    at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:61) [undertow-servlet-1.1.0.Final.jar:1.1.0.Final]
    at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36) [undertow-servlet-1.1.0.Final.jar:1.1.0.Final]
    at org.wildfly.extension.undertow.security.SecurityContextAssociationHandler.handleRequest(SecurityContextAssociationHandler.java:78)
    at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43) [undertow-core-1.1.0.Final.jar:1.1.0.Final]
    at io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:131) [undertow-servlet-1.1.0.Final.jar:1.1.0.Final]
    at io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:56) [undertow-servlet-1.1.0.Final.jar:1.1.0.Final]
    at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43) [undertow-core-1.1.0.Final.jar:1.1.0.Final]
    at io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:45) [undertow-core-1.1.0.Final.jar:1.1.0.Final]
    at io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:63) [undertow-servlet-1.1.0.Final.jar:1.1.0.Final]
    at io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:58) [undertow-core-1.1.0.Final.jar:1.1.0.Final]
    at io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:70) [undertow-servlet-1.1.0.Final.jar:1.1.0.Final]
    at io.undertow.security.handlers.SecurityInitialHandler.handleRequest(SecurityInitialHandler.java:76) [undertow-core-1.1.0.Final.jar:1.1.0.Final]
    at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43) [undertow-core-1.1.0.Final.jar:1.1.0.Final]
    at org.wildfly.extension.undertow.security.jacc.JACCContextIdHandler.handleRequest(JACCContextIdHandler.java:61)
    at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43) [undertow-core-1.1.0.Final.jar:1.1.0.Final]
    at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43) [undertow-core-1.1.0.Final.jar:1.1.0.Final]
    at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:261) [undertow-servlet-1.1.0.Final.jar:1.1.0.Final]
    at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:247) [undertow-servlet-1.1.0.Final.jar:1.1.0.Final]
    at io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:76) [undertow-servlet-1.1.0.Final.jar:1.1.0.Final]
    at io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:166) [undertow-servlet-1.1.0.Final.jar:1.1.0.Final]
    at io.undertow.server.Connectors.executeRootHandler(Connectors.java:197) [undertow-core-1.1.0.Final.jar:1.1.0.Final]
    at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:759) [undertow-core-1.1.0.Final.jar:1.1.0.Final]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [rt.jar:1.8.0_45]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [rt.jar:1.8.0_45]
    at java.lang.Thread.run(Unknown Source) [rt.jar:1.8.0_45]
Caused by: java.io.NotSerializableException: java.util.WeakHashMap
    at java.io.ObjectOutputStream.writeObject0(Unknown Source) [rt.jar:1.8.0_45]
    at java.io.ObjectOutputStream.defaultWriteFields(Unknown Source) [rt.jar:1.8.0_45]
    at java.io.ObjectOutputStream.writeSerialData(Unknown Source) [rt.jar:1.8.0_45]
    at java.io.ObjectOutputStream.writeOrdinaryObject(Unknown Source) [rt.jar:1.8.0_45]
    at java.io.ObjectOutputStream.writeObject0(Unknown Source) [rt.jar:1.8.0_45]
    at java.io.ObjectOutputStream.writeObject(Unknown Source) [rt.jar:1.8.0_45]
    at com.hazelcast.nio.serialization.DefaultSerializers$ObjectSerializer.write(DefaultSerializers.java:216) [hazelcast-all-3.4.2.jar:3.4.2]
    at com.hazelcast.nio.serialization.StreamSerializerAdapter.toData(StreamSerializerAdapter.java:51) [hazelcast-all-3.4.2.jar:3.4.2]
    at com.hazelcast.nio.serialization.SerializationServiceImpl.toData(SerializationServiceImpl.java:222) [hazelcast-all-3.4.2.jar:3.4.2]
    ... 117 more

我无法摆脱这些错误。任何人都可以提出任何建议吗?

4

1 回答 1

1

java.util.WeakHashMap 不是 java.util.Serializable。所以你唯一的选择是为它编写一个 Hazelcast StreamSerializer 并在序列化地图之前在 Hazelcast 中配置这个序列化器。

于 2015-06-12T14:35:57.740 回答