Error - Service Registry json

382 views
Skip to first unread message

Jay

unread,
May 15, 2018, 12:23:28 PM5/15/18
to CAS Community
Hi Everyone,
Could someone help me to get this ERROR fixed.

Below is the entry from my json file
Filename: serviceRegistry-1524464822.json
[
{
"@class" : "org.apereo.cas.services.RegexRegisteredService",
"serviceId" : "^(https|imaps|http)://.*",
"name" : "HTTPS/IMAPS wildcard",
"id" : 20170905111650,
"evaluationOrder" : 99999
},
{
"@class" : "org.apereo.cas.services.RegexRegisteredService",
"serviceId" : "https://www.google.com/a/dev.<domain>.com/acs",
"name" : "googleApps",
"id" : 1000,
"evaluationOrder" : 10
}
]

I see this error in the logs.
[1;31m2018-05-15 11:14:10,091 ERROR [org.apereo.cas.util.serialization.AbstractJacksonBackedStringSerializer] - <Cannot read/parse [[{"@class":"org.apereo.cas.services.RegexRegisteredService","serviceId":"^(https|imaps|http)://.*","name":"HTTPS/IMAPS wil...] to deserialize into type [interface org.apereo.cas.services.RegisteredService]. This may be caused in the absence of a configuration/support module that knows how to interpret the fragment, specially if the fragment describes a CAS registered service definition. Internal parsing error is [Unexpected token (START_OBJECT), expected VALUE_STRING: need JSON String that contains type id (for subtype of org.apereo.cas.services.RegisteredService)
 at [Source: (String)"[{"@class":"org.apereo.cas.services.RegexRegisteredService","serviceId":"^(https|imaps|http)://.*","name":"HTTPS/IMAPS wildcard","id":20170905111650,"evaluationOrder":99999},{"@class":"org.apereo.cas.services.RegexRegisteredService","serviceId":"https://www.google.com/a/dev.<domain>.com/acs","name":"googleApps","id":1000,"evaluationOrder":10}]"; line: 1, column: 2]]> [m
[36m2018-05-15 11:14:10,091 DEBUG [org.apereo.cas.util.serialization.AbstractJacksonBackedStringSerializer] - <Unexpected token (START_OBJECT), expected VALUE_STRING: need JSON String that contains type id (for subtype of org.apereo.cas.services.RegisteredService)
 at [Source: (String)"[{"@class":"org.apereo.cas.services.RegexRegisteredService","serviceId":"^(https|imaps|http)://.*","name":"HTTPS/IMAPS wildcard","id":20170905111650,"evaluationOrder":99999},{"@class":"org.apereo.cas.services.RegexRegisteredService","serviceId":"https://www.google.com/a/dev.<domain>.com/acs","name":"googleApps","id":1000,"evaluationOrder":10}]"; line: 1, column: 2]> [m
com.fasterxml.jackson.databind.exc.MismatchedInputException: Unexpected token (START_OBJECT), expected VALUE_STRING: need JSON String that contains type id (for subtype of org.apereo.cas.services.RegisteredService)
 at [Source: (String)"[{"@class":"org.apereo.cas.services.RegexRegisteredService","serviceId":"^(https|imaps|http)://.*","name":"HTTPS/IMAPS wildcard","id":20170905111650,"evaluationOrder":99999},{"@class":"org.apereo.cas.services.RegexRegisteredService","serviceId":"https://www.google.com/a/dev.<domain>.com/acs","name":"googleApps","id":1000,"evaluationOrder":10}]"; line: 1, column: 2]
at com.fasterxml.jackson.databind.exc.MismatchedInputException.from(MismatchedInputException.java:59) ~[jackson-databind-2.9.3.jar:2.9.3]
at com.fasterxml.jackson.databind.DeserializationContext.wrongTokenException(DeserializationContext.java:1498) ~[jackson-databind-2.9.3.jar:2.9.3]
at com.fasterxml.jackson.databind.DeserializationContext.reportWrongTokenException(DeserializationContext.java:1273) ~[jackson-databind-2.9.3.jar:2.9.3]
at com.fasterxml.jackson.databind.jsontype.impl.AsArrayTypeDeserializer._locateTypeId(AsArrayTypeDeserializer.java:151) ~[jackson-databind-2.9.3.jar:2.9.3]
at com.fasterxml.jackson.databind.jsontype.impl.AsArrayTypeDeserializer._deserialize(AsArrayTypeDeserializer.java:96) ~[jackson-databind-2.9.3.jar:2.9.3]
at com.fasterxml.jackson.databind.jsontype.impl.AsArrayTypeDeserializer.deserializeTypedFromAny(AsArrayTypeDeserializer.java:71) ~[jackson-databind-2.9.3.jar:2.9.3]
at com.fasterxml.jackson.databind.jsontype.impl.AsPropertyTypeDeserializer._deserializeTypedUsingDefaultImpl(AsPropertyTypeDeserializer.java:148) ~[jackson-databind-2.9.3.jar:2.9.3]
at com.fasterxml.jackson.databind.jsontype.impl.AsPropertyTypeDeserializer.deserializeTypedFromObject(AsPropertyTypeDeserializer.java:88) ~[jackson-databind-2.9.3.jar:2.9.3]
at com.fasterxml.jackson.databind.deser.AbstractDeserializer.deserializeWithType(AbstractDeserializer.java:254) ~[jackson-databind-2.9.3.jar:2.9.3]
at com.fasterxml.jackson.databind.deser.impl.TypeWrappedDeserializer.deserialize(TypeWrappedDeserializer.java:68) ~[jackson-databind-2.9.3.jar:2.9.3]
at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:4001) ~[jackson-databind-2.9.3.jar:2.9.3]
at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:2992) ~[jackson-databind-2.9.3.jar:2.9.3]
at org.apereo.cas.util.serialization.AbstractJacksonBackedStringSerializer.readObjectFromJson(AbstractJacksonBackedStringSerializer.java:232) ~[cas-server-core-util-api-5.3.0-RC2.jar:5.3.0-RC2]
at org.apereo.cas.util.serialization.AbstractJacksonBackedStringSerializer.from(AbstractJacksonBackedStringSerializer.java:108) ~[cas-server-core-util-api-5.3.0-RC2.jar:5.3.0-RC2]
at org.apereo.cas.util.serialization.StringSerializer.load(StringSerializer.java:100) ~[cas-server-core-util-api-5.3.0-RC2.jar:5.3.0-RC2]
at org.apereo.cas.services.resource.AbstractResourceBasedServiceRegistryDao.lambda$load$4(AbstractResourceBasedServiceRegistryDao.java:269) ~[cas-server-core-services-registry-5.3.0-RC2.jar:5.3.0-RC2]
at org.apereo.cas.services.resource.AbstractResourceBasedServiceRegistryDao$$Lambda$161/230611610.apply(Unknown Source) ~[?:?]
at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193) ~[?:1.8.0_31]
at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:175) ~[?:1.8.0_31]
at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1374) ~[?:1.8.0_31]
at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:512) ~[?:1.8.0_31]
at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:502) ~[?:1.8.0_31]
at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708) ~[?:1.8.0_31]
at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) ~[?:1.8.0_31]
at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:499) ~[?:1.8.0_31]
at org.apereo.cas.services.resource.AbstractResourceBasedServiceRegistryDao.load(AbstractResourceBasedServiceRegistryDao.java:270) ~[cas-server-core-services-registry-5.3.0-RC2.jar:5.3.0-RC2]
at org.apereo.cas.services.resource.AbstractResourceBasedServiceRegistryDao$$Lambda$154/594898479.apply(Unknown Source) ~[?:?]
at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193) ~[?:1.8.0_31]
at java.util.LinkedList$LLSpliterator.forEachRemaining(LinkedList.java:1235) ~[?:1.8.0_31]
at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:512) ~[?:1.8.0_31]
at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:502) ~[?:1.8.0_31]
at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708) ~[?:1.8.0_31]
at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) ~[?:1.8.0_31]
at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:499) ~[?:1.8.0_31]
at org.apereo.cas.services.resource.AbstractResourceBasedServiceRegistryDao.load(AbstractResourceBasedServiceRegistryDao.java:232) ~[cas-server-core-services-registry-5.3.0-RC2.jar:5.3.0-RC2]
at org.apereo.cas.services.AbstractServicesManager.load(AbstractServicesManager.java:191) ~[cas-server-core-services-registry-5.3.0-RC2.jar:5.3.0-RC2]
at org.apereo.cas.services.AbstractServicesManager$$FastClassBySpringCGLIB$$fbf64054.invoke(<generated>) ~[cas-server-core-services-registry-5.3.0-RC2.jar:5.3.0-RC2]
at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204) ~[spring-core-4.3.14.RELEASE.jar:4.3.14.RELEASE]
at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:738) ~[spring-aop-4.3.14.RELEASE.jar:4.3.14.RELEASE]
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157) ~[spring-aop-4.3.14.RELEASE.jar:4.3.14.RELEASE]
at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92) ~[spring-aop-4.3.14.RELEASE.jar:4.3.14.RELEASE]
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) ~[spring-aop-4.3.14.RELEASE.jar:4.3.14.RELEASE]
at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:673) ~[spring-aop-4.3.14.RELEASE.jar:4.3.14.RELEASE]
at org.apereo.cas.services.DefaultServicesManager$$EnhancerBySpringCGLIB$$cd2d6c0.load(<generated>) ~[cas-server-core-services-registry-5.3.0-RC2.jar:5.3.0-RC2]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_31]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_31]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_31]
at java.lang.reflect.Method.invoke(Method.java:483) ~[?:1.8.0_31]
at org.springframework.scheduling.support.ScheduledMethodRunnable.run(ScheduledMethodRunnable.java:65) ~[spring-context-4.3.14.RELEASE.jar:4.3.14.RELEASE]
at org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErrorHandlingRunnable.java:54) ~[spring-context-4.3.14.RELEASE.jar:4.3.14.RELEASE]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) ~[?:1.8.0_31]
at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308) ~[?:1.8.0_31]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180) ~[?:1.8.0_31]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294) ~[?:1.8.0_31]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) ~[?:1.8.0_31]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) ~[?:1.8.0_31]
at java.lang.Thread.run(Thread.java:745) [?:1.8.0_31]

