在jboss集群上运行时,应用程序抛出NotSerializableException

时间:2010-06-17 11:15:24

标签: java jboss cluster-computing seam jboss5.x

环境:JBoss 5.1.0,JBoss Seam 2.2.0

尝试在登录后尝试让我的应用程序在群集环境中运行时,我收到以下异常。登录后我们尝试将currentUser存储在jboss seam会话上下文中。

java.io.NotSerializableException: org.jboss.seam.util.AnnotatedBeanProperty

如何解决这个问题?

java.io.NotSerializableException: org.jboss.seam.util.AnnotatedBeanProperty
        at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1156)

        at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java
:1509)
        at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:14
74)
        at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.jav
a:1392)
        at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150)

        at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java
:1509)
        at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:14
74)
        at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.jav
a:1392)
        at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150)

        at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:326)
        at java.util.ArrayList.writeObject(ArrayList.java:570)
        at sun.reflect.GeneratedMethodAccessor339.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:94
5)
        at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:14
61)
        at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.jav
a:1392)
        at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150)

        at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java
:1509)
        at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:14
74)
        at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.jav
a:1392)
        at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150)

        at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:326)
        at java.util.HashMap.writeObject(HashMap.java:1001)
        at sun.reflect.GeneratedMethodAccessor338.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:94
5)
        at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:14
61)
        at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.jav
a:1392)
        at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150)

        at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:326)
        at org.jboss.ha.framework.server.SimpleCachableMarshalledValue.serialize
(SimpleCachableMarshalledValue.java:271)
        at org.jboss.ha.framework.server.SimpleCachableMarshalledValue.writeExte
rnal(SimpleCachableMarshalledValue.java:252)
        at java.io.ObjectOutputStream.writeExternalData(ObjectOutputStream.java:
1421)
        at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.jav
a:1390)
        at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150)

        at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:326)
        at org.jboss.cache.marshall.CacheMarshaller200.marshallObject(CacheMarsh
aller200.java:460)
        at org.jboss.cache.marshall.CacheMarshaller300.marshallObject(CacheMarsh
aller300.java:47)
        at org.jboss.cache.marshall.CacheMarshaller200.marshallMap(CacheMarshall
er200.java:569)
        at org.jboss.cache.marshall.CacheMarshaller200.marshallObject(CacheMarsh
aller200.java:370)
        at org.jboss.cache.marshall.CacheMarshaller300.marshallObject(CacheMarsh
aller300.java:47)
        at org.jboss.cache.marshall.CacheMarshaller200.marshallCommand(CacheMars
haller200.java:519)
        at org.jboss.cache.marshall.CacheMarshaller200.marshallObject(CacheMarsh
aller200.java:314)
        at org.jboss.cache.marshall.CacheMarshaller300.marshallObject(CacheMarsh
aller300.java:47)
        at org.jboss.cache.marshall.CacheMarshaller200.marshallCommand(CacheMars
haller200.java:519)
        at org.jboss.cache.marshall.CacheMarshaller200.marshallObject(CacheMarsh
aller200.java:314)
        at org.jboss.cache.marshall.CacheMarshaller300.marshallObject(CacheMarsh
aller300.java:47)
        at org.jboss.cache.marshall.CacheMarshaller200.objectToObjectStream(Cach
eMarshaller200.java:191)
        at org.jboss.cache.marshall.CacheMarshaller200.objectToObjectStream(Cach
eMarshaller200.java:136)
        at org.jboss.cache.marshall.VersionAwareMarshaller.objectToBuffer(Versio
nAwareMarshaller.java:182)
        at org.jboss.cache.marshall.VersionAwareMarshaller.objectToBuffer(Versio
nAwareMarshaller.java:52)
        at org.jboss.cache.marshall.CommandAwareRpcDispatcher$ReplicationTask.ca
ll(CommandAwareRpcDispatcher.java:369)
        at org.jboss.cache.marshall.CommandAwareRpcDispatcher$ReplicationTask.ca
ll(CommandAwareRpcDispatcher.java:341)
        at org.jboss.cache.util.concurrent.WithinThreadExecutor.submit(WithinThr
eadExecutor.java:82)
        at org.jboss.cache.marshall.CommandAwareRpcDispatcher.invokeRemoteComman
