java.lang.ClassCastException in AdminUserAndGroupLoader when starting up

Steps to reproduce

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.

Assignee

Rute Santos

Reporter

Rute Santos

Severity

Incorrectly Functioning With Workaround

Tags (folksonomy)

None

Components

Affects versions

Priority

Minor
Configure