Cannot delete users from crowd
Asked by William Webber:

Cannot delete user from crowd.

system error has occurred please contact your administrator.

If this problem continues to occur please contact Atlassian by opening a support request with the following information:

- A description of your problem and what you were doing at the time it occurred

- Cut \& paste the error and system information found below

- Attach the application server log file (if possible).

Cause :

org.springframework.dao.DataIntegrityViolationException: Could not execute JDBC batch update; SQL delete from cwd_user where id=? ; constraint null ; nested exception is org.hibernate.exception.ConstraintViolationException: Could not execute JDBC batch update

Stack Trace :

org.springframework.dao.DataIntegrityViolationException: Could not execute JDBC batch update; SQL delete from cwd_user where id=? ; constraint null ; nested exception is org.hibernate.exception.ConstraintViolationException: Could not execute JDBC batch update

at org.springframework.orm.hibernate3.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:641)

at org.springframework.orm.hibernate3.HibernateTransactionManager.convertHibernateAccessException(HibernateTransactionManager.java:793)

at org.springframework.orm.hibernate3.HibernateTransactionManager.doCommit(HibernateTransactionManager.java:664)

at org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:754)

at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:723)

at com.atlassian.xwork.interceptors.TransactionalInvocation.commitOrRollbackTransaction(TransactionalInvocation.java:107)

at com.atlassian.xwork.interceptors.TransactionalInvocation.access$000(TransactionalInvocation.java:18)

at com.atlassian.xwork.interceptors.TransactionalInvocation$1.beforeResult(TransactionalInvocation.java:49)

at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:202)

at com.atlassian.xwork.interceptors.XsrfTokenInterceptor.intercept(XsrfTokenInterceptor.java:100)

at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:190)

at com.opensymphony.xwork.interceptor.AroundInterceptor.intercept(AroundInterceptor.java:31)

at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:190)

at com.opensymphony.xwork.interceptor.AroundInterceptor.intercept(AroundInterceptor.java:31)

at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:190)

at com.opensymphony.xwork.interceptor.AroundInterceptor.intercept(AroundInterceptor.java:31)

at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:190)

at com.opensymphony.xwork.interceptor.AroundInterceptor.intercept(AroundInterceptor.java:31)

at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:190)

at com.opensymphony.xwork.interceptor.AroundInterceptor.intercept(AroundInterceptor.java:31)

at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:190)

at com.atlassian.xwork.interceptors.TransactionalInvocation.invokeAndHandleExceptions(TransactionalInvocation.java:76)

at com.atlassian.xwork.interceptors.TransactionalInvocation.invokeInTransaction(TransactionalInvocation.java:61)

at com.atlassian.xwork.interceptors.XWorkTransactionInterceptor.intercept(XWorkTransactionInterceptor.java:56)

at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:190)

at com.opensymphony.xwork.DefaultActionProxy.execute(DefaultActionProxy.java:116)

at com.opensymphony.webwork.dispatcher.DispatcherUtils.serviceAction(DispatcherUtils.java:273)

at com.opensymphony.webwork.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:202)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)

at com.opensymphony.module.sitemesh.filter.PageFilter.parsePage(PageFilter.java:119)

at com.opensymphony.module.sitemesh.filter.PageFilter.doFilter(PageFilter.java:55)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)

at com.atlassian.plugin.servlet.filter.IteratingFilterChain.doFilter(IteratingFilterChain.java:46)

at com.atlassian.plugin.servlet.filter.ServletFilterModuleContainerFilter.doFilter(ServletFilterModuleContainerFilter.java:77)

at com.atlassian.plugin.servlet.filter.ServletFilterModuleContainerFilter.doFilter(ServletFilterModuleContainerFilter.java:63)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)

at com.opensymphony.webwork.dispatcher.ActionContextCleanUp.doFilter(ActionContextCleanUp.java:88)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)

at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:311)

at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:116)

at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:83)

at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)

at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:113)

at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)

at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:101)

at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)

at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:113)

at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)

at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:54)

