Glassfish上的实例之间的会话复制问题

时间:2014-01-02 13:07:00

标签: java spring glassfish replication weld

我尝试使用glassfish 4在2个本地实例(在同一个集群,同一节点上)之间使用会话复制。

我按照了一些教程并在我的web.xml文件中添加了以下输入: 我还在目标(群集)上部署war文件时检查了“可用性”。

我的应用程序基于Spring + JSF2(来自javax.faces.bean的@ManagedBeans)。 (Mojarra 2.2.4,我也覆盖了GF / modules目录中的原始javax.faces.jar)。

没有焊接,没有jboss,没有谈话。

部署在glassfish管理服务器上时,一切正常,即使部署在单个实例上(其他实例关闭)也是如此。当我在部署war文件时禁用“可用性”时,它也适用于2个实例。

但是当我尝试使用本机会话复制行为时,我会得到以下跟踪,并且我的应用程序不会显示(甚至实例崩溃)。

这似乎是会话反序列化问题。

web.xml:

<context-param>
    <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
    <param-value>Same issue either with 'server' or 'client'</param-value>
</context-param>

我得到以下问题:

java.lang.ClassCastException: cannot assign instance of org.jboss.weld.context.conversation.ConversationIdGenerator to field org.springframework.aop.framework.AdvisedSupport.advisorChainFactory of type org.springframework.aop.framework.AdvisorChainFactory in instance of org.springframework.aop.framework.ProxyFactory
    at java.io.ObjectStreamClass$FieldReflector.setObjFieldValues(ObjectStreamClass.java:2083)
    at java.io.ObjectStreamClass.setObjFieldValues(ObjectStreamClass.java:1261)
    at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1995)
    at java.io.ObjectInputStream.defaultReadObject(ObjectInputStream.java:499)
    at org.springframework.aop.framework.AdvisedSupport.readObject(AdvisedSupport.java:550)
    at sun.reflect.GeneratedMethodAccessor127.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:1017)
    at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1891)
    at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1796)
    at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1348)
    at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1989)
    at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1913)
    at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1796)
    at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1348)
    at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1989)
    at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1913)
    at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1796)
    at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1348)
    at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1989)
    at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1913)
    at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1796)
    at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1348)
    at java.io.ObjectInputStream.readObject(ObjectInputStream.java:370)
    at java.util.HashMap.readObject(HashMap.java:1155)
    at sun.reflect.GeneratedMethodAccessor3.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:1017)
    at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1891)
    at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1796)
    at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1348)
    at java.io.ObjectInputStream.readObject(ObjectInputStream.java:370)
    at java.util.HashMap.readObject(HashMap.java:1155)
    at sun.reflect.GeneratedMethodAccessor3.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:1017)
    at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1891)
    at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1796)
    at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1348)
    at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1989)
    at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1913)
    at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1796)
    at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1348)
    at java.io.ObjectInputStream.readObject(ObjectInputStream.java:370)
    at org.apache.catalina.session.StandardSession.readRemainingObject(StandardSession.java:2078)
    at org.apache.catalina.session.StandardSession.readObject(StandardSession.java:1986)
    at sun.reflect.GeneratedMethodAccessor130.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:1017)
    at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1891)
    at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1796)
    at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1348)
    at java.io.ObjectInputStream.readObject(ObjectInputStream.java:370)
    at org.apache.catalina.session.StandardSession.deserialize(StandardSession.java:1272)
    at org.apache.catalina.session.StoreBase.readSession(StoreBase.java:296)
    at org.glassfish.web.ha.session.management.ReplicationStore.getSession(ReplicationStore.java:567)
    at org.glassfish.web.ha.session.management.ReplicationStore.getSession(ReplicationStore.java:519)
    at org.glassfish.web.ha.session.management.ReplicationStore.loadFromBackingStore(ReplicationStore.java:433)
    at org.glassfish.web.ha.session.management.ReplicationStore.load(ReplicationStore.java:416)
    at org.apache.catalina.session.PersistentManagerBase.doSwapIn(PersistentManagerBase.java:1215)
    at org.apache.catalina.session.PersistentManagerBase.swapIn(PersistentManagerBase.java:1175)
    at org.glassfish.web.ha.session.management.ReplicationManagerBase.findSession(ReplicationManagerBase.java:161)
    at org.apache.catalina.connector.Request.doGetSession(Request.java:3218)
    at org.apache.catalina.connector.Request.getSessionInternal(Request.java:3081)
    at org.apache.catalina.connector.Request.unlockSession(Request.java:4665)
    at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:368)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:260)
    at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:188)
    at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:191)
    at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:168)
    at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:189)
    at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
    at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:288)
    at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:206)
    at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:136)
    at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:114)
    at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)
    at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:838)
    at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:113)
    at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:115)
    at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:55)
    at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:135)
    at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:564)
    at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:544)
    at java.lang.Thread.run(Thread.java:724)

我真的不知道为什么我既没有使用JBOSS也没有使用任何对话行为(或注释)。

感谢您的帮助。

1 个答案:

答案 0 :(得分:0)

我终于找到了解决方案。

我遇到了会话序列化和反序列化的问题,因为我将@ManagedProperty附加到Spring AOP。

它与这个jboss焊接堆栈跟踪无关(我不再理解,但我仍然无法猜测这个堆栈跟踪与问题的核心有什么关系)。