You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@shiro.apache.org by "General.X.Hummel (JIRA)" <ji...@apache.org> on 2015/10/30 04:10:27 UTC

[jira] [Commented] (SHIRO-323) DelegatingSubject class cannot be serialized.

    [ https://issues.apache.org/jira/browse/SHIRO-323?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14981803#comment-14981803 ] 

General.X.Hummel commented on SHIRO-323:
----------------------------------------

Dear Les:
        I have encountered this problem when tried to serialize the Subject object in my application.I am developing an distributed application,and the Subject will generate at the Provider end,then I restore it in redis and in Consumer end find it use sessionId.
but when debugging I get an Exception says DelegatingSubject cannot be serialized...I have tried to decrease the version of Shiro to 1.0.0-incubating,whose Subject had implemented the Java.io.Serizlizable interface so that can be serialized.But I find its contents seems not complete  in redis server,can you give me some advices,I will very appreciate it !Lookkkkkking forward to your reply!


> DelegatingSubject class cannot be serialized.
> ---------------------------------------------
>
>                 Key: SHIRO-323
>                 URL: https://issues.apache.org/jira/browse/SHIRO-323
>             Project: Shiro
>          Issue Type: Bug
>          Components: Subject
>    Affects Versions: 1.1.0
>         Environment: Linux
>            Reporter: Michael Yara
>            Assignee: Les Hazlewood
>              Labels: serialization
>             Fix For: 1.2.0
>
>
> I am attempting to send a instance of DelegatingSubject over a JMS topic via serialization, however when I send the object through JMS I get this Exception
> java.lang.RuntimeException: org.apache.shiro.subject.support.DelegatingSubject$StoppingAwareProxiedSession
> 	at org.apache.activemq.command.ActiveMQObjectMessage.storeContent(ActiveMQObjectMessage.java:111) ~[activemq-all-5.6-SNAPSHOT.jar:5.6-SNAPSHOT]
> 	at org.apache.activemq.command.ActiveMQObjectMessage.setObject(ActiveMQObjectMessage.java:162) ~[activemq-all-5.6-SNAPSHOT.jar:5.6-SNAPSHOT]
> 	at com.xmlnamespace.panel.server.core.communication.event.EventManager.doSendMessage(EventManager.java:233) ~[com.xmlnamespace.panel.server.core/:na]
> 	at com.xmlnamespace.panel.server.core.communication.event.EventManager.sendMessage(EventManager.java:208) ~[com.xmlnamespace.panel.server.core/:na]
> 	at com.xmlnamespace.panel.server.core.communication.mtl.ModelDispatcher.add(ModelDispatcher.java:122) ~[com.xmlnamespace.panel.server.core/:na]
> 	at com.xmlnamespace.panel.server.core.communication.mtl.ModelDispatcher.collectionChange(ModelDispatcher.java:181) ~[com.xmlnamespace.panel.server.core/:na]
> 	at com.xmlnamespace.panel.core.shared.communication.mtl.api.CollectionChangeSupport.doFireCollectionChange(CollectionChangeSupport.java:182) ~[shared-objects.jar:na]
> 	at com.xmlnamespace.panel.core.shared.communication.mtl.api.CollectionChangeSupport.fireCollectionChange(CollectionChangeSupport.java:47) ~[shared-objects.jar:na]
> 	at com.xmlnamespace.panel.core.shared.user.model.internal.UserModelImpl.addUserLogin(UserModelImpl.java:96) ~[shared-objects.jar:na]
> 	at com.xmlnamespace.panel.server.core.login.LoginManager.authenticateConnection(LoginManager.java:1013) ~[com.xmlnamespace.panel.server.core/:na]
> 	at com.xmlnamespace.panel.server.core.communication.broker.BrokerAuthenticationFilter.addConnection(BrokerAuthenticationFilter.java:69) ~[com.xmlnamespace.panel.server.core/:na]
> 	at org.apache.activemq.broker.MutableBrokerFilter.addConnection(MutableBrokerFilter.java:91) [activemq-all-5.6-SNAPSHOT.jar:5.6-SNAPSHOT]
> 	at org.apache.activemq.broker.TransportConnection.processAddConnection(TransportConnection.java:705) [activemq-all-5.6-SNAPSHOT.jar:5.6-SNAPSHOT]
> 	at org.apache.activemq.broker.jmx.ManagedTransportConnection.processAddConnection(ManagedTransportConnection.java:83) [activemq-all-5.6-SNAPSHOT.jar:5.6-SNAPSHOT]
> 	at org.apache.activemq.command.ConnectionInfo.visit(ConnectionInfo.java:139) [activemq-all-5.6-SNAPSHOT.jar:5.6-SNAPSHOT]
> 	at org.apache.activemq.broker.TransportConnection.service(TransportConnection.java:316) [activemq-all-5.6-SNAPSHOT.jar:5.6-SNAPSHOT]
> 	at org.apache.activemq.broker.TransportConnection$1.onCommand(TransportConnection.java:180) [activemq-all-5.6-SNAPSHOT.jar:5.6-SNAPSHOT]
> 	at org.apache.activemq.transport.TransportFilter.onCommand(TransportFilter.java:69) [activemq-all-5.6-SNAPSHOT.jar:5.6-SNAPSHOT]
> 	at org.apache.activemq.transport.WireFormatNegotiator.onCommand(WireFormatNegotiator.java:113) [activemq-all-5.6-SNAPSHOT.jar:5.6-SNAPSHOT]
> 	at org.apache.activemq.transport.InactivityMonitor.onCommand(InactivityMonitor.java:227) [activemq-all-5.6-SNAPSHOT.jar:5.6-SNAPSHOT]
> 	at org.apache.activemq.transport.TransportSupport.doConsume(TransportSupport.java:83) [activemq-all-5.6-SNAPSHOT.jar:5.6-SNAPSHOT]
> 	at org.apache.activemq.transport.tcp.SslTransport.doConsume(SslTransport.java:91) [activemq-all-5.6-SNAPSHOT.jar:5.6-SNAPSHOT]
> 	at org.apache.activemq.transport.tcp.TcpTransport.doRun(TcpTransport.java:217) [activemq-all-5.6-SNAPSHOT.jar:5.6-SNAPSHOT]
> 	at org.apache.activemq.transport.tcp.TcpTransport.run(TcpTransport.java:199) [activemq-all-5.6-SNAPSHOT.jar:5.6-SNAPSHOT]
> 	at java.lang.Thread.run(Thread.java:662) [na:1.6.0_26]
> Caused by: java.io.NotSerializableException: org.apache.shiro.subject.support.DelegatingSubject$StoppingAwareProxiedSession
> 	at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1164) ~[na:1.6.0_26]
> 	at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1518) ~[na:1.6.0_26]
> 	at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1483) ~[na:1.6.0_26]
> 	at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1400) ~[na:1.6.0_26]
> 	at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1158) ~[na:1.6.0_26]
> 	at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1518) ~[na:1.6.0_26]
> 	at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1483) ~[na:1.6.0_26]
> 	at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1400) ~[na:1.6.0_26]
> 	at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1158) ~[na:1.6.0_26]
> 	at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:330) ~[na:1.6.0_26]
> 	at org.apache.activemq.command.ActiveMQObjectMessage.storeContent(ActiveMQObjectMessage.java:105) ~[activemq-all-5.6-SNAPSHOT.jar:5.6-SNAPSHOT]
> 	... 24 common frames omitted
> I assume that DelegatingSubject is meant to be serialized since it does implement serializable. I noticed that the class inner class StoppingAwareProxiedSession is the culprit. Would the issue be resolved by simply making the Session interface, ProxiedSession class, and StoppingAwareProxiedSession serializable? 



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)