at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)

at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:45)

at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)

at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:182)

at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)

at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:105)

at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)

at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:87)

at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)

at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:173)

at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346)

at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:259)

at com.atlassian.crowd.console.filter.CrowdDelegatingFilterProxy.doFilter(CrowdDelegatingFilterProxy.java:38)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)

at com.atlassian.plugin.servlet.filter.IteratingFilterChain.doFilter(IteratingFilterChain.java:46)

at com.atlassian.plugin.servlet.filter.ServletFilterModuleContainerFilter.doFilter(ServletFilterModuleContainerFilter.java:77)

at com.atlassian.plugin.servlet.filter.ServletFilterModuleContainerFilter.doFilter(ServletFilterModuleContainerFilter.java:63)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)

at com.atlassian.crowd.console.filter.LicenceFilter.doFilterInternal(LicenceFilter.java:56)

at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)

at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346)

at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:259)

at com.atlassian.crowd.console.filter.CrowdDelegatingFilterProxy.doFilter(CrowdDelegatingFilterProxy.java:38)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)

at com.atlassian.johnson.filters.AbstractJohnsonFilter.doFilter(AbstractJohnsonFilter.java:67)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)

at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:70)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)

at org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:198)

at com.atlassian.crowd.console.filter.CrowdOpenSessionInViewFilter.doFilterInternal(CrowdOpenSessionInViewFilter.java:26)

at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)

at com.atlassian.crowd.plugin.web.filter.RequestCacheThreadLocalFilter.doFilter(RequestCacheThreadLocalFilter.java:31)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)

at com.atlassian.gzipfilter.GzipFilter.doFilterInternal(GzipFilter.java:74)

at com.atlassian.gzipfilter.GzipFilter.doFilter(GzipFilter.java:51)

at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346)

at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:259)

at com.atlassian.crowd.console.filter.CrowdDelegatingFilterProxy.doFilter(CrowdDelegatingFilterProxy.java:38)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)

at com.atlassian.plugin.servlet.filter.IteratingFilterChain.doFilter(IteratingFilterChain.java:46)

at com.atlassian.plugin.servlet.filter.ServletFilterModuleContainerFilter.doFilter(ServletFilterModuleContainerFilter.java:77)

at com.atlassian.plugin.servlet.filter.ServletFilterModuleContainerFilter.doFilter(ServletFilterModuleContainerFilter.java:63)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)

at com.atlassian.core.filters.cache.AbstractCachingFilter.doFilter(AbstractCachingFilter.java:33)

at com.atlassian.core.filters.AbstractHttpFilter.doFilter(AbstractHttpFilter.java:31)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)

at com.atlassian.core.filters.encoding.AbstractEncodingFilter.doFilter(AbstractEncodingFilter.java:41)

at com.atlassian.core.filters.AbstractHttpFilter.doFilter(AbstractHttpFilter.java:31)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)

at com.atlassian.core.filters.encoding.AbstractEncodingFilter.doFilter(AbstractEncodingFilter.java:41)

at com.atlassian.core.filters.AbstractHttpFilter.doFilter(AbstractHttpFilter.java:31)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)

at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)

at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)

at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)

at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)

at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)

at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)

at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859)

at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)

at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)

at java.lang.Thread.run(Thread.java:619)

Caused by: org.hibernate.exception.ConstraintViolationException: Could not execute JDBC batch update

at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:71)

at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)

at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:254)

at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:266)

at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:172)

at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:298)

at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27)

at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1001)

at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:339)

at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:106)

at org.springframework.orm.hibernate3.HibernateTransactionManager.doCommit(HibernateTransactionManager.java:656)

... 125 more

