0
votes

Environment: MongoDB - 4.2 Springboot starter - 2.2.5.RELEASE

spring-boot-starter-web CAS Version: 6.1.5

JDK:11

SpringBoot Application with following packages in pom.xml:

cas-server-support-configuration-cloud-mongo cas-server-support-mongo-service-registry cas-server-core-* cas-server-webapp-*

Log Snippet

org.springframework.data.mapping.model.MappingInstantiationException: Failed to instantiate org.apereo.cas.services.RegisteredService using constructor NO_CONSTRUCTOR with arguments at org.springframework.data.convert.ReflectionEntityInstantiator.createInstance(ReflectionEntityInstantiator.java:67) ~[spring-data-commons-2.2.5.RELEASE.jar!/:2.2.5.RELEASE] at org.springframework.data.convert.ClassGeneratingEntityInstantiator.createInstance(ClassGeneratingEntityInstantiator.java:84) ~[spring-data-commons-2.2.5.RELEASE.jar!/:2.2.5.RELEASE] at org.springframework.data.mongodb.core.convert.MappingMongoConverter.read(MappingMongoConverter.java:321) ~[spring-data-mongodb-2.2.5.RELEASE.jar!/:2.2.5.RELEASE] at org.springframework.data.mongodb.core.convert.MappingMongoConverter.read(MappingMongoConverter.java:294) ~[spring-data-mongodb-2.2.5.RELEASE.jar!/:2.2.5.RELEASE] at org.springframework.data.mongodb.core.convert.MappingMongoConverter.read(MappingMongoConverter.java:225) ~[spring-data-mongodb-2.2.5.RELEASE.jar!/:2.2.5.RELEASE] at org.springframework.data.mongodb.core.convert.MappingMongoConverter.read(MappingMongoConverter.java:221) ~[spring-data-mongodb-2.2.5.RELEASE.jar!/:2.2.5.RELEASE] at org.springframework.data.mongodb.core.convert.MappingMongoConverter.read(MappingMongoConverter.java:94) ~[spring-data-mongodb-2.2.5.RELEASE.jar!/:2.2.5.RELEASE] at org.springframework.data.mongodb.core.MongoTemplate$ReadDocumentCallback.doWith(MongoTemplate.java:3162) ~[spring-data-mongodb-2.2.5.RELEASE.jar!/:2.2.5.RELEASE] at org.springframework.data.mongodb.core.MongoTemplate.executeFindMultiInternal(MongoTemplate.java:2799) ~[spring-data-mongodb-2.2.5.RELEASE.jar!/:2.2.5.RELEASE] at org.springframework.data.mongodb.core.MongoTemplate.findAll(MongoTemplate.java:1809) ~[spring-data-mongodb-2.2.5.RELEASE.jar!/:2.2.5.RELEASE] at org.apereo.cas.services.MongoDbServiceRegistry.load(MongoDbServiceRegistry.java:70) ~[cas-server-support-mongo-service-registry-6.1.5.jar!/:6.1.5] at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195) ~[na:na] at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1654) ~[na:na] at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484) ~[na:na] at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474) ~[na:na] at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:913) ~[na:na] at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) ~[na:na] at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:578) ~[na:na] at org.apereo.cas.services.ChainingServiceRegistry.load(ChainingServiceRegistry.java:74) ~[cas-server-core-services-registry-6.1.5.jar!/:6.1.5] at jdk.internal.reflect.GeneratedMethodAccessor144.invoke(Unknown Source) ~[na:na] at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na] at java.base/java.lang.reflect.Method.invoke(Method.java:566) ~[na:na] at org.springframework.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:282) ~[spring-core-5.2.4.RELEASE.jar!/:5.2.4.RELEASE] at org.springframework.cloud.context.scope.GenericScope$LockedScopedProxyFactoryBean.invoke(GenericScope.java:499) ~[spring-cloud-context-2.2.0.RC1.jar!/:2.2.0.RC1] at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) ~[spring-aop-5.2.4.RELEASE.jar!/:5.2.4.RELEASE] at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:212) ~[spring-aop-5.2.4.RELEASE.jar!/:5.2.4.RELEASE] at com.sun.proxy.$Proxy187.load(Unknown Source) ~[na:na]

1
After some analysis, I believe the service definition that is stored in MongoDB is not getting initialized by the registry service while loading. Anyone has a sample service stored in MongoDB that could be shared ? Thanks in advance,Sabi

1 Answers

0
votes

Anyone has a sample service stored in MongoDB that could be shared ?

{
"_class": "org.apereo.cas.support.oauth.services.OAuthRegisteredService",
"clientSecret": "clientSecret",
"clientId": "clientId",
"bypassApprovalPrompt": false,
"generateRefreshToken": true,
"jsonFormat": true,
"supportedGrantTypes": [],
"supportedResponseTypes": [],
"serviceId": "test",
"name": "test",
"expirationPolicy": {
    "_class": "org.apereo.cas.services.DefaultRegisteredServiceExpirationPolicy",
    "deleteWhenExpired": false,
    "notifyWhenDeleted": false
},
"proxyPolicy": {
    "_class": "org.apereo.cas.services.RefuseRegisteredServiceProxyPolicy"
},
"evaluationOrder": 2,
"usernameAttributeProvider": {
    "_class": "org.apereo.cas.services.DefaultRegisteredServiceUsernameProvider",
    "canonicalizationMode": "NONE",
    "encryptUsername": false
},
"logoutType": "BACK_CHANNEL",
"requiredHandlers": [],
"attributeReleasePolicy": {
    "_class": "org.apereo.cas.services.ReturnAllowedAttributeReleasePolicy",
    "allowedAttributes": [],
    "principalAttributesRepository": {
        "_class": "org.apereo.cas.authentication.principal.DefaultPrincipalAttributesRepository",
        "expiration": {
            "$numberLong": "2"
        },
        "timeUnit": "HOURS"
    },
    "consentPolicy": {
        "_class": "org.apereo.cas.services.consent.DefaultRegisteredServiceConsentPolicy",
        "enabled": true
    },
    "authorizedToReleaseCredentialPassword": false,
    "authorizedToReleaseProxyGrantingTicket": false,
    "excludeDefaultAttributes": false,
    "authorizedToReleaseAuthenticationAttributes": true
},
"multifactorPolicy": {
    "_class": "org.apereo.cas.services.DefaultRegisteredServiceMultifactorPolicy",
    "multifactorAuthenticationProviders": [],
    "failureMode": "NOT_SET",
    "bypassEnabled": false
},
"accessStrategy": {
    "_class": "org.apereo.cas.services.DefaultRegisteredServiceAccessStrategy",
    "order": 0,
    "enabled": true,
    "ssoEnabled": true,
    "delegatedAuthenticationPolicy": {
        "_class": "org.apereo.cas.services.DefaultRegisteredServiceDelegatedAuthenticationPolicy",
        "allowedProviders": []
    },
    "requireAllAttributes": true,
    "requiredAttributes": {},
    "rejectedAttributes": {},
    "caseInsensitive": false
},
"properties": {
    "testProperties": {
        "_id": {
            "$numberLong": "0"
        },
        "values": ["testPropertiesValue"]
    }
},
"contacts": []
}