Uploaded image for project: 'Opencast'
  1. MH-13130

java.lang.ClassCastException in AdminUserAndGroupLoader when starting up

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed and reviewed
    • Affects Version/s: 5.1, 6.0
    • Fix Version/s: None
    • Component/s: Backend Software
    • Labels:
      None
    • Severity:
      Incorrectly Functioning With Workaround
    • Steps to reproduce:
      Hide
      Error when starting up Opencast:
      2018-09-25 15:46:24,953 | ERROR | (AdminUserAndGroupLoader$1:262) -
      Unable to load system administrator group because
      java.lang.ClassCastException:
      org.opencastproject.security.api.DefaultOrganization cannot be cast to
      org.opencastproject.security.impl.jpa.JpaOrganization
               at
      org.opencastproject.userdirectory.JpaGroupRoleProvider.updateGroup(JpaGroupRoleProvider.java:562)
               at
      org.opencastproject.userdirectory.AdminUserAndGroupLoader$1.run(AdminUserAndGroupLoader.java:251)
               at org.opencastproject.util.data.Effect0.apply(Effect0.java:35)
               at org.opencastproject.util.data.Effect0.apply(Effect0.java:32)
               at
      org.opencastproject.security.util.SecurityUtil.runAs(SecurityUtil.java:70)
               at
      org.opencastproject.userdirectory.AdminUserAndGroupLoader.createSystemAdministratorUserAndGroup(AdminUserAndGroupLoader.java:166)
               at
      org.opencastproject.userdirectory.AdminUserAndGroupLoader.activate(AdminUserAndGroupLoader.java:132)
               at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
               at
      sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
               at
      sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
               at java.lang.reflect.Method.invoke(Method.java:498)
      ...

      This seems to happen because the OrganizationDirectoryService has a
      dynamic reference to its persistence layer and, if the persistence
      layer is not activated yet, the OrganizationDirectoryService will return
      the DefaultOrganization, which is not a JpaOrganization and thus the
      ClassCastException.

      This issue has come up before in MH-12757, but different stack
      trace.

      I tracked it down to the change in MH-9363,
      when that reference was changed from static to dynamic because of the
      demo capture agent module, which is not part of Opencast anymore.

      The reference needs to be changed back to cardinality=1..1, policy=static.
      Show
      Error when starting up Opencast: 2018-09-25 15:46:24,953 | ERROR | (AdminUserAndGroupLoader$1:262) - Unable to load system administrator group because java.lang.ClassCastException: org.opencastproject.security.api.DefaultOrganization cannot be cast to org.opencastproject.security.impl.jpa.JpaOrganization          at org.opencastproject.userdirectory.JpaGroupRoleProvider.updateGroup(JpaGroupRoleProvider.java:562)          at org.opencastproject.userdirectory.AdminUserAndGroupLoader$1.run(AdminUserAndGroupLoader.java:251)          at org.opencastproject.util.data.Effect0.apply(Effect0.java:35)          at org.opencastproject.util.data.Effect0.apply(Effect0.java:32)          at org.opencastproject.security.util.SecurityUtil.runAs(SecurityUtil.java:70)          at org.opencastproject.userdirectory.AdminUserAndGroupLoader.createSystemAdministratorUserAndGroup(AdminUserAndGroupLoader.java:166)          at org.opencastproject.userdirectory.AdminUserAndGroupLoader.activate(AdminUserAndGroupLoader.java:132)          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)          at java.lang.reflect.Method.invoke(Method.java:498) ... This seems to happen because the OrganizationDirectoryService has a dynamic reference to its persistence layer and, if the persistence layer is not activated yet, the OrganizationDirectoryService will return the DefaultOrganization, which is not a JpaOrganization and thus the ClassCastException. This issue has come up before in MH-12757 , but different stack trace. I tracked it down to the change in MH-9363 , when that reference was changed from static to dynamic because of the demo capture agent module, which is not part of Opencast anymore. The reference needs to be changed back to cardinality=1..1, policy=static.

      TestRail: Results

        Attachments

          Activity

            People

            • Assignee:
              rute_santos Rute Santos
              Reporter:
              rute_santos Rute Santos
            • Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                TestRail: Cases