David Curry

unread,
May 15, 2018, 12:35:17 PM5/15/18
to cas-...@apereo.org
If you're using the JSON service registry, services are supposed to be defined one service per file, with all the files stored in a directory. And there is a naming convention for the files:
JSON fileName = serviceName + "-" + serviceNumericId + ".json"





--

DAVID A. CURRY, CISSP
DIRECTOR OF INFORMATION SECURITY
INFORMATION TECHNOLOGY

71 FIFTH AVE., 9TH FL., NEW YORK, NY 10003
+1 212 229-5300 x4728david...@newschool.edu

The New School


--
- Website: https://apereo.github.io/cas
- Gitter Chatroom: https://gitter.im/apereo/cas
- List Guidelines: https://goo.gl/1VRrw7
- Contributions: https://goo.gl/mh7qDG
---
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+unsubscribe@apereo.org.
To view this discussion on the web visit https://groups.google.com/a/apereo.org/d/msgid/cas-user/7edc3fb8-d238-4147-ac90-84ff2d129ab4%40apereo.org.

Jay

unread,
May 16, 2018, 5:41:49 AM5/16/18
to CAS Community
Thank you David.

So as I understand.
The id inside the json file servicenumericId in the file name should match. Something like below:
serviceRegistry-1524464822.json
"id" : 1524464822

