Details
-
Bug
-
Resolution: Fixed
-
High
-
3.5, 3.5.1, 3.5.2, 3.5.3, 3.5.4, 3.5.5, 3.5.6
-
None
-
ORACLE database (10 & 11)
Description
Summary of The Bug
ORACLE database users (10/11) could not modify their user directories, due to UNIQUE CONSTRAINT ERROR thrown by Confluence:
2011-05-07 00:39:13,768 ERROR [http-8353-1] [sf.hibernate.util.JDBCExceptionReporter] logExceptions ORA-00001: unique constraint (SEPCONFTWO.SYS_C004591) violated -- referer: http://localhost:8353/plugins/servlet/embedded-crowd/configure/ldap/ | url: /plugins/servlet/embedded-crowd/configure/ldap/ | userName: admin 2011-05-07 00:39:13,770 ERROR [http-8353-1] [sf.hibernate.impl.SessionImpl] execute Could not synchronize database state with session -- referer: http://localhost:8353/plugins/servlet/embedded-crowd/configure/ldap/ | url: /plugins/servlet/embedded-crowd/configure/ldap/ | userName: admin 2011-05-07 00:39:13,841 ERROR [http-8353-1] [atlassian.plugin.servlet.ServletModuleContainerServlet] service Request processing failed; nested exception is org.springframework.dao.DataIntegrityViolationException: Hibernate operation: could not insert collection rows: [com.atlassian.crowd.model.directory.DirectoryImpl.attributes#327682]; SQL []; ORA-00001: unique constraint (SEPCONFTWO.SYS_C004591) violated ; nested exception is java.sql.SQLException: ORA-00001: unique constraint (SEPCONFTWO.SYS_C004591) violated -- referer: http://localhost:8353/plugins/servlet/embedded-crowd/configure/ldap/ | url: /plugins/servlet/embedded-crowd/configure/ldap/ | userName: admin org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.springframework.dao.DataIntegrityViolationException: Hibernate operation: could not insert collection rows: [com.atlassian.crowd.model.directory.DirectoryImpl.attributes#327682]; SQL []; ORA-00001: unique constraint (SEPCONFTWO.SYS_C004591) violated ; nested exception is java.sql.SQLException: ORA-00001: unique constraint (SEPCONFTWO.SYS_C004591) violated
Steps to reproduce
- Install Confluence 3.5.x instance with ORACLE (10/11) database
- Create a new LDAP Directory, test and save it.
- Edit the directory (modify some of the LDAP attributes, eg. User Schema Settings > User Object Filter). Test and save. A System Error will be thrown.
Fix
Use the attached patch to resolve the issue. To install the patch, extract it to your <confluence-install-dir>/confluence/WEB-INF/classes directory. Ensure that the following files are created:
- com/atlassian/crowd/embedded/hibernate2/HibernateDirectoryDao$1.class
- com/atlassian/crowd/embedded/hibernate2/HibernateDirectoryDao$2.class
- com/atlassian/crowd/embedded/hibernate2/HibernateDirectoryDao.class
Then, restart Confluence.
Cause
This occurs due to Oracle treating blank strings and null values as equal, and Hibernate 2 not being smart enough to realise that the same entry already exists, because in Java, a blank string is not equal to a null. This causes Hibernate to try to insert a row that already exists.
MySQL DEBUG log
2011-05-04 18:46:16,007 DEBUG [QuartzScheduler_Worker-2] [net.sf.hibernate.SQL] log select attributes0_.directory_id as director1___, attributes0_.attribute_value as attribut2___, attributes0_.attribute_name as attribut3___ from cwd_directory_attribute attributes0_ where attributes0_.directory_id=? 2011-05-04 18:46:16,017 DEBUG [QuartzScheduler_Worker-2] [net.sf.hibernate.SQL] log update cwd_directory set directory_name=?, lower_directory_name=?, created_date=?, updated_date=?, active=?, description=?, impl_class=?, lower_impl_class=?, directory_type=? where id=? 2011-05-04 18:46:16,018 DEBUG [QuartzScheduler_Worker-2] [net.sf.hibernate.SQL] log delete from cwd_directory_attribute where directory_id=? and attribute_name=? 2011-05-04 18:46:16,018 DEBUG [QuartzScheduler_Worker-2] [net.sf.hibernate.SQL] log update cwd_directory_attribute set attribute_value=? where directory_id=? and attribute_name=?
ORACLE DEBUG log
2011-05-06 23:58:51,560 DEBUG [http-8080-5] [net.sf.hibernate.SQL] log update cwd_directory set directory_name=?, lower_directory_name=?, created_date=?, updated_date=?, active=?, description=?, impl_class=?, lower_impl_class=?, directory_type=? where id=? 2011-05-06 23:58:51,563 DEBUG [http-8080-5] [net.sf.hibernate.SQL] log delete from cwd_directory_operation where directory_id=? 2011-05-06 23:58:51,576 DEBUG [http-8080-5] [net.sf.hibernate.SQL] log delete from cwd_directory_attribute where directory_id=? and attribute_name=? 2011-05-06 23:58:51,579 DEBUG [http-8080-5] [net.sf.hibernate.SQL] log update cwd_directory_attribute set attribute_value=? where directory_id=? and attribute_name=? 2011-05-06 23:58:51,581 DEBUG [http-8080-5] [net.sf.hibernate.SQL] log insert into cwd_directory_attribute (directory_id, attribute_name, attribute_value) values (?, ?, ?) 2011-05-06 23:58:51,622 ERROR [http-8080-5] [sf.hibernate.util.JDBCExceptionReporter] logExceptions ORA-00001: unique constraint (SEPCONFONE.SYS_C004301) violated
Attachments
Issue Links
- is duplicated by
-
CONFSERVER-22703 User Directory update caused System Error when using Oracle
- Closed
- is related to
-
CWD-2596 Correctly handle empty/null directory attribute values when using Oracle
- Under Consideration
- relates to
-
CONFSERVER-24645 Getting System Error page when trying to edit User Directory or adding "Default Group Memberships" in Confluence 3.5.9 or higher for Oracle users
- Closed