Startup errors - MySQLIntegrityConstraintViolationException from AclService

Steps to reproduce

Steps to reproduce:

1. Install Opencast 2.2 with mysql 5.6
2. Restart Opencast
3. Examine logs

Actual Results:

2016-06-20 15:37:52,457 | WARN | (JavaLog:289) -
Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.6.0.v20150309-bf26070): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Duplicate entry 'public-mh_default_org' for key 'UNQ_mh_acl_managed_acl'
Error Code: 1062
Call: INSERT INTO mh_acl_managed_acl (pk, acl, name, organization_id) VALUES (?, ?, ?, ?)
bind => [4 parameters bound]

and a similar error for private-mh_default_org.

These arise from the AclService attempting to populate the mh_acl_managed_acl table from the pre-defined ACLs in /opt/opencast/etc/acl

Expected Results:

No errors in the logs.

Workaround (if any):

Ignore the errors. If the ACL definitions change, remove the entries manually from the table.

Otherwise probably harmless.

2016-06-20 15:37:52,457 | WARN | (JavaLog:289) -
Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.6.0.v20150309-bf26070): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Duplicate entry 'public-mh_default_org' for key 'UNQ_mh_acl_managed_acl'
Error Code: 1062
Call: INSERT INTO mh_acl_managed_acl (pk, acl, name, organization_id) VALUES (?, ?, ?, ?)
bind => [4 parameters bound]
Query: InsertObjectQuery(org.opencastproject.authorization.xacml.manager.impl.persistence.ManagedAclEntity@3c9f5800)
at org.eclipse.persistence.exceptions.DatabaseException.sqlException(DatabaseException.java:331)
at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.executeDirectNoSelect(DatabaseAccessor.java:902)[79:org.eclipse.persistence.core:2.6.0.v20150309-bf26070]
at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.executeNoSelect(DatabaseAccessor.java:964)[79:org.eclipse.persistence.core:2.6.0.v20150309-bf26070]
at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.basicExecuteCall(DatabaseAccessor.java:633)[79:org.eclipse.persistence.core:2.6.0.v20150309-bf26070]
at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.executeCall(DatabaseAccessor.java:560)[79:org.eclipse.persistence.core:2.6.0.v20150309-bf26070]
at org.eclipse.persistence.internal.sessions.AbstractSession.basicExecuteCall(AbstractSession.java:2055)[79:org.eclipse.persistence.core:2.6.0.v20150309-bf26070]
at org.eclipse.persistence.sessions.server.ClientSession.executeCall(ClientSession.java:306)[79:org.eclipse.persistence.core:2.6.0.v20150309-bf26070]
at org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.executeCall(DatasourceCallQueryMechanism.java:242)[79:org.eclipse.persistence.core:2.6.0.v20150309-bf26070]
at org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.executeCall(DatasourceCallQueryMechanism.java:228)[79:org.eclipse.persistence.core:2.6.0.v20150309-bf26070]
at org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.insertObject(DatasourceCallQueryMechanism.java:377)[79:org.eclipse.persistence.core:2.6.0.v20150309-bf26070]
at org.eclipse.persistence.internal.queries.StatementQueryMechanism.insertObject(StatementQueryMechanism.java:165)[79:org.eclipse.persistence.core:2.6.0.v20150309-bf26070]
at org.eclipse.persistence.internal.queries.StatementQueryMechanism.insertObject(StatementQueryMechanism.java:180)[79:org.eclipse.persistence.core:2.6.0.v20150309-bf26070]
at org.eclipse.persistence.internal.queries.DatabaseQueryMechanism.insertObjectForWrite(DatabaseQueryMechanism.java:489)[79:org.eclipse.persistence.core:2.6.0.v20150309-bf26070]
at org.eclipse.persistence.queries.InsertObjectQuery.executeCommit(InsertObjectQuery.java:80)[79:org.eclipse.persistence.core:2.6.0.v20150309-bf26070]
at org.eclipse.persistence.queries.InsertObjectQuery.executeCommitWithChangeSet(InsertObjectQuery.java:90)[79:org.eclipse.persistence.core:2.6.0.v20150309-bf26070]
at org.eclipse.persistence.internal.queries.DatabaseQueryMechanism.executeWriteWithChangeSet(DatabaseQueryMechanism.java:301)[79:org.eclipse.persistence.core:2.6.0.v20150309-bf26070]
at org.eclipse.persistence.queries.WriteObjectQuery.executeDatabaseQuery(WriteObjectQuery.java:58)[79:org.eclipse.persistence.core:2.6.0.v20150309-bf26070]
at org.eclipse.persistence.queries.DatabaseQuery.execute(DatabaseQuery.java:904)[79:org.eclipse.persistence.core:2.6.0.v20150309-bf26070]
at org.eclipse.persistence.queries.DatabaseQuery.executeInUnitOfWork(DatabaseQuery.java:803)[79:org.eclipse.persistence.core:2.6.0.v20150309-bf26070]
at org.eclipse.persistence.queries.ObjectLevelModifyQuery.executeInUnitOfWorkObjectLevelModifyQuery(ObjectLevelModifyQuery.java:108)[79:org.eclipse.persistence.core:2.6.0.v20150309-bf26070]
at org.eclipse.persistence.queries.ObjectLevelModifyQuery.executeInUnitOfWork(ObjectLevelModifyQuery.java:85)[79:org.eclipse.persistence.core:2.6.0.v20150309-bf26070]
at org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.internalExecuteQuery(UnitOfWorkImpl.java:2896)[79:org.eclipse.persistence.core:2.6.0.v20150309-bf26070]
at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1857)[79:org.eclipse.persistence.core:2.6.0.v20150309-bf26070]
at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1839)[79:org.eclipse.persistence.core:2.6.0.v20150309-bf26070]
at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1790)[79:org.eclipse.persistence.core:2.6.0.v20150309-bf26070]
at org.eclipse.persistence.internal.sessions.CommitManager.commitNewObjectsForClassWithChangeSet(CommitManager.java:227)[79:org.eclipse.persistence.core:2.6.0.v20150309-bf26070]
at org.eclipse.persistence.internal.sessions.CommitManager.commitAllObjectsWithChangeSet(CommitManager.java:126)[79:org.eclipse.persistence.core:2.6.0.v20150309-bf26070]
at org.eclipse.persistence.internal.sessions.AbstractSession.writeAllObjectsWithChangeSet(AbstractSession.java:4260)[79:org.eclipse.persistence.core:2.6.0.v20150309-bf26070]
at org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.commitToDatabase(UnitOfWorkImpl.java:1441)[79:org.eclipse.persistence.core:2.6.0.v20150309-bf26070]
at org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.commitToDatabaseWithChangeSet(UnitOfWorkImpl.java:1531)[79:org.eclipse.persistence.core:2.6.0.v20150309-bf26070]
at org.eclipse.persistence.internal.sessions.RepeatableWriteUnitOfWork.commitRootUnitOfWork(RepeatableWriteUnitOfWork.java:278)[79:org.eclipse.persistence.core:2.6.0.v20150309-bf26070]
at org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.commitAndResume(UnitOfWorkImpl.java:1169)[79:org.eclipse.persistence.core:2.6.0.v20150309-bf26070]
at org.eclipse.persistence.internal.jpa.transaction.EntityTransactionImpl.commit(EntityTransactionImpl.java:134)[80:org.eclipse.persistence.jpa:2.6.0.v20150309-bf26070]
at org.opencastproject.util.persistence.PersistenceEnvs$2.tx(PersistenceEnvs.java:77)[141:matterhorn-common:2.2.0.SNAPSHOT]
at org.opencastproject.util.persistence.PersistenceEnvs$3.tx(PersistenceEnvs.java:100)[141:matterhorn-common:2.2.0.SNAPSHOT]
at org.opencastproject.util.persistence.PersistenceUtil$1.tx(PersistenceUtil.java:148)[141:matterhorn-common:2.2.0.SNAPSHOT]
at org.opencastproject.authorization.xacml.manager.impl.persistence.JpaAclDb.createAcl(JpaAclDb.java:78)[176:matterhorn-authorization-manager:2.2.0.SNAPSHOT]
at org.opencastproject.authorization.xacml.manager.impl.AclServiceImpl.createAcl(AclServiceImpl.java:461)[176:matterhorn-authorization-manager:2.2.0.SNAPSHOT]
at org.opencastproject.authorization.xacml.manager.impl.AclScanner.addAcl(AclScanner.java:145)[176:matterhorn-authorization-manager:2.2.0.SNAPSHOT]
at org.opencastproject.authorization.xacml.manager.impl.AclScanner.install(AclScanner.java:264)[176:matterhorn-authorization-manager:2.2.0.SNAPSHOT]
at org.apache.felix.fileinstall.internal.DirectoryWatcher.install(DirectoryWatcher.java:929)[7:org.apache.felix.fileinstall:3.5.2]
at org.apache.felix.fileinstall.internal.DirectoryWatcher.install(DirectoryWatcher.java:863)[7:org.apache.felix.fileinstall:3.5.2]
at org.apache.felix.fileinstall.internal.DirectoryWatcher.doProcess(DirectoryWatcher.java:479)[7:org.apache.felix.fileinstall:3.5.2]
at org.apache.felix.fileinstall.internal.DirectoryWatcher.process(DirectoryWatcher.java:355)[7:org.apache.felix.fileinstall:3.5.2]
at org.apache.felix.fileinstall.internal.DirectoryWatcher.run(DirectoryWatcher.java:307)[7:org.apache.felix.fileinstall:3.5.2]
Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Duplicate entry 'public-mh_default_org' for key 'UNQ_mh_acl_managed_acl'
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)[:1.8.0_92]
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)[:1.8.0_92]
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)[:1.8.0_92]
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)[:1.8.0_92]
at com.mysql.jdbc.Util.handleNewInstance(Util.java:411)[143:matterhorn-db:2.2.0.SNAPSHOT]
at com.mysql.jdbc.Util.getInstance(Util.java:386)[143:matterhorn-db:2.2.0.SNAPSHOT]
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1041)[143:matterhorn-db:2.2.0.SNAPSHOT]
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4237)[143:matterhorn-db:2.2.0.SNAPSHOT]
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4169)[143:matterhorn-db:2.2.0.SNAPSHOT]
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2617)[143:matterhorn-db:2.2.0.SNAPSHOT]
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2778)[143:matterhorn-db:2.2.0.SNAPSHOT]
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2834)[143:matterhorn-db:2.2.0.SNAPSHOT]
at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2156)[143:matterhorn-db:2.2.0.SNAPSHOT]
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2441)[143:matterhorn-db:2.2.0.SNAPSHOT]
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2366)[143:matterhorn-db:2.2.0.SNAPSHOT]
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2350)[143:matterhorn-db:2.2.0.SNAPSHOT]
at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeUpdate(NewProxyPreparedStatement.java:105)[143:matterhorn-db:2.2.0.SNAPSHOT]
at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.executeDirectNoSelect(DatabaseAccessor.java:892)[79:org.eclipse.persistence.core:2.6.0.v20150309-bf26070]
... 43 more