ds(CommandAwareRpcDispatcher.java:206)
        at org.jboss.cache.RPCManagerImpl.callRemoteMethods(RPCManagerImpl.java:
748)
        at org.jboss.cache.RPCManagerImpl.callRemoteMethods(RPCManagerImpl.java:
716)
        at org.jboss.cache.RPCManagerImpl.callRemoteMethods(RPCManagerImpl.java:
721)
        at org.jboss.cache.interceptors.BaseRpcInterceptor.replicateCall(BaseRpc
Interceptor.java:161)
        at org.jboss.cache.interceptors.BaseRpcInterceptor.replicateCall(BaseRpc
Interceptor.java:135)
        at org.jboss.cache.interceptors.BaseRpcInterceptor.replicateCall(BaseRpc
Interceptor.java:107)
        at org.jboss.cache.interceptors.ReplicationInterceptor.handleCrudMethod(
ReplicationInterceptor.java:160)
        at org.jboss.cache.interceptors.ReplicationInterceptor.visitPutDataMapCo
mmand(ReplicationInterceptor.java:113)
        at org.jboss.cache.commands.write.PutDataMapCommand.acceptVisitor(PutDat
aMapCommand.java:104)
        at org.jboss.cache.interceptors.base.CommandInterceptor.invokeNextInterc
eptor(CommandInterceptor.java:116)
        at org.jboss.cache.interceptors.base.CommandInterceptor.handleDefault(Co
mmandInterceptor.java:131)
        at org.jboss.cache.commands.AbstractVisitor.visitPutDataMapCommand(Abstr
actVisitor.java:60)
        at org.jboss.cache.commands.write.PutDataMapCommand.acceptVisitor(PutDat
aMapCommand.java:104)
        at org.jboss.cache.interceptors.base.CommandInterceptor.invokeNextInterc
eptor(CommandInterceptor.java:116)
        at org.jboss.cache.interceptors.TxInterceptor.attachGtxAndPassUpChain(Tx
Interceptor.java:301)
        at org.jboss.cache.interceptors.TxInterceptor.handleDefault(TxIntercepto
r.java:283)
        at org.jboss.cache.commands.AbstractVisitor.visitPutDataMapCommand(Abstr
actVisitor.java:60)
        at org.jboss.cache.commands.write.PutDataMapCommand.acceptVisitor(PutDat
aMapCommand.java:104)
        at org.jboss.cache.interceptors.base.CommandInterceptor.invokeNextInterc
eptor(CommandInterceptor.java:116)
        at org.jboss.cache.interceptors.CacheMgmtInterceptor.visitPutDataMapComm
and(CacheMgmtInterceptor.java:97)
        at org.jboss.cache.commands.write.PutDataMapCommand.acceptVisitor(PutDat
aMapCommand.java:104)
        at org.jboss.cache.interceptors.base.CommandInterceptor.invokeNextInterc
eptor(CommandInterceptor.java:116)
        at org.jboss.cache.interceptors.InvocationContextInterceptor.handleAll(I
nvocationContextInterceptor.java:178)
        at org.jboss.cache.interceptors.InvocationContextInterceptor.visitPutDat
aMapCommand(InvocationContextInterceptor.java:64)
        at org.jboss.cache.commands.write.PutDataMapCommand.acceptVisitor(PutDat
aMapCommand.java:104)
        at org.jboss.cache.interceptors.InterceptorChain.invoke(InterceptorChain
.java:287)
        at org.jboss.cache.invocation.CacheInvocationDelegate.invokePut(CacheInv
ocationDelegate.java:705)
        at org.jboss.cache.invocation.CacheInvocationDelegate.put(CacheInvocatio
nDelegate.java:519)
        at org.jboss.ha.cachemanager.CacheManagerManagedCache.put(CacheManagerMa
nagedCache.java:277)
        at org.jboss.web.tomcat.service.session.distributedcache.impl.jbc.JBossC
acheWrapper.put(JBossCacheWrapper.java:148)
        at org.jboss.web.tomcat.service.session.distributedcache.impl.jbc.Abstra
ctJBossCacheService.storeSessionData(AbstractJBossCacheService.java:405)
        at org.jboss.web.tomcat.service.session.ClusteredSession.processSessionR
eplication(ClusteredSession.java:1166)
        at org.jboss.web.tomcat.service.session.JBossCacheManager.processSession
Repl(JBossCacheManager.java:1937)
        at org.jboss.web.tomcat.service.session.JBossCacheManager.storeSession(J
BossCacheManager.java:309)
        at org.jboss.web.tomcat.service.session.InstantSnapshotManager.snapshot(
InstantSnapshotManager.java:51)
        at org.jboss.web.tomcat.service.session.ClusteredSessionValve.handleRequ
