core
core copied to clipboard
Push Publishing: User Role ID is not pushed properly to Receiver side
Reproduced in 2.5.6. Here are the steps to reproduce:
- Create an user in Sender side. Check its user role id in the database (this role is not accesible through the Roles & Tabs portlet).
- Assign any workflow task to this user so there's a pending workflow task.
- Push only the User to the Receiver side. Check its user role id in DB. It's different from the sender side.
- Push the structure with the pending workflow tasks. The push will fail.
[01/12/14 14:04:02:448 EST] WARN util.JDBCExceptionReporter: SQL Error: 0, SQLState: 23503
[01/12/14 14:04:02:448 EST] ERROR util.JDBCExceptionReporter: ERROR: insert or update on table "workflow_task" violates foreign key constraint "fk_workflow_assign"
Detail: Key (assigned_to)=(c10743d8-3fb2-41cb-97c4-c8d874114bdd) is not present in table "cms_role".
[01/12/14 14:04:02:448 EST] ERROR impl.SessionImpl: Could not synchronize database state with session
[01/12/14 14:04:02:458 EST] ERROR business.PublisherAPIImpl: Error Publishing Bundle: Unable to flush Hibernate Session
com.dotcms.publishing.DotPublishingException: Unable to flush Hibernate Session
at com.dotcms.enterprise.publishing.remote.handler.ContentWorkflowHandler.a(SourceFile:79)
at com.dotcms.enterprise.publishing.remote.handler.ContentWorkflowHandler.handle(SourceFile:34)
at com.dotcms.publisher.receiver.BundlePublisher.process(BundlePublisher.java:161)
at com.dotcms.rest.PublishThread.run(PublishThread.java:40)
at java.lang.Thread.run(Thread.java:745)
Caused by: com.dotmarketing.exception.DotHibernateException: Unable to flush Hibernate Session
at com.dotmarketing.db.HibernateUtil.saveWithPrimaryKey(HibernateUtil.java:869)
at com.dotmarketing.portlets.workflows.business.WorkflowFactoryImpl.saveWorkflowTask(WorkflowFactoryImpl.java:1267)
at com.dotmarketing.portlets.workflows.business.WorkflowAPIImpl.saveWorkflowTask(WorkflowAPIImpl.java:375)
at com.dotcms.enterprise.publishing.remote.handler.ContentWorkflowHandler.a(SourceFile:66)
... 4 more
Caused by: net.sf.hibernate.exception.ConstraintViolationException: could not insert: [com.dotmarketing.portlets.workflows.model.WorkflowTask#9c2ed1ee-d8c1-4a96-ab75-a4e1bcfcc461]
at net.sf.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:62)
at net.sf.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:29)
at net.sf.hibernate.persister.AbstractEntityPersister.convert(AbstractEntityPersister.java:1331)
at net.sf.hibernate.persister.EntityPersister.insert(EntityPersister.java:472)
at net.sf.hibernate.persister.EntityPersister.insert(EntityPersister.java:436)
at net.sf.hibernate.impl.ScheduledInsertion.execute(ScheduledInsertion.java:37)
at net.sf.hibernate.impl.SessionImpl.execute(SessionImpl.java:2449)
at net.sf.hibernate.impl.SessionImpl.executeAll(SessionImpl.java:2435)
at net.sf.hibernate.impl.SessionImpl.execute(SessionImpl.java:2392)
at net.sf.hibernate.impl.SessionImpl.flush(SessionImpl.java:2261)
at com.dotmarketing.db.HibernateUtil.saveWithPrimaryKey(HibernateUtil.java:867)
... 7 more
Caused by: org.postgresql.util.PSQLException: ERROR: insert or update on table "workflow_task" violates foreign key constraint "fk_workflow_assign"
Detail: Key (assigned_to)=(c10743d8-3fb2-41cb-97c4-c8d874114bdd) is not present in table "cms_role".
at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2102)
at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1835)
at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:257)
at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:500)
at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:388)
at org.postgresql.jdbc2.AbstractJdbc2Statement.executeUpdate(AbstractJdbc2Statement.java:334)
at org.apache.tomcat.dbcp.dbcp.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:102)
at net.sf.hibernate.impl.NonBatchingBatcher.addToBatch(NonBatchingBatcher.java:22)
at net.sf.hibernate.persister.EntityPersister.insert(EntityPersister.java:462)
... 14 more
[01/12/14 14:04:02:460 EST] ERROR lang.String: Error Publishing: com.dotcms.publishing.DotPublishingException: Unable to flush Hibernate Session
[01/12/14 14:04:02:460 EST] INFO rest.PublishThread: : [BundleID: 40af6dc5-ac10-4fc2-b683-58984ffd0951.tar.gz] Finished bundle publish process
This happens because the User Role id is different between both sides of the Push Publishing environment (sender and receiver). The only way to push the structure and its contents is by changing the User Role Id manually in the Receiver side's DB. This workaround ensures the Push Publishing task to finish successfully.
merged into master-3.1
Tested in master-3.1//Win7//Postgres//Chrome
Removing label "Needs QA" as this was already tested and verified by Prasad