CAS 5.1.0: Cannot read/parse JSON [{}] to deserialize into type [] ... missing configuration/support module

356 views
Skip to first unread message

Michael Kotowski

unread,
Jun 21, 2017, 8:08:52 AM6/21/17
to CAS Community
Hi.

I am using CAS 5.1.0 and it is working fine including multifactor authentication. But, I get the following warning:

org.apereo.cas.config.CasCoreTicketsConfiguration] - <Runtime memory is used as the persistence storage for retrieving and managing tickets. Tickets that are issued during runtime will be LOST upon container restarts. This MAY impact SSO functionality.>

To get rid of the following warning and persist tickets I added the cas-server-support-mongo-ticket-registry dependency and configured the following properties as described here.

cas.ticket.registry.mongo.host=${MONGO_HOST}
cas
.ticket.registry.mongo.userId=${MONGO_USERNAME}
cas
.ticket.registry.mongo.password=${MONGO_PASSWORD}
cas
.ticket.registry.mongo.databaseName=cas-database
cas
.ticket.registry.mongo.collectionName=cas-ticket-registry
cas
.ticket.registry.mongo.dropCollection=false

CAS starts as expected and creates the collection (and the corresponding index) in the MongoDB. Unfortunately, logins are not possible anymore.

The trace shows:

WHO: xxx
WHAT
: Supplied credentials: [xxx]
ACTION
: AUTHENTICATION_SUCCESS
APPLICATION
: CAS

WHO
: xxx
WHAT
: TGT-**********************************************...
ACTION
: TICKET_GRANTING_TICKET_DESTROYED
APPLICATION
: CAS

WHO
: xxx
WHAT
: TGT-**********************************************...
ACTION
: TICKET_GRANTING_TICKET_CREATED
APPLICATION
: CAS

... followed by two times ...

ERROR [org.apereo.cas.util.serialization.AbstractJacksonBackedStringSerializer] -
 
