org.springframework.dao.DataIntegrityViolationException

There are no available Samebug tips for this exception. Do you have an idea how to solve this issue? A short tip would help users who saw this issue last week.

  • 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
    via by Michael Duong [Atlassian],
  • 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
    via by Michael Duong [Atlassian],
  • ExceptionHandling in Spring
    via Stack Overflow by Sharique
    ,
  • Spring4 + and Hibernate 4 Transactions
    via Stack Overflow by user1859465
    ,
    • 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)

    Users with the same issue

    Unknown visitor
    Unknown visitor1 times, last one,
    Unknown visitor
    Unknown visitor1 times, last one,
    Unknown visitor
    Unknown visitor1 times, last one,
    Unknown visitor
    Unknown visitor1 times, last one,