开发者

Application throws NotSerializableException when run on an jboss cluster

开发者 https://www.devze.com 2023-01-03 15:12 出处:网络
Environment: JBoss 5.1.0, JBoss Seam 2.2.0 While trying to get my application running in a clustered environment after login I am getting the following exception. Post login we try to store the curr

Environment: JBoss 5.1.0, JBoss Seam 2.2.0

While trying to get my application running in a clustered environment after login I am getting the following exception. Post login we try to store the currentUser in jboss seam session context.

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

How to resolve this?

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.jb开发者_如何学Pythonoss.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)


Perhaps you need to implement Serializable on your classes


I know this question is really old, and that the development of Seam Framework has halted. But in case of legacy systems where Seam really is in use, here is the reason for the exception:

This was a known bug in Seam 2.2.2.Final, so it also applies to 2.2.0:

Class changes required to make JpaIdentityStore clusterable (see Patch.diff.txt):
src/main/org/jboss/seam/security/permission/EntityIdentifierStrategy.java
src/main/org/jboss/seam/security/permission/IdentifierPolicy.java
src/main/org/jboss/seam/security/permission/PermissionMetadata.java
src/main/org/jboss/seam/security/permission/ClassIdentifierStrategy.java
src/main/org/jboss/seam/util/AnnotatedBeanProperty.java

So it is not a bug in your code, but in the framework.

The way to resolve this is, of course, to use Seam 2.2.2.Final or above, or to patch it yourself.

A quick look at the current Seam 2 source code for the class verifies that the bug has been fixed:

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

精彩评论

暂无评论...
验证码 换一张
取 消