A_S478
2016-11-05 10:56
采纳率: 100%
浏览 3.4k
已采纳

cas+redis集群 无法序列化,没有大神遇到吗

2016-11-05 18:52:10,409 ERROR [com.msxf.sso.ticket.RedisTicketRegistry] -
org.springframework.data.redis.serializer.SerializationException: Cannot serialize; nested exception is org.springframework.core.serializer.support.SerializationFailedException: Failed to serialize object using DefaultSerializer; nested exception is java.io.NotSerializableException: java.util.HashMap$KeySet
at org.springframework.data.redis.serializer.JdkSerializationRedisSerializer.serialize(JdkSerializationRedisSerializer.java:52)
at org.springframework.data.redis.core.AbstractOperations.rawValue(AbstractOperations.java:112)
at org.springframework.data.redis.core.DefaultValueOperations.set(DefaultValueOperations.java:180)
at com.msxf.sso.ticket.RedisTicketRegistry.addTicket(RedisTicketRegistry.java:56)
at org.jasig.cas.CentralAuthenticationServiceImpl.createTicketGrantingTicket_aroundBody10(CentralAuthenticationServiceImpl.java:538)
at org.jasig.cas.CentralAuthenticationServiceImpl.createTicketGrantingTicket_aroundBody11$advice(CentralAuthenticationServiceImpl.java:54)
at org.jasig.cas.CentralAuthenticationServiceImpl.createTicketGrantingTicket(CentralAuthenticationServiceImpl.java:1)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
at org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(MethodInvocationProceedingJoinPoint.java:80)
at com.github.inspektr.audit.AuditTrailManagementAspect.handleAuditTrail(AuditTrailManagementAspect.java:126)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)

{
"authentication": {
    "attributes": {
        "authenticationMethod": "UserAuthenticationHandler",
        "successfulAuthenticationHandlers": [
            "UserAuthenticationHandler"
        ]
    },
    "authenticatedDate": 1478326255824,
    "credentials": [
        {
            "credentialClass": "org.jasig.cas.authentication.UsernamePasswordCredential",
            "id": "292752388@qq.com"
        }
    ],
    "failures": { },
    "principal": {
        "attributes": {
            "lastLoginDate": 1478275200000,
            "email": "292752388@qq.com",
            "status": 0,
            "userId": 988,
            "registerDate": 1476269405000,
            "userName": "Paddy"
        },
        "id": "292752388@qq.com"
    },
    "successes": {
        "UserAuthenticationHandler": {
            "credentialMetaData": {
                "credentialClass": "org.jasig.cas.authentication.UsernamePasswordCredential",
                "id": "292752388@qq.com"
            },
            "handlerName": "UserAuthenticationHandler",
            "principal": {
                "attributes": { },
                "id": "292752388@qq.com"
            },
            "warnings": [ ]
        }
    }
},
"chainedAuthentications": [
    {
        "attributes": {
            "authenticationMethod": "UserAuthenticationHandler",
            "successfulAuthenticationHandlers": [
                "UserAuthenticationHandler"
            ]
        },
        "authenticatedDate": 1478326255824,
        "credentials": [
            {
                "credentialClass": "org.jasig.cas.authentication.UsernamePasswordCredential",
                "id": "292752388@qq.com"
            }
        ],
        "failures": { },
        "principal": {
            "attributes": {
                "lastLoginDate": 1478275200000,
                "email": "292752388@qq.com",
                "status": 0,
                "userId": 988,
                "registerDate": 1476269405000,
                "userName": "Paddy"
            },
            "id": "292752388@qq.com"
        },
        "successes": {
            "UserAuthenticationHandler": {
                "credentialMetaData": {
                    "credentialClass": "org.jasig.cas.authentication.UsernamePasswordCredential",
                    "id": "292752388@qq.com"
                },
                "handlerName": "UserAuthenticationHandler",
                "principal": {
                    "attributes": { },
                    "id": "292752388@qq.com"
                },
                "warnings": [ ]
            }
        }
    }
],
"countOfUses": 0,
"creationTime": 1478326255839,
"expired": false,
"expiredInternal": false,
"id": "TGT-2-lbD3xVJInO4Eb7blP110aTegX6hFjh5USFxlgp4Zv5dfSJepPG-S3",
"lastTimeUsed": 1478326255839,
"previousTimeUsed": 0,
"root": true,
"services": { },
"supplementalAuthentications": [ ]

}

org.jasig.cas.authentication.UsernamePasswordCredential这个可以不加入Ticket吗

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

4条回答 默认 最新

  • A_S478 2016-11-25 08:20
    已采纳

    cas 4.0.3 版本问题,换成4.0.7就没问题了,关系大家的回答,怎么给分啊

    点赞 评论
  • devmiao 2016-11-05 15:48
    点赞 评论
  • A_S478 2016-11-06 06:55

    用流的方式会出现下列错误,用redis自带的JdkSerializationRedisSerializer序列化一样出现下列错误,难道我的这方式是错的?(版本:cas4.0,redis 2.8 ,spring 3.2.6,spring-data-redis-1.6.0.RELEASE.jar)
    translationjava.util.HashMap$KeySet
    java.io.NotSerializableException: java.util.HashMap$KeySet
    at java.io.ObjectOutputStream.writeObject0(Unknown Source)
    at java.io.ObjectOutputStream.writeObject(Unknown Source)
    at java.util.HashMap.writeObject(Unknown Source)
    at sun.reflect.GeneratedMethodAccessor51.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at java.io.ObjectStreamClass.invokeWriteObject(Unknown Source)
    at java.io.ObjectOutputStream.writeSerialData(Unknown Source)
    at java.io.ObjectOutputStream.writeOrdinaryObject(Unknown Source)
    at java.io.ObjectOutputStream.writeObject0(Unknown Source)
    at java.io.ObjectOutputStream.defaultWriteFields(Unknown Source)
    at java.io.ObjectOutputStream.writeSerialData(Unknown Source)
    at java.io.ObjectOutputStream.writeOrdinaryObject(Unknown Source)
    at java.io.ObjectOutputStream.writeObject0(Unknown Source)
    at java.io.ObjectOutputStream.defaultWriteFields(Unknown Source)
    at java.io.ObjectOutputStream.writeSerialData(Unknown Source)
    at java.io.ObjectOutputStream.writeOrdinaryObject(Unknown Source)
    at java.io.ObjectOutputStream.writeObject0(Unknown Source)
    at java.io.ObjectOutputStream.writeObject(Unknown Source)
    at com.msxf.sso.ticket.ByteUtil.ObjectToByte(ByteUtil.java:32)
    at com.msxf.sso.ticket.RedisTicketRegistry.addTicket(RedisTicketRegistry.java:59)

    点赞 评论
  • Justin0715 2016-11-08 05:27

    hashmap没有实现Serializable接口,不能保存到redis中

    点赞 评论

相关推荐 更多相似问题