Unable to create Application Link between Jira and Crucible using OAuth
Asked by Chris-Jan Twigt:

Hi,

I am trying to establish a link between Jira and Crucible and I get this:

Duplicate entry 'jira:6576470' for key 'uk_oauthcons_key'

See stack trace below for details.

I have migrated Crucible from one server to another server. This probably helps to create this problem. Nevertheless there is a bug somewhere that prevents me to establish the link now. I have already tried to remove the Application Link in both Jira and Crucible and then re-created them om both sides but I keep running into the same problem..

Regards,

Chris-Jan Twigt - Solid-FX (chris@solid-fx.com)

PS: Because your online support form does not accept long stacktraces I left (maybe valueable) information out.

2018-01-10 04:14:12,982 WARN \[qtp718571091-259 \] org.hibernate.engine.jdbc.spi.SqlExceptionHelper SqlExceptionHelper-logExceptions - SQL Error: 1062, SQLState: 23000  
2018-01-10 04:14:12,983 ERROR \[qtp718571091-259 \] org.hibernate.engine.jdbc.spi.SqlExceptionHelper SqlExceptionHelper-logExceptions - Duplicate entry 'jira:6576470' for key 'uk_oauthcons_key'  
2018-01-10 04:14:12,983 ERROR \[qtp718571091-259 \] fisheye SessionState-commitAllTx - Commit failed. Rolling back.  
org.hibernate.exception.ConstraintViolationException: could not execute statement  
at org.hibernate.exception.internal.SQLExceptionTypeDelegate.convert(SQLExceptionTypeDelegate.java:74) \[hibernate-core-4.2.13.Final.jar:4.2.13.Final\]  
at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:49) \[hibernate-core-4.2.13.Final.jar:4.2.13.Final\]  
at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:124) \[hibernate-core-4.2.13.Final.jar:4.2.13.Final\]  
at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:109) \[hibernate-core-4.2.13.Final.jar:4.2.13.Final\]  
at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.executeUpdate(ResultSetReturnImpl.java:189) \[hibernate-core-4.2.13.Final.jar:4.2.13.Final\]  
at org.hibernate.engine.jdbc.batch.internal.NonBatchingBatch.addToBatch(NonBatchingBatch.java:58) \[hibernate-core-4.2.13.Final.jar:4.2.13.Final\]  
at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:3079) \[hibernate-core-4.2.13.Final.jar:4.2.13.Final\]  
at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:3521) \[hibernate-core-4.2.13.Final.jar:4.2.13.Final\]  
at org.hibernate.action.internal.EntityInsertAction.execute(EntityInsertAction.java:88) \[hibernate-core-4.2.13.Final.jar:4.2.13.Final\]  
at org.hibernate.engine.spi.ActionQueue.execute(ActionQueue.java:395) \[hibernate-core-4.2.13.Final.jar:4.2.13.Final\]  
at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:387) \[hibernate-core-4.2.13.Final.jar:4.2.13.Final\]  
at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:303) \[hibernate-core-4.2.13.Final.jar:4.2.13.Final\]  
at org.hibernate.event.internal.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:349) \[hibernate-core-4.2.13.Final.jar:4.2.13.Final\]  
at org.hibernate.event.internal.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:56) \[hibernate-core-4.2.13.Final.jar:4.2.13.Final\]  
at org.hibernate.internal.SessionImpl.flush(SessionImpl.java:1159) \[hibernate-core-4.2.13.Final.jar:4.2.13.Final\]  
at org.hibernate.internal.SessionImpl.managedFlush(SessionImpl.java:404) \[hibernate-core-4.2.13.Final.jar:4.2.13.Final\]  
at org.hibernate.engine.transaction.internal.jdbc.JdbcTransaction.beforeTransactionCommit(JdbcTransaction.java:101) \[hibernate-core-4.2.13.Final.jar:4.2.13.Final\]  
at org.hibernate.engine.transaction.spi.AbstractTransactionImpl.commit(AbstractTransactionImpl.java:175) \[hibernate-core-4.2.13.Final.jar:4.2.13.Final\]  
at com.cenqua.crucible.hibernate.SessionState.commit(SessionState.java:165) \[fisheye.jar:?\]  
at com.cenqua.crucible.hibernate.SessionState.commitAllTx(SessionState.java:118) \[fisheye.jar:?\]  
at com.cenqua.crucible.hibernate.SessionState.commitTx(SessionState.java:109) \[fisheye.jar:?\]  
at com.cenqua.crucible.hibernate.HibernateUtil.commitTransaction(HibernateUtil.java:382) \[fisheye.jar:?\]  
at com.atlassian.fecru.tx.TxHelperStylePlatformTransactionManager.commit(TxHelperStylePlatformTransactionManager.java:45) \[fisheye.jar:?\]  
at org.springframework.transaction.interceptor.TransactionAspectSupport.commitTransactionAfterReturning(TransactionAspectSupport.java:478) \[spring-tx-4.0.9.RELEASE.jar:4.0.9.RELEASE\]  
at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:272) \[spring-tx-4.0.9.RELEASE.jar:4.0.9.RELEASE\]  
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:95) \[spring-tx-4.0.9.RELEASE.jar:4.0.9.RELEASE\]  
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) \[spring-aop-4.0.9.RELEASE.jar:4.0.9.RELEASE\]  
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:207) \[spring-aop-4.0.9.RELEASE.jar:4.0.9.RELEASE\]  
at com.sun.proxy.$Proxy99.put(Unknown Source) \[?:?\]  
at sun.reflect.GeneratedMethodAccessor1082.invoke(Unknown Source) \[?:?\]  
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) \[?:1.8.0_102\]  
at java.lang.reflect.Method.invoke(Method.java:498) \[?:1.8.0_102\]  
at com.atlassian.plugin.util.ContextClassLoaderSettingInvocationHandler.invoke(ContextClassLoaderSettingInvocationHandler.java:26) \[atlassian-plugins-core-4.4.3.jar:?\]  
at com.sun.proxy.$Proxy178.put(Unknown Source) \[?:?\]  
at sun.reflect.GeneratedMethodAccessor1082.invoke(Unknown Source) \[?:?\]  
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) \[?:1.8.0_102\]  
at java.lang.reflect.Method.invoke(Method.java:498) \[?:1.8.0_102\]  
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:302) \[org.apache.servicemix.bundles.spring-aop-4.2.5.RELEASE_1.jar:4.0.9.RELEASE\]  
at org.eclipse.gemini.blueprint.service.importer.support.internal.aop.ServiceInvoker.doInvoke(ServiceInvoker.java:56) \[gemini-blueprint-core-2.0.5.BUILD-atlassian-m002.jar:2.0.5.BUILD-atlassian-m002\]  
at org.eclipse.gemini.blueprint.service.importer.support.internal.aop.ServiceInvoker.invoke(ServiceInvoker.java:60) \[gemini-blueprint-core-2.0.5.BUILD-atlassian-m002.jar:2.0.5.BUILD-atlassian-m002\]  
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) \[org.apache.servicemix.bundles.spring-aop-4.2.5.RELEASE_1.jar:4.0.9.RELEASE\]  
at org.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:133) \[org.apache.servicemix.bundles.spring-aop-4.2.5.RELEASE_1.jar:4.0.9.RELEASE\]  
at org.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:121) \[org.apache.servicemix.bundles.spring-aop-4.2.5.RELEASE_1.jar:4.0.9.RELEASE\]  
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) \[org.apache.servicemix.bundles.spring-aop-4.2.5.RELEASE_1.jar:4.0.9.RELEASE\]  
at org.eclipse.gemini.blueprint.service.util.internal.aop.ServiceTCCLInterceptor.invokeUnprivileged(ServiceTCCLInterceptor.java:70) \[gemini-blueprint-core-2.0.5.BUILD-atlassian-m002.jar:2.0.5.BUILD-atlassian-m002\]  
at org.eclipse.gemini.blueprint.service.util.internal.aop.ServiceTCCLInterceptor.invoke(ServiceTCCLInterceptor.java:53) \[gemini-blueprint-core-2.0.5.BUILD-atlassian-m002.jar:2.0.5.BUILD-atlassian-m002\]  
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) \[org.apache.servicemix.bundles.spring-aop-4.2.5.RELEASE_1.jar:4.0.9.RELEASE\]  
at org.eclipse.gemini.blueprint.service.importer.support.LocalBundleContextAdvice.invoke(LocalBundleContextAdvice.java:57) \[gemini-blueprint-core-2.0.5.BUILD-atlassian-m002.jar:2.0.5.BUILD-atlassian-m002\]  
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) \[org.apache.servicemix.bundles.spring-aop-4.2.5.RELEASE_1.jar:4.0.9.RELEASE\]  
at


Answers:
author: Andy Heinzer
body: Given this error it makes it appear that Fisheye still believes there is an existing entry for this jira in regards to the application link. This entry might be in the database, but it might also be getting generated by a the config.xml file on start up.

If trying to remove this from both applications did not work, then the next steps are likely to follow these two separate guides for manually removing this application link for each application:

For Fisheye/Crucible:

* [Removing Application Links manually when receiving getOrphanedTrustCertificates](https://confluence.atlassian.com/fishkb/removing-application-links-manually-when-receiving-getorphanedtrustcertificates-436043958.html)

For Jira:

* [How to remove Application link directly through JIRA database](https://confluence.atlassian.com/jirakb/how-to-remove-application-link-directly-through-jira-database-285839519.html)

Of course you will want to follow each of those guides closely, and make sure that you stop each application before performing these steps. This should then allow you to have a clean slate in regards to the application links in each application and then try to create them once more.

comments: author: Chris-Jan Twigt
body: Thank you Andrew for your response!

I manage to create the Application Link after clearing the oauth entries in the crucible database as mentioned in your instructions.

Kind regards,

Chris Twigt


author: Andy Heinzer
body: Awesome, thanks for letting us know that this helped resolve this!


Tags: jira