org.springframework.dao.DataIntegrityViolationException: could not perform addBatch; SQL [delete from cwd_app_dir_group_mapping where id=?]; constraint [null]; nested exception is org.hibernate.exception.ConstraintViolationException: could not perform addBatch

Atlassian JIRA | Michael Duong [Atlassian] | 2 years ago
  1. 0

    h3. Summary System error occurs when deleting Crowd Internal Directory that was set up during install when logged in as System Administrator defined in other directory. h3. Environment * Crowd 2.8.0 connected to Apache Directory Server 1.5.X * java version "1.8.0_45" h3. Steps to Reproduce # Log in as a user with System Administrator permissions. # Navigate to directories by clicking on Directories tab. # View the directory that has type "Crowd Internal Directory" and remove checkmark from Active field # Remove directory by clicking on Remove directory on the side bar. # Press Continue to remove the directory. h3. Expected Results Crowd Internal Directory would be deleted from the directories of Crowd. h3. Actual Results System error is seen in the browser. The below exception is thrown in the atlassian-crowd.log file: {code} 2015-05-08 12:04:46,447 http-bio-8095-exec-17 WARN [engine.jdbc.spi.SqlExceptionHelper] SQL Error: 0, SQLState: 23503 2015-05-08 12:04:46,447 http-bio-8095-exec-17 ERROR [engine.jdbc.spi.SqlExceptionHelper] Batch entry 0 delete from cwd_app_dir_group_mapping where id=262145 was aborted. Call getNextException to see the cause. 2015-05-08 12:04:46,447 http-bio-8095-exec-17 WARN [engine.jdbc.spi.SqlExceptionHelper] SQL Error: 0, SQLState: 23503 2015-05-08 12:04:46,447 http-bio-8095-exec-17 ERROR [engine.jdbc.spi.SqlExceptionHelper] ERROR: update or delete on table "cwd_app_dir_group_mapping" violates foreign key constraint "fk_permission_group" on table "cwd_granted_perm" Detail: Key (id)=(262145) is still referenced from table "cwd_granted_perm". 2015-05-08 12:04:46,447 http-bio-8095-exec-17 ERROR [jdbc.batch.internal.BatchingBatch] HHH000315: Exception executing batch [could not perform addBatch] 2015-05-08 12:04:46,447 http-bio-8095-exec-17 INFO [crowd.xwork.interceptors.TransactionalInvocation] Invoking rollback for transaction on action '/console/secure/directory/remove.action (RemoveDirectory.default())' due to throwable: org.springframework.dao.DataIntegrityViolationException: could not perform addBatch; SQL [delete from cwd_app_dir_group_mapping where id=?]; constraint [null]; nested exception is org.hibernate.exception.ConstraintViolationException: could not perform addBatch org.springframework.dao.DataIntegrityViolationException: could not perform addBatch; SQL [delete from cwd_app_dir_group_mapping where id=?]; constraint [null]; nested exception is org.hibernate.exception.ConstraintViolationException: could not perform addBatch at org.springframework.orm.hibernate4.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:138) at org.springframework.orm.hibernate4.HibernateTransactionManager.convertHibernateAccessException(HibernateTransactionManager.java:678) at org.springframework.orm.hibernate4.HibernateTransactionManager.doCommit(HibernateTransactionManager.java:560) ... Caused by: org.hibernate.exception.ConstraintViolationException: could not perform addBatch at org.hibernate.exception.internal.SQLStateConversionDelegate.convert(SQLStateConversionDelegate.java:129) at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:49) at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:124) Caused by: java.sql.BatchUpdateException: Batch entry 0 delete from cwd_app_dir_group_mapping where id=262145 was aborted. Call getNextException to see the cause. at org.postgresql.jdbc2.AbstractJdbc2Statement$BatchResultHandler.handleError(AbstractJdbc2Statement.java:2746) ... 2015-05-08 12:04:46,449 http-bio-8095-exec-17 ERROR [crowd.xwork.interceptors.TransactionalInvocation] Action /console/secure/directory/remove.action (RemoveDirectory.default()) is already completed and can not be committed again. 2015-05-08 12:04:46,449 http-bio-8095-exec-17 ERROR [[Catalina].[localhost].[/crowd].[default]] Servlet.service() for servlet [default] in context with path [/crowd] threw exception [org.springframework.dao.DataIntegrityViolationException: could not perform addBatch; SQL [delete from cwd_app_dir_group_mapping where id=?]; constraint [null]; nested exception is org.hibernate.exception.ConstraintViolationException: could not perform addBatch] with root cause java.sql.BatchUpdateException: Batch entry 0 delete from cwd_app_dir_group_mapping where id=262145 was aborted. Call getNextException to see the cause. at org.postgresql.jdbc2.AbstractJdbc2Statement$BatchResultHandler.handleError(AbstractJdbc2Statement.java:2746) at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1887) ... 2015-05-08 12:04:46,450 http-bio-8095-exec-17 ERROR [500ErrorPage] Exception caught in 500 page could not perform addBatch; SQL [delete from cwd_app_dir_group_mapping where id=?]; constraint [null]; nested exception is org.hibernate.exception.ConstraintViolationException: could not perform addBatch org.springframework.dao.DataIntegrityViolationException: could not perform addBatch; SQL [delete from cwd_app_dir_group_mapping where id=?]; constraint [null]; nested exception is org.hibernate.exception.ConstraintViolationException: could not perform addBatch at org.springframework.orm.hibernate4.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:138) at org.springframework.orm.hibernate4.HibernateTransactionManager.convertHibernateAccessException(HibernateTransactionManager.java:678) ... Caused by: org.hibernate.exception.ConstraintViolationException: could not perform addBatch at org.hibernate.exception.internal.SQLStateConversionDelegate.convert(SQLStateConversionDelegate.java:129) ... Caused by: java.sql.BatchUpdateException: Batch entry 0 delete from cwd_app_dir_group_mapping where id=262145 was aborted. Call getNextException to see the cause. at org.postgresql.jdbc2.AbstractJdbc2Statement$BatchResultHandler.handleError(AbstractJdbc2Statement.java:2746) ... {code} h3. Notes Attached pdf of System error seen in the browser. Also tested in Crowd 2.8.2

    Atlassian JIRA | 2 years ago | Michael Duong [Atlassian]
    org.springframework.dao.DataIntegrityViolationException: could not perform addBatch; SQL [delete from cwd_app_dir_group_mapping where id=?]; constraint [null]; nested exception is org.hibernate.exception.ConstraintViolationException: could not perform addBatch
  2. 0

    h3. Summary System error occurs when deleting Crowd Internal Directory that was set up during install when logged in as System Administrator defined in other directory. h3. Environment * Crowd 2.8.0 connected to Apache Directory Server 1.5.X * java version "1.8.0_45" h3. Steps to Reproduce # Log in as a user with System Administrator permissions. # Navigate to directories by clicking on Directories tab. # View the directory that has type "Crowd Internal Directory" and remove checkmark from Active field # Remove directory by clicking on Remove directory on the side bar. # Press Continue to remove the directory. h3. Expected Results Crowd Internal Directory would be deleted from the directories of Crowd. h3. Actual Results System error is seen in the browser. The below exception is thrown in the atlassian-crowd.log file: {code} 2015-05-08 12:04:46,447 http-bio-8095-exec-17 WARN [engine.jdbc.spi.SqlExceptionHelper] SQL Error: 0, SQLState: 23503 2015-05-08 12:04:46,447 http-bio-8095-exec-17 ERROR [engine.jdbc.spi.SqlExceptionHelper] Batch entry 0 delete from cwd_app_dir_group_mapping where id=262145 was aborted. Call getNextException to see the cause. 2015-05-08 12:04:46,447 http-bio-8095-exec-17 WARN [engine.jdbc.spi.SqlExceptionHelper] SQL Error: 0, SQLState: 23503 2015-05-08 12:04:46,447 http-bio-8095-exec-17 ERROR [engine.jdbc.spi.SqlExceptionHelper] ERROR: update or delete on table "cwd_app_dir_group_mapping" violates foreign key constraint "fk_permission_group" on table "cwd_granted_perm" Detail: Key (id)=(262145) is still referenced from table "cwd_granted_perm". 2015-05-08 12:04:46,447 http-bio-8095-exec-17 ERROR [jdbc.batch.internal.BatchingBatch] HHH000315: Exception executing batch [could not perform addBatch] 2015-05-08 12:04:46,447 http-bio-8095-exec-17 INFO [crowd.xwork.interceptors.TransactionalInvocation] Invoking rollback for transaction on action '/console/secure/directory/remove.action (RemoveDirectory.default())' due to throwable: org.springframework.dao.DataIntegrityViolationException: could not perform addBatch; SQL [delete from cwd_app_dir_group_mapping where id=?]; constraint [null]; nested exception is org.hibernate.exception.ConstraintViolationException: could not perform addBatch org.springframework.dao.DataIntegrityViolationException: could not perform addBatch; SQL [delete from cwd_app_dir_group_mapping where id=?]; constraint [null]; nested exception is org.hibernate.exception.ConstraintViolationException: could not perform addBatch at org.springframework.orm.hibernate4.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:138) at org.springframework.orm.hibernate4.HibernateTransactionManager.convertHibernateAccessException(HibernateTransactionManager.java:678) at org.springframework.orm.hibernate4.HibernateTransactionManager.doCommit(HibernateTransactionManager.java:560) ... Caused by: org.hibernate.exception.ConstraintViolationException: could not perform addBatch at org.hibernate.exception.internal.SQLStateConversionDelegate.convert(SQLStateConversionDelegate.java:129) at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:49) at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:124) Caused by: java.sql.BatchUpdateException: Batch entry 0 delete from cwd_app_dir_group_mapping where id=262145 was aborted. Call getNextException to see the cause. at org.postgresql.jdbc2.AbstractJdbc2Statement$BatchResultHandler.handleError(AbstractJdbc2Statement.java:2746) ... 2015-05-08 12:04:46,449 http-bio-8095-exec-17 ERROR [crowd.xwork.interceptors.TransactionalInvocation] Action /console/secure/directory/remove.action (RemoveDirectory.default()) is already completed and can not be committed again. 2015-05-08 12:04:46,449 http-bio-8095-exec-17 ERROR [[Catalina].[localhost].[/crowd].[default]] Servlet.service() for servlet [default] in context with path [/crowd] threw exception [org.springframework.dao.DataIntegrityViolationException: could not perform addBatch; SQL [delete from cwd_app_dir_group_mapping where id=?]; constraint [null]; nested exception is org.hibernate.exception.ConstraintViolationException: could not perform addBatch] with root cause java.sql.BatchUpdateException: Batch entry 0 delete from cwd_app_dir_group_mapping where id=262145 was aborted. Call getNextException to see the cause. at org.postgresql.jdbc2.AbstractJdbc2Statement$BatchResultHandler.handleError(AbstractJdbc2Statement.java:2746) at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1887) ... 2015-05-08 12:04:46,450 http-bio-8095-exec-17 ERROR [500ErrorPage] Exception caught in 500 page could not perform addBatch; SQL [delete from cwd_app_dir_group_mapping where id=?]; constraint [null]; nested exception is org.hibernate.exception.ConstraintViolationException: could not perform addBatch org.springframework.dao.DataIntegrityViolationException: could not perform addBatch; SQL [delete from cwd_app_dir_group_mapping where id=?]; constraint [null]; nested exception is org.hibernate.exception.ConstraintViolationException: could not perform addBatch at org.springframework.orm.hibernate4.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:138) at org.springframework.orm.hibernate4.HibernateTransactionManager.convertHibernateAccessException(HibernateTransactionManager.java:678) ... Caused by: org.hibernate.exception.ConstraintViolationException: could not perform addBatch at org.hibernate.exception.internal.SQLStateConversionDelegate.convert(SQLStateConversionDelegate.java:129) ... Caused by: java.sql.BatchUpdateException: Batch entry 0 delete from cwd_app_dir_group_mapping where id=262145 was aborted. Call getNextException to see the cause. at org.postgresql.jdbc2.AbstractJdbc2Statement$BatchResultHandler.handleError(AbstractJdbc2Statement.java:2746) ... {code} h3. Notes Attached pdf of System error seen in the browser. Also tested in Crowd 2.8.2

    Atlassian JIRA | 2 years ago | Michael Duong [Atlassian]
    org.springframework.dao.DataIntegrityViolationException: could not perform addBatch; SQL [delete from cwd_app_dir_group_mapping where id=?]; constraint [null]; nested exception is org.hibernate.exception.ConstraintViolationException: could not perform addBatch
  3. 0

    Hibernate - No value specified for parameter

    Stack Overflow | 2 years ago | slyder07
    org.springframework.dao.DataIntegrityViolationException: could not execute statement; SQL [n/a]; nested exception is org.hibernate.exception.DataException: could not execute statement
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    Spring aop @AfterThrowing fail when method annotate @Transaction

    Stack Overflow | 2 years ago | JAson GONG
    org.springframework.dao.DataIntegrityViolationException: could not execute statement; SQL [n/a]; nested exception is org.hibernate.exception.DataException: could not execute statement at org.springframework.orm.hibernate4.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:143)
  6. 0

    Trying to create composite primary key using Hibernate annotations for a One-To-Many relationship

    Stack Overflow | 3 years ago | rawkfist0215
    org.springframework.dao.DataIntegrityViolationException: Duplicate entry '55' for key 'article_id'; SQL [n/a]; constraint [null]; nested exception is org.hibernate.exception.ConstraintViolationException: Duplicate entry '55' for key 'article_id'

    2 unregistered visitors
    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. org.springframework.dao.DataIntegrityViolationException

      could not perform addBatch; SQL [delete from cwd_app_dir_group_mapping where id=?]; constraint [null]; nested exception is org.hibernate.exception.ConstraintViolationException: could not perform addBatch

      at org.springframework.orm.hibernate4.SessionFactoryUtils.convertHibernateAccessException()
    2. Spring ORM
      HibernateTransactionManager.doCommit
      1. org.springframework.orm.hibernate4.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:138)
      2. org.springframework.orm.hibernate4.HibernateTransactionManager.convertHibernateAccessException(HibernateTransactionManager.java:678)
      3. org.springframework.orm.hibernate4.HibernateTransactionManager.doCommit(HibernateTransactionManager.java:560)
      3 frames