Notice: In order to edit this ticket you need to be either: a Product Owner, The owner or the reporter of the ticket, or, in case of a Task not yet assigned, a team_member"

Bug #1130 (closed)

Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

Ldap.createUserFromLdap() fails with NonUniqueObjectException

Reported by: jamoore Owned by: jamoore
Priority: major Cc: atarkowska
Sprint: n.a.
Total Remaining Time: n.a.

Description

After the introduction of OmeroSessions, the automatic creation of ldap users on IAdmin.checkPassword() was found to be broken.

org.springframework.orm.hibernate3.HibernateSystemException: a different object with the same identifier value was already associated with the session: [ome.model.meta.Experimenter#0]; nested exception is org.hibernate.NonUniqueObjectException: a different object with the same identifier value was already associated with the session: [ome.model.meta.Experimenter#0]
        at org.springframework.orm.hibernate3.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:661)
        at org.springframework.orm.hibernate3.HibernateAccessor.convertHibernateAccessException(HibernateAccessor.java:412)
        at org.springframework.orm.hibernate3.HibernateTemplate.doExecute(HibernateTemplate.java:424)
        at org.springframework.orm.hibernate3.HibernateTemplate.executeWithNativeSession(HibernateTemplate.java:374)
        at org.springframework.orm.hibernate3.HibernateTemplate.merge(HibernateTemplate.java:820)
        at ome.logic.UpdateImpl.internalSave(UpdateImpl.java:266)
        at ome.logic.UpdateImpl$5.run(UpdateImpl.java:161)
        at ome.logic.UpdateImpl$5.run(UpdateImpl.java:160)
        at ome.logic.UpdateImpl.doAction(UpdateImpl.java:297)
        at ome.logic.UpdateImpl.saveAndReturnObject(UpdateImpl.java:158)
        at ome.logic.AdminImpl$SecureUpdate.updateObject(AdminImpl.java:134)
        at ome.security.basic.BasicSecuritySystem.doAction(BasicSecuritySystem.java:433)
        at ome.logic.AdminImpl.linkGroupAndUser(AdminImpl.java:556)
        at ome.logic.AdminImpl.createExperimenter(AdminImpl.java:496)
        at ome.logic.LdapImpl.createUserFromLdap(LdapImpl.java:503)

Attempting to remove the extra calls to IAdmin.lookupGroups caused a different exception:

10:17:24,943 INFO  [CurrentDetails] Adding log:INSERT,class ome.model.meta.Experimenter,150
10:17:30,013 INFO  [ServiceHandler]  Meth:	interface ome.services.util.Executor$Work.doWork
10:17:30,013 INFO  [ServiceHandler]  Args:	[null, null, ome.tools.spring.InternalServiceFactory@9e3199]
10:17:30,023 INFO  [EventHandler]  Auth:	user=0,group=0,event=null(FullText)
10:17:30,062 INFO  [ServiceHandler]  Rslt:	null
10:17:40,812 WARN  [ServiceHandler] Unknown exception thrown.

org.springframework.orm.hibernate3.HibernateSystemException:  
  Exception occurred inside getter of ome.model.meta.Experimenter.annotationLinks; nested exception is  
org.hibernate.PropertyAccessException: Exception occurred inside  
getter of ome.model.meta.Experimenter.annotationLinks
	at org.springframework.orm.hibernate3.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:661)
	at org.springframework.orm.hibernate3.HibernateAccessor.convertHibernateAccessException(HibernateAccessor.java:412)
	at org.springframework.orm.hibernate3.HibernateTemplate.doExecute (HibernateTemplate.java:424)
	at org.springframework.orm.hibernate3.HibernateTemplate.executeWithNativeSession(HibernateTemplate.java:374)
	at org.springframework.orm.hibernate3.HibernateTemplate.merge (HibernateTemplate.java:820)
	at ome.logic.UpdateImpl.internalSave(UpdateImpl.java:266)
	at ome.logic.UpdateImpl$5.run(UpdateImpl.java:161)
	at ome.logic.UpdateImpl$5.run(UpdateImpl.java:160)
	at ome.logic.UpdateImpl.doAction(UpdateImpl.java:297)
	at ome.logic.UpdateImpl.saveAndReturnObject(UpdateImpl.java:158)
	at ome.logic.AdminImpl$SecureUpdate.updateObject(AdminImpl.java:133)
	at ome.security.basic.BasicSecuritySystem.doAction (BasicSecuritySystem.java:433)
	at ome.logic.AdminImpl.linkGroupAndUser(AdminImpl.java:517)
	at ome.logic.AdminImpl.createExperimenter(AdminImpl.java:484)
	at ome.logic.LdapImpl.createUserFromLdap(LdapImpl.java:506)
	at ome.logic.AdminImpl.checkPassword(AdminImpl.java:1030)
	at ome.services.sessions.SessionManagerImpl$3.doWork (SessionManagerImpl.java:703)

which is very similar to the issue mentioned in #1052 and fixed in r2668. We are now testing this solution on the SessionManagerImpl.executeCheckPassword method as well.

Change History (2)

comment:1 Changed 11 years ago by jmoore

  • Resolution set to fixed
  • Status changed from new to closed

r3063 and r3064 close this issue. For branches:OMERO-Beta3.2 this is probably an optimal fix. However, as mentioned in the commit log, another mechanism might make sense for trunk sense this could become arbitrarily complicated later.

comment:2 Changed 11 years ago by atarkowska

Note: See TracTickets for help on using tickets. You may also have a look at Agilo extensions to the ticket.

1.3.13-PRO © 2008-2011 Agilo Software all rights reserved (this page was served in: 0.77382 sec.)

We're Hiring!