<Cannot read/parse JSON [{"@class":"org.apereo.cas.ticket.TicketGrantingTicketImpl","@id":1,"id":"TGT-**************...]
 to deserialize into type [interface org.apereo.cas.ticket.TicketGrantingTicket].
 This may be caused in the absence of a configuration/support module that knows how to interpret the JSON fragment,
 specially if the fragment describes a CAS registered service definition. Internal parsing error is
 [Can not construct instance of java.util.Collections$UnmodifiableCollection: no default no-arguments constructor found
 at [Source: {"
@class":"org.apereo.cas.ticket.TicketGrantingTicketImpl","@id":1,"id":"TGT-**************...",
  "
authentication":{"@class":"org.apereo.cas.authentication.DefaultAuthentication","authenticationDate":1498037529.634,
  "
credentials":["java.util.ArrayList",[{"@class":"org.apereo.cas.authentication.BasicCredentialMetaData","id":"xxx",
  "
credentialClass":"org.apereo.cas.authentication.UsernamePasswordCredential"}]],
  "
principal":{"@class":"org.apereo.cas.authentication.principal.SimplePrincipal","id":"xxx",
  "
attributes":{"@class":"java.util.TreeMap","employeeType":"yyy","LdapAuthenticationHandler.xxx":"cn=xxx,ou=users,dc=zzz,dc=eu",
  "
objectclass":["java.util.Collections$UnmodifiableCollection",["top","inetOrgPerson"]],"sn":"xxx"}},
  "
attributes":{"@class":"java.util.HashMap","authenticationMethod":"LdapAuthenticationHandler",
  "
successfulAuthenticationHandlers":["java.util.HashSet",["LdapAuthenticationHandler"]]},
  "
successes":{"@class":"java.util.HashMap","LdapAuthenticationHandler":{"@class":"org.apereo.cas.authentication.DefaultHandlerResult",
  "
handlerName":"LdapAuthenticationHandler","credentialMetaData":{"@class":"org.apereo.cas.authentication.BasicCredentialMetaData",
  "
id":"xxx","credentialClass":"org.apereo.cas.authentication.UsernamePasswordCredential"},
  "
principal":{"@class":"org.apereo.cas.authentication.principal.SimplePrincipal","id":"xxx",
  "
attributes":{"@class":"java.util.TreeMap","employeeType":"yyy","LdapAuthenticationHandler.xxx":"cn=xxx,ou=users,dc=zzz,dc=eu",
  "
objectclass":["java.util.Collections$UnmodifiableCollection",["top","inetOrgPerson"]],"sn":"xxx"}}}}},
  "
expirationPolicy":{"@class":"org.apereo.cas.ticket.support.TicketGrantingTicketExpirationPolicy","timeToLive":28800,"timeToIdle":7200},
  "
lastTimeUsed":1498037529.657,"creationTime":1498037529.657,"countOfUses":0,"expired":false,"prefix":"TGT","expiredInternal":false};
  line: 1, column: 759] (through reference chain: org.apereo.cas.ticket.TicketGrantingTicketImpl["
authentication"]->
  org.apereo.cas.authentication.DefaultAuthentication["
principal"]->org.apereo.cas.authentication.principal.SimplePrincipal["attributes"]
  ->java.util.TreeMap["
objectclass"])]>

ERROR [org.apereo.cas.ticket.registry.MongoDbTicketRegistry] - <Failed fetching [TGT-**********************************************...]: [INVALID_TICKET]>

... and ...

WHO: xxx
WHAT
: TGT-**********************************************...
ACTION
: TICKET_GRANTING_TICKET_DESTROYED
APPLICATION
: CAS

Login fails.

The MongoDB has a new document:

{
   
"_id" : ObjectId("594a3d5cc5f22500087beaaa"),
   
"_class" : "org.apereo.cas.ticket.registry.TicketHolder",
   
"json" : "\n{\n  \"@class\": \"org.apereo.cas.ticket.TicketGrantingTicketImpl\",\n  \"@id\": 1,\n  \"id\": \"TGT-...\",\n  \"authentication\":\n  {\n    \"@class\": \"org.apereo.cas.authentication.DefaultAuthentication\",\n    \"authenticationDate\": 1498037595.988,\n    \"credentials\":\n    [\n      \"java.util.ArrayList\",\n      [\n        {\n          \"@class\": \"org.apereo.cas.authentication.BasicCredentialMetaData\",\n          \"id\": \"xxx\",\n          \"credentialClass\": \"org.apereo.cas.authentication.UsernamePasswordCredential\"\n        }\n      ]\n    ],\n    \"principal\":\n    {\n      \"@class\": \"org.apereo.cas.authentication.principal.SimplePrincipal\",\n      \"id\": \"xxx\",\n      \"attributes\":\n      {\n        \"@class\": \"java.util.TreeMap\",\n        \"employeeType\": \"yyy\",\n        \"LdapAuthenticationHandler.xxx\": \"cn=xxx,ou=users,dc=zzz,dc=eu\",\n        \"objectclass\":\n        [\n          \"java.util.Collections$UnmodifiableCollection\",\n          [\n            \"top\",\n            \"inetOrgPerson\"\n          ]\n        ],\n        \"sn\": \"xxx\"\n      }\n    },\n    \"attributes\":\n    {\n      \"@class\": \"java.util.HashMap\",\n      \"authenticationMethod\": \"LdapAuthenticationHandler\",\n      \"successfulAuthenticationHandlers\":\n      [\n        \"java.util.HashSet\",\n        [\n          \"LdapAuthenticationHandler\"\n        ]\n      ]\n    },\n    \"successes\":\n    {\n      \"@class\": \"java.util.HashMap\",\n      \"LdapAuthenticationHandler\":\n      {\n        \"@class\": \"org.apereo.cas.authentication.DefaultHandlerResult\",\n        \"handlerName\": \"LdapAuthenticationHandler\",\n        \"credentialMetaData\":\n        {\n          \"@class\": \"org.apereo.cas.authentication.BasicCredentialMetaData\",\n          \"id\": \"xxx\",\n          \"credentialClass\": \"org.apereo.cas.authentication.UsernamePasswordCredential\"\n        },\n        \"principal\":\n        {\n          \"@class\": \"org.apereo.cas.authentication.principal.SimplePrincipal\",\n          \"id\": \"xxx\",\n          \"attributes\":\n          {\n            \"@class\": \"java.util.TreeMap\",\n            \"employeeType\": \"yyy\",\n            \"LdapAuthenticationHandler.xxx\": \"cn=xxx,ou=users,dc=zzz,dc=eu\",\n            \"objectclass\":\n            [\n              \"java.util.Collections$UnmodifiableCollection\",\n              [\n                \"top\",\n                \"inetOrgPerson\"\n              ]\n            ],\n            \"sn\": \"xxx\"\n          }\n        }\n      }\n    }\n  },\n  \"expirationPolicy\":\n  {\n    \"@class\": \"org.apereo.cas.ticket.support.TicketGrantingTicketExpirationPolicy\",\n    \"timeToLive\": 28800,\n    \"timeToIdle\": 7200\n  },\n  \"lastTimeUsed\": 1498037596.029,\n  \"creationTime\": 1498037596.029,\n  \"countOfUses\": 0,\n  \"expired\": false,\n  \"prefix\": \"TGT\",\n  \"expiredInternal\": false\n}",
   
"ticketId" : "TGT-...",
   
"type" : "org.apereo.cas.ticket.TicketGrantingTicketImpl",
   
"expireAt" : NumberLong(28800)
}

What is missing in my configuration?

Misagh Moayyed

unread,
Jun 21, 2017, 12:00:58 PM6/21/17
to cas-...@apereo.org

Nothing is missing in your config. This is a bug in JSON serialization. You’re welcome to file an issue.

 

--Misagh

--
- CAS gitter chatroom: https://gitter.im/apereo/cas
- CAS mailing list guidelines: https://apereo.github.io/cas/Mailing-Lists.html
- CAS documentation website: https://apereo.github.io/cas
- CAS project website: https://github.com/apereo/cas
---
You received this message because you are subscribed to the Google Groups "CAS Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cas-user+u...@apereo.org.
To view this discussion on the web visit https://groups.google.com/a/apereo.org/d/msgid/cas-user/fd67483c-4a69-4935-8c06-f689bec4cbf2%40apereo.org.

Michael Kotowski

unread,
Jun 22, 2017, 4:06:45 AM6/22/17
to CAS Community, mmoa...@unicon.net
Reply all
Reply to author
Forward
0 new messages