Thanks
Jay

David Curry

unread,
May 16, 2018, 7:56:43 AM5/16/18
to cas-...@apereo.org
Yes, but the rest of the name has to match the service name, as well. Again,

JSON fileName = serviceName + "-" + serviceNumericId + ".json"

so  based on your first post in this thread, you should have two files:

The first file, called HTTPSIMAPSwildcard-20170905111650.json, contains

{
        "@class" :            "org.apereo.cas.services.RegexRegisteredService",
        "serviceId" :         "^(https|imaps|http)://.*",
        "name" :              "HTTPS IMAPS wildcard",
        "id" :                20170905111650,
        "evaluationOrder" :   99999
}

Note that I changed the name of the service from "HTTPS/IMAPS wildcard" to "HTTPS IMAPS wildcard", because '/' is not allowed in file names.

The second file should be called googleApps-1000.json that contains

{
        "@class" :            "org.apereo.cas.services.RegexRegisteredService",
        "serviceId" :         "https://www.google.com/a/dev.<domain>.com/acs",
        "name" :              "googleApps",
        "id" :                1000,
        "evaluationOrder" :   10
}

and both of those files should be in /etc/cas/services (or whatever you've set cas.serviceRegistry.json.location to).




--

DAVID A. CURRY, CISSP
DIRECTOR OF INFORMATION SECURITY
INFORMATION TECHNOLOGY

71 FIFTH AVE., 9TH FL., NEW YORK, NY 10003
+1 212 229-5300 x4728david...@newschool.edu

The New School


--
- Website: https://apereo.github.io/cas
- Gitter Chatroom: https://gitter.im/apereo/cas
- List Guidelines: https://goo.gl/1VRrw7
- Contributions: https://goo.gl/mh7qDG
---
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+unsubscribe@apereo.org.

Jay

unread,
May 16, 2018, 8:07:39 AM5/16/18
to CAS Community
Sure David, I got that. Thank you again for helping me here.

Thanks,
Jay

On Tuesday, May 15, 2018 at 11:23:28 AM UTC-5, Jay wrote:
Reply all
Reply to author
Forward
0 new messages