ERROR [org.apereo.cas.util.concurrent.CasReentrantLock] - <Cannot invoke "Object.hashCode()" because "key" is null

158 views
Skip to first unread message

Josh

unread,
Apr 11, 2024, 5:11:49 PM4/11/24
to CAS Community
Hi all -

We're in the process of migrating from CAS 6.6.x to CAS 7.0.x. We have several hundred services in our production environment working fine, however when starting CAS 7.0.3 in our test environment it seems to bail out hard loading some specific services and the application shuts down.

Here is the error we are receiving:

2024-04-11 15:44:06,843 ERROR [org.apereo.cas.util.concurrent.CasReentrantLock] - <Cannot invoke "Object.hashCode()" because "key" is null
        ConcurrentHashMap.java:get:936
        AbstractMapBasedAttributeIndex.java:addAll:81
        CollectionQueryEngine.java:perform:1376
>
2024-04-11 15:44:06,882 ERROR [org.springframework.boot.SpringApplication] - <Application run failed>

The commonality seems to be having a HashMap (also indicated by the error) in the service.

Here is one example, which is working just fine in CAS 6.6 (we've likely had this config in place since at least the CAS 5.x days, maybe earlier). I reviewed the documentation (https://apereo.github.io/cas/7.0.x/services/Service-Access-Strategy-ABAC.html) to make sure nothing changed but I am just not seeing it.

    accessStrategy : {
        @class : org.apereo.cas.services.DefaultRegisteredServiceAccessStrategy
        enabled : true
        ssoEnabled : true
        caseInsensitive: true
        requireAllAttributes: false
        unauthorizedRedirectUrl : https://support.XXX.XXX
        requiredAttributes : {
            @class : java.util.HashMap
            memberOf : [ "java.util.HashSet", [ "CN=Bomgar_Admins,OU=Role Groups,OU=Groups,DC=XXX,DC=XXX,DC=XXX"]]
        }
    }

I am also attaching the full service definition below:

{
    @class : org.apereo.cas.support.saml.services.SamlRegisteredService
    serviceId : https://bomgar.XXX.XXX/appliance
    name : bomgar.XXX.XXX
    id : 50092
    evaluationOrder : 100
    metadataLocation : /etc/cas/saml/metadata/BomgarAppliance-metadata.xml
    accessStrategy : {
        @class : org.apereo.cas.services.DefaultRegisteredServiceAccessStrategy
        enabled : true
        ssoEnabled : true
        caseInsensitive: true
        requireAllAttributes: false
        unauthorizedRedirectUrl : https://support.XXX.XXX
        requiredAttributes : {
            @class : java.util.HashMap
            memberOf : [ "java.util.HashSet", [ "CN=Bomgar_Admins,OU=Role Groups,OU=Groups,DC=XXX,DC=XXX,DC=XXX"]]
        }
    }
    attributeReleasePolicy : {
        @class : org.apereo.cas.services.ReturnAllowedAttributeReleasePolicy
        allowedAttributes : [
            java.util.ArrayList
            [
                displayName
                mail
                memberOf
            ]
        ]
    }
    requiredNameIdFormat: urn:oasis:names:tc:SAML:2.0:nameid-format:persistent
    usernameAttributeProvider : {
        @class : org.apereo.cas.services.PrincipalAttributeRegisteredServiceUsernameProvider
        usernameAttribute : sAMAccountName
    }
}

Any assistance would be greatly appreciated.

Meysam Shirazi

unread,
Apr 13, 2024, 4:08:20 AM4/13/24
to CAS Community, Josh
Hi Josh
Check the JDK version.

Josh

unread,
Jun 11, 2024, 12:49:33 PM6/11/24
to CAS Community, Meysam Shirazi, Josh
Hi Meysam -

Here is the JDK version we are running in our DEV env

CAS Version: 7.0.4
CAS Branch: 7.0.x
CAS Commit Id: d41ac9d5e157605fc43d97a77582c2062e864874
CAS Build Date/Time: 2024-04-26T07:43:16.528866Z
Spring Boot Version: 3.2.1
Spring Version: 6.1.2
Java Home: /usr/lib/jvm/zulu21-ca-amd64
Java Vendor: Azul Systems, Inc.
Java Version: 21.0.3
Servlet Version: 6.0.0
JVM Free Memory: 144 MB
JVM Maximum Memory: 2 GB
JVM Total Memory: 278 MB
OS Architecture: amd64
OS Name: Linux
OS Version: 5.14.0-427.16.1.el9_4.x86_64
OS Date/Time: 2024-06-11T16:39:14.993620776
OS Temp Directory: /tmp
------------------------------------------------------------
Apache Tomcat Version: Apache Tomcat/10.1.23
Hazelcast Version: 5.3.6.9903dc9.20231109
------------------------------------------------------------

This should match the version provided in the Dockerfile.

Josh

unread,
Jun 11, 2024, 1:11:01 PM6/11/24
to CAS Community, Josh, Meysam Shirazi
As an additional debugging point, I tested this on 7.1.0-SNAPSHOT and it loads all services as expected, so it looks like this is 7.0.x specific.

Josh

unread,
Aug 12, 2024, 8:14:10 AM8/12/24
to CAS Community, Josh, Meysam Shirazi
Wondering if there was any update on this? The issue is still present in 7.0.6 but not present in 7.1.0-SNAPSHOT.

Josh

unread,
Aug 12, 2024, 4:04:25 PM8/12/24
to CAS Community, Josh, Meysam Shirazi
Sorry, this one is a bit different...

CAS Services now fully load and the application starts... but when attempting to load a service that uses Object.hashCode() it bails out with the following:



2024-08-12 14:20:58,201 WARN [org.apereo.cas.util.function.FunctionUtils] - <Cannot invoke "Object.hashCode()" because "key" is null

        ConcurrentHashMap.java:get:936
        AbstractMapBasedAttributeIndex.java:addAll:81
        CollectionQueryEngine.java:perform:1376
>
2024-08-12 14:20:58,201 ERROR [org.apereo.cas.web.support.WebUtils] - <Cannot invoke "Object.hashCode()" because "key" is null

        ConcurrentHashMap.java:get:936
        AbstractMapBasedAttributeIndex.java:addAll:81
        CollectionQueryEngine.java:perform:1376

2024-08-12 14:20:58,227 ERROR [org.thymeleaf.TemplateEngine] - <[THYMELEAF][tomcat-handler-86] Exception processing template "error/casServiceErrorView": Exception evaluating SpringEL expression: "rootCauseException != null and rootCauseException.code != null" (template: "error/casServiceErrorView" - line 16, col 12)>
org.thymeleaf.exceptions.TemplateProcessingException: Exception evaluating SpringEL expression: "rootCauseException != null and rootCauseException.code != null" (template: "error/casServiceErrorView" - line 16, col 12)

2024-08-12 14:20:58,227 ERROR [org.apereo.cas.web.support.filters.AbstractSecurityFilter] - <Request processing failed: org.thymeleaf.exceptions.TemplateProcessingException: Exception evaluating SpringEL expression: "rootCauseException != null and rootCauseException.code != null" (template: "error/casServiceErrorView" - line 16, col 12)
        FrameworkServlet.java:processRequest:1022
        FrameworkServlet.java:doGet:903
        HttpServlet.java:service:527

Caused by: org.springframework.expression.spel.SpelEvaluationException: EL1008E: Property or field 'code' cannot be found on object of type 'java.lang.NullPointerException' - maybe not public or not valid?

2024-08-12 14:20:58,228 ERROR [org.apache.catalina.core.ContainerBase.[Tomcat].[localhost].[/cas].[dispatcherServlet]] - <Servlet.service() for servlet [dispatcherServlet] in context with path [/cas] threw exception>
java.lang.RuntimeException: jakarta.servlet.ServletException: Request processing failed: org.thymeleaf.exceptions.TemplateProcessingException: Exception evaluating SpringEL expression: "rootCauseException != null and rootCauseException.code != null" (template: "error/casServiceErrorView" - line 16, col 12)

Caused by: jakarta.servlet.ServletException: Request processing failed: org.thymeleaf.exceptions.TemplateProcessingException: Exception evaluating SpringEL expression: "rootCauseException != null and rootCauseException.code != null" (template: "error/casServiceErrorView" - line 16, col 12)


On the WEB interface it gives a 500 with the following:

Error: jakarta.servlet.ServletException: Request processing failed: org.thymeleaf.exceptions.TemplateProcessingException: Exception evaluating SpringEL expression: "rootCauseException != null and rootCauseException.code != null" (template: "error/casServiceErrorView" - line 16, col 12)
Reply all
Reply to author
Forward
0 new messages