Caused by: java.sql.BatchUpdateException: Cannot delete or update a parent row: a foreign key constraint fails (\`crowd\`.\`cwd_user_credential_record\`, CONSTRAINT \`fk_user_cred_user\` FOREIGN KEY (\`user_id\`) REFERENCES \`cwd_user\` (\`id\`))

at com.mysql.jdbc.PreparedStatement.executeBatchSerially(PreparedStatement.java:2020)

at com.mysql.jdbc.PreparedStatement.executeBatch(PreparedStatement.java:1451)

at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeBatch(NewProxyPreparedStatement.java:1723)

at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:48)

at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:247)

... 133 more

Referer : [http://xxx.xxx.xxx.xxx:8095/crowd/console/secure/user/remove.action?directoryID=32769\&name=ballen](http://xxx.xxx.xxx.xxx:8095/crowd/console/secure/user/remove.action?directoryID=32769&name=ballen)

Build Information :

Version : 2.5.0 (Build:#582 - 02-08-2012)

Memory Information :

Total Memory : 124 MB

Free Memory : 62 MB

Used Memory : 61 MB

Request Information :

- Request URL : <http://xxx.xxx.xxx.xxx:8095/crowd/console/500.jsp>

- Scheme : http

- Server : xxx.xxx.xxx.xxx

- Port : 8095

- URI : /crowd/console/500.jsp

- Context Path : /crowd

- - Servlet Path : /console/500.jsp

- - Path Info : null

- - Query String :

Request Attributes :

- javax.servlet.forward.request_uri : /crowd/console/secure/user/remove!update.action

- javax.servlet.forward.context_path : /crowd

- javax.servlet.forward.servlet_path : /console/secure/user/remove!update.action

- javax.servlet.forward.path_info : /console/500.jsp

- javax.servlet.error.status_code : 500

- javax.servlet.error.servlet_name : default

- __spring_security_session_mgmt_filter_applied : true

- __cleanup_counter : 0

- com.atlassian.gzipfilter.GzipFilter_already_filtered : true

- com.atlassian.johnson.filters.JohnsonFilter_already_filtered : true

- gzipMimeTypes : text/.\*,application/x-javascript,application/javascript,application/xml,application/xhtml +xml

- com.atlassian.crowd.integration.http.HttpAuthenticator.REQUEST_SSO_COOKIE_COMMITTED : true

- javax.servlet.error.message :

- webwork.valueStack : com.opensymphony.xwork.util.OgnlValueStack@83c633

- com.atlassian.gzipfilter.org.tuckey.web.filters.urlrewrite.RuleMatched : true

- __sitemesh__filterapplied : true

- javax.servlet.error.exception : javax.servlet.ServletException: org.springframework.dao.DataIntegrityViolationException: Could not execute JDBC batch update; SQL delete from cwd_user where id=? ; constraint null ; nested exception is org.hibernate.exception.ConstraintViolationException: Could not execute JDBC batch update

- __spring_security_filterSecurityInterceptor_filterApplied : true

- javax.servlet.error.request_uri : /crowd/console/secure/user/remove!update.action

- crowd.token_key : 5qvweWl00Of0AUMZ1pWSxA00

Request Parameters:

- directoryID : 32769

- atl_token : 672b78100c2494823f2e746b7c4d00171b0e3e83

- name : ballen

<br />


Answers:
author: Denise Unterwurzacher [Atlassian]
body: As Super24 discovered, this is a known issue, due to multiple cwd_user_credential_record entries being created for one user. It is being tracked here:

<https://jira.atlassian.com/browse/CWD-1979>

The details for how to diagnose and work around this problem are in a KB article here:  
<https://confluence.atlassian.com/display/CROWDKB/Cannot+Delete+a+User+From+Crowd+due+to+Foreign+Key+Constraint+Failure>

Hope this helps!


author: Marcus Silveira
body: Hi Super24,

I'd advise you to open a ticket on [https://support.atlassian.com](https://support.atlassian.com.). You should attach your logs also in order to speed up the process so the support engineers already have more information to investigate this.

Hope this helps,

Marcus Silveira

comments: author: William Webber
body: The workaround at this URL solved my problem. This issue can be resolved.

<https://confluence.atlassian.com/display/CROWDKB/Cannot+Delete+a+User+From+Crowd+due+to+Foreign+Key+Constraint+Failure>