est(ClusteredSessionValve.java:147)
        at org.jboss.web.tomcat.service.session.ClusteredSessionValve.invoke(Clu
steredSessionValve.java:94)
        at org.jboss.web.tomcat.service.session.LockingValve.invoke(LockingValve
.java:62)
        at org.apache.catalina.authenticator.AuthenticatorBase.invoke(Authentica
torBase.java:433)
        at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValv
e.java:92)
        at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.proce
ss(SecurityContextEstablishmentValve.java:126)
        at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invok
e(SecurityContextEstablishmentValve.java:70)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.j
ava:127)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.j
ava:102)
        at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedC
onnectionValve.java:158)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineVal
ve.java:109)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.jav
a:330)
        at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java
:829)
        at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.proce
ss(Http11Protocol.java:598)
        at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:44
7)
        at java.lang.Thread.run(Thread.java:619)
16:38:35,789 ERROR [CommandAwareRpcDispatcher] java.io.NotSerializableException:
 org.jboss.seam.util.AnnotatedBeanProperty
16:38:35,789 WARN  [/a12] Failed to replicate session YwBL69cG-zdm0m5CvzNj3Q__
java.lang.RuntimeException: Failure to marshal argument(s)
        at org.jboss.cache.marshall.CommandAwareRpcDispatcher$ReplicationTask.ca
ll(CommandAwareRpcDispatcher.java:374)
        at org.jboss.cache.marshall.CommandAwareRpcDispatcher$ReplicationTask.ca
ll(CommandAwareRpcDispatcher.java:341)
        at org.jboss.cache.util.concurrent.WithinThreadExecutor.submit(WithinThr
eadExecutor.java:82)
        at org.jboss.cache.marshall.CommandAwareRpcDispatcher.invokeRemoteComman
ds(CommandAwareRpcDispatcher.java:206)
        at org.jboss.cache.RPCManagerImpl.callRemoteMethods(RPCManagerImpl.java:
748)
        at org.jboss.cache.RPCManagerImpl.callRemoteMethods(RPCManagerImpl.java:
716)
        at org.jboss.cache.RPCManagerImpl.callRemoteMethods(RPCManagerImpl.java:
721)
        at org.jboss.cache.interceptors.BaseRpcInterceptor.replicateCall(BaseRpc
Interceptor.java:161)
        at org.jboss.cache.interceptors.BaseRpcInterceptor.replicateCall(BaseRpc
Interceptor.java:135)
        at org.jboss.cache.interceptors.BaseRpcInterceptor.replicateCall(BaseRpc
Interceptor.java:107)
        at org.jboss.cache.interceptors.ReplicationInterceptor.handleCrudMethod(
ReplicationInterceptor.java:160)
        at org.jboss.cache.interceptors.ReplicationInterceptor.visitPutDataMapCo
mmand(ReplicationInterceptor.java:113)
        at org.jboss.cache.commands.write.PutDataMapCommand.acceptVisitor(PutDat
aMapCommand.java:104)
        at org.jboss.cache.interceptors.base.CommandInterceptor.invokeNextInterc
eptor(CommandInterceptor.java:116)
        at org.jboss.cache.interceptors.base.CommandInterceptor.handleDefault(Co
mmandInterceptor.java:131)
        at org.jboss.cache.commands.AbstractVisitor.visitPutDataMapCommand(Abstr
actVisitor.java:60)
        at org.jboss.cache.commands.write.PutDataMapCommand.acceptVisitor(PutDat
aMapCommand.java:104)
        at org.jboss.cache.interceptors.base.CommandInterceptor.invokeNextInterc
eptor(CommandInterceptor.java:116)
        at org.jboss.cache.interceptors.TxInterceptor.attachGtxAndPassUpChain(Tx
Interceptor.java:301)
        at org.jboss.cache.interceptors.TxInterceptor.handleDefault(TxIntercepto
r.java:283)
        at org.jboss.cache.commands.AbstractVisitor.visitPutDataMapCommand(Abstr
actVisitor.java:60)
        at org.jboss.cache.commands.write.PutDataMapCommand.acceptVisitor(PutDat
aMapCommand.java:104)
        at org.jboss.cache.interceptors.base.CommandInterceptor.invokeNextInterc
eptor(CommandInterceptor.java:116)
        at org.jboss.cache.interceptors.CacheMgmtInterceptor.visitPutDataMapComm