Activity

Show:
Lars Kiesow
December 22, 2016, 4:20 PM

This has been fixed already

Stephen Marquard
August 16, 2016, 11:55 AM

I think this is a duplicate of

Stephen Marquard
June 21, 2016, 8:40 AM

----Original Message----
From: Paul Pettit p.pettit@keele.ac.uk
Sent: 21 June 2016 10:35 AM
To: matterhorn@opencast.org
Subject: Re: [Matterhorn] MySQLIntegrityConstraintViolationException from AclScanner in 2.2

Hi Stephen,

I am seeing a similar error when doing some testing using the internal
H2 database so i guess it is not a MySQL problem?

http://pastebin.com/4WnvNnaV

Thanks,

Paul.

Stephen Marquard
June 21, 2016, 8:39 AM

DDL from docs/scripts/ddl/mysql5.sql:


– ACL manager

CREATE TABLE mh_acl_managed_acl (
pk BIGINT(20) NOT NULL,
acl TEXT NOT NULL,
name VARCHAR(128) NOT NULL,
organization_id VARCHAR(128) NOT NULL,
PRIMARY KEY (pk),
CONSTRAINT UNQ_mh_acl_managed_acl UNIQUE (name, organization_id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

Duplicate

Assignee

Lars Kiesow

Reporter

Stephen Marquard

Severity

Incorrectly Functioning With Workaround