[
https://issues.jboss.org/browse/GTNPORTAL-3489?page=com.atlassian.jira.pl...
]
Ahmed Zaoui updated GTNPORTAL-3489:
-----------------------------------
Attachment: testDiffgatein-portal.patch
See in attachment test case to reproduce the issue where I try to link user to existing
association:
{code}
org.picketlink.idm.api.User gtnUser =
idmService_.getIdentitySession().getPersistenceManager().findUser(user.getUserName());
org.picketlink.idm.api.Group gtnGroup =
idmService_.getIdentitySession().getPersistenceManager().findGroupByKey(groupId);
idmService_.getIdentitySession().getRelationshipManager().associateUser(gtnGroup,
gtnUser);
try {
membershipHandler_.linkMembership(user, group1, mt, false);
} catch (Exception e) {
e.printStackTrace();
}
{code}
In this test case the association was created using PicketLink IDM then call
linkMembership from gatein api which will try to re-create this association (please refer
to MembershipDAOImpl.java from idm implementation.
{code:java}
if (isAssociationMapped() && getAssociationMapping().equals(mt.getName()))
{
getIdentitySession().getRelationshipManager().associateUserByKeys(groupId,
user.getUserName());
}
{code}
So running this test with oracle will give this stack trace:
{code}
[18:00:52-616][SEVERE] AbstractFlushingEventListener Could not synchronize database state
with session org.hibernate.exception.ConstraintViolationException: could not insert:
[org.picketlink.idm.impl.model.hibernate.HibernateIdentityObjectRelationship]
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:94)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)
at
org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2285)
at
org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2678)
at org.hibernate.action.EntityInsertAction.execute(EntityInsertAction.java:79)
at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:279)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:263)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:167)
at
org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:321)
at
org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:50)
at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1028)
at sun.reflect.GeneratedMethodAccessor21.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at
org.hibernate.context.ThreadLocalSessionContext$TransactionProtectionWrapper.invoke(ThreadLocalSessionContext.java:342)
at com.sun.proxy.$Proxy29.flush(Unknown Source)
at
org.picketlink.idm.impl.store.hibernate.HibernateIdentityStoreImpl.createRelationship(HibernateIdentityStoreImpl.java:1203)
at
org.picketlink.idm.impl.repository.WrapperIdentityStoreRepository.createRelationship(WrapperIdentityStoreRepository.java:245)
at
org.picketlink.idm.impl.api.session.managers.RelationshipManagerImpl.associateUserByKeys(RelationshipManagerImpl.java:375)
at
org.exoplatform.services.organization.idm.MembershipDAOImpl.linkMembership(MembershipDAOImpl.java:180)
at
org.exoplatform.services.organization.TestOrganizationService.testCommit(TestOrganizationService.java:183)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at junit.framework.TestCase.runTest(TestCase.java:164)
at junit.framework.TestCase.runBare(TestCase.java:130)
at org.exoplatform.component.test.AbstractGateInTest.runBare(AbstractGateInTest.java:87)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:120)
at junit.framework.TestSuite.runTest(TestSuite.java:230)
at junit.framework.TestSuite.run(TestSuite.java:225)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.maven.surefire.junit.JUnitTestSet.execute(JUnitTestSet.java:213)
at
org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSet(AbstractDirectoryTestSuite.java:140)
at
org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(AbstractDirectoryTestSuite.java:165)
at org.apache.maven.surefire.Surefire.run(Surefire.java:107)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at
org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:289)
at org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:1005)
Caused by: java.sql.SQLIntegrityConstraintViolationException: ORA-00001: unique constraint
(GERAP.SYS_C0042804) violated
{code}
To configure test case with oracle you should update this configuration file
TestOrganizationService-configuration.xml to use oracle dialect and add the oracle jdbc to
the class path of the gatein project
In real life this problem was reproduced with ldap connected to gatein and a
customLoginModule added to the default configuration.
[MembershipDAOImpl]ORA-00001: unique constraint (IDM.SYS_C0015551)
violated
---------------------------------------------------------------------------
Key: GTNPORTAL-3489
URL:
https://issues.jboss.org/browse/GTNPORTAL-3489
Project: GateIn Portal
Issue Type: Bug
Security Level: Public(Everyone can see)
Affects Versions: 3.5.9.Final
Reporter: Ahmed Zaoui
Priority: Minor
Attachments: testDiffgatein-portal.patch
When synchronizing new user from ldap with an already created relationship we got this
exception:
{noformat}
2014-04-29 16:01:05,248 ERROR [org.hibernate.engine.jdbc.spi.SqlExceptionHelper]
(ajp-arecasapps02/10.100.8.17:14011-2) ORA-00001: unique constraint (IDM.SYS_C0015551)
violated
2014-04-29 16:01:05,257 WARN Failed to call postSave for gerap User with listener :
class org.exoplatform.services.organization.impl.NewUserEventListener:
org.picketlink.idm.common.exception.IdentityException: Cannot create relationship:
at
org.picketlink.idm.impl.store.hibernate.HibernateIdentityStoreImpl.createRelationship(HibernateIdentityStoreImpl.java:1212)
[picketlink-idm-hibernate.jar:1.4.4.Final]
at
org.picketlink.idm.impl.repository.FallbackIdentityStoreRepository.createRelationship(FallbackIdentityStoreRepository.java:1042)
[picketlink-idm-core.jar:1.4.4.Final]
at
org.picketlink.idm.impl.api.session.managers.RelationshipManagerImpl.associateUserByKeys(RelationshipManagerImpl.java:375)
[picketlink-idm-core.jar:1.4.4.Final]
at
org.exoplatform.services.organization.idm.MembershipDAOImpl.linkMembership(MembershipDAOImpl.java:132)
[exo.portal.component.identity-3.5.9.Final_patched.jar:3.5.9.Final]
at
org.exoplatform.services.organization.impl.NewUserEventListener.createDefaultUserMemberships(NewUserEventListener.java:101)
[exo.core.component.organization.api.jar:2.5.8-GA]
at
org.exoplatform.services.organization.impl.NewUserEventListener.postSave(NewUserEventListener.java:72)
[exo.core.component.organization.api.jar:2.5.8-GA]
{noformat}
We should add test checking the existence of the association before creating new one
--
This message was sent by Atlassian JIRA
(v6.2.6#6264)