and(CacheMgmtInterceptor.java:97)
        at org.jboss.cache.commands.write.PutDataMapCommand.acceptVisitor(PutDat
aMapCommand.java:104)
        at org.jboss.cache.interceptors.base.CommandInterceptor.invokeNextInterc
eptor(CommandInterceptor.java:116)
        at org.jboss.cache.interceptors.InvocationContextInterceptor.handleAll(I
nvocationContextInterceptor.java:178)
        at org.jboss.cache.interceptors.InvocationContextInterceptor.visitPutDat
aMapCommand(InvocationContextInterceptor.java:64)
        at org.jboss.cache.commands.write.PutDataMapCommand.acceptVisitor(PutDat
aMapCommand.java:104)
        at org.jboss.cache.interceptors.InterceptorChain.invoke(InterceptorChain
.java:287)
        at org.jboss.cache.invocation.CacheInvocationDelegate.invokePut(CacheInv
ocationDelegate.java:705)
        at org.jboss.cache.invocation.CacheInvocationDelegate.put(CacheInvocatio
nDelegate.java:519)
        at org.jboss.ha.cachemanager.CacheManagerManagedCache.put(CacheManagerMa
nagedCache.java:277)
        at org.jboss.web.tomcat.service.session.distributedcache.impl.jbc.JBossC
acheWrapper.put(JBossCacheWrapper.java:148)
        at org.jboss.web.tomcat.service.session.distributedcache.impl.jbc.Abstra
ctJBossCacheService.storeSessionData(AbstractJBossCacheService.java:405)
        at org.jboss.web.tomcat.service.session.ClusteredSession.processSessionR
eplication(ClusteredSession.java:1166)
        at org.jboss.web.tomcat.service.session.JBossCacheManager.processSession
Repl(JBossCacheManager.java:1937)
        at org.jboss.web.tomcat.service.session.JBossCacheManager.storeSession(J
BossCacheManager.java:309)
        at org.jboss.web.tomcat.service.session.InstantSnapshotManager.snapshot(
InstantSnapshotManager.java:51)
        at org.jboss.web.tomcat.service.session.ClusteredSessionValve.handleRequ
est(ClusteredSessionValve.java:147)
        at org.jboss.web.tomcat.service.session.ClusteredSessionValve.invoke(Clu
steredSessionValve.java:94)
        at org.jboss.web.tomcat.service.session.LockingValve.invoke(LockingValve
.java:62)
        at org.apache.catalina.authenticator.AuthenticatorBase.invoke(Authentica
torBase.java:433)
        at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValv
e.java:92)
        at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.proce
ss(SecurityContextEstablishmentValve.java:126)
        at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invok
e(SecurityContextEstablishmentValve.java:70)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.j
ava:127)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.j
ava:102)
        at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedC
onnectionValve.java:158)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineVal
ve.java:109)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.jav
a:330)
        at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java
:829)
        at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.proce
ss(Http11Protocol.java:598)
        at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:44
7)
        at java.lang.Thread.run(Thread.java:619)

2 个答案:

答案 0 :(得分:0)

也许您需要在课程上implement Serializable

答案 1 :(得分:0)

我知道这个问题真的很老了,Seam Framework的开发已经停止了。但是对于Seam真正使用的遗留系统,以下是例外的原因:

这是Seam 2.2.2.Final中的known bug,所以它也适用于2.2.0:

  

使JpaIdentityStore成为可群集所需的类更改(请参阅Patch.diff.txt):
  的src / main /组织/ JBoss的/缝/安全/许可/ EntityIdentifierStrategy.java
  的src / main /组织/ JBoss的/缝/安全/许可/ IdentifierPolicy.java
  的src / main /组织/ JBoss的/缝/安全/许可/ PermissionMetadata.java
  的src / main /组织/ JBoss的/缝/安全/许可/ ClassIdentifierStrategy.java
  的的src /主/组织/ JBoss的/缝/ util的/ AnnotatedBeanProperty.java

因此,它不是代码中的错误,而是在框架中。

解决这个问题的方法当然是使用Seam 2.2.2.Final或更高版本,或者自己修补它。

快速查看该课程的当前Seam 2 source code,验证该错误是否已修复:

public class AnnotatedBeanProperty<T extends Annotation> implements Serializable
{
   private static final long serialVersionUID = 2508430507136805635L;
   .
   .
   .
}