How do I manually delete a trusted application link from Stash?

I am trying to set up an Application Link between Stash and Jira. I was having some SSL issues with these links, but now I've gotten all my keys straightened out, and I'm able to create a link between the two applications.

However, when I edit my link to JIRA from the Stash settings and try to configure the link from Stash to Jira to use Trusted Applications, I get a 500 error.

From the log the error is:

2015-03-11 15:00:12,437 ERROR [http-nio-5443-exec-6] @OG1X23x900x1535x0 e7xtqt 10.8.146.19 "GET /mvc/error500 HTTP/1.1" c.a.s.i.web.ErrorPageController There was an unhandled exception loading [/plugins/servlet/applinks/auth/conf/trusted/inbound-non-ual/8bcc7f6c-e699-319e-9ae7-ad3eb0a23965]
com.atlassian.stash.exception.DataStoreException: A database error has occurred.
at com.atlassian.stash.internal.aop.ExceptionRewriteAdvice.afterThrowing(ExceptionRewriteAdvice.java:41) ~[stash-platform-3.7.0.jar:na]
at com.atlassian.applinks.core.auth.trusted.ProviderConfigurationServlet.render(ProviderConfigurationServlet.java:320) ~[na:na]
at com.atlassian.applinks.core.auth.trusted.ProviderConfigurationServlet.doGet(ProviderConfigurationServlet.java:134) ~[na:na]
at com.atlassian.applinks.ui.AbstractApplinksServlet.service(AbstractApplinksServlet.java:159) ~[na:na]
at com.atlassian.applinks.ui.auth.AdminFilter.doFilter(AdminFilter.java:60) ~[na:na]
at com.atlassian.applinks.core.rest.context.ContextFilter.doFilter(ContextFilter.java:25) ~[na:na]
at com.opensymphony.sitemesh.webapp.SiteMeshFilter.obtainContent(SiteMeshFilter.java:181) ~[sitemesh-2.5-atlassian-10.jar:na]
at com.opensymphony.sitemesh.webapp.SiteMeshFilter.doFilter(SiteMeshFilter.java:85) ~[sitemesh-2.5-atlassian-10.jar:na]
at com.atlassian.stash.internal.spring.security.StashAuthenticationFilter.doFilter(StashAuthenticationFilter.java:86) ~[StashAuthenticationFilter.class:na]
at com.atlassian.stash.internal.web.auth.BeforeLoginPluginAuthenticationFilter.doInsideSpringSecurityChain(BeforeLoginPluginAuthenticationFilter.java:111) ~[BeforeLoginPluginAuthenticationFilter.class:na]
at com.atlassian.stash.internal.web.auth.BeforeLoginPluginAuthenticationFilter.doFilter(BeforeLoginPluginAuthenticationFilter.java:77) ~[BeforeLoginPluginAuthenticationFilter.class:na]
at com.atlassian.security.auth.trustedapps.filter.TrustedApplicationsFilter.doFilter(TrustedApplicationsFilter.java:100) ~[atlassian-trusted-apps-core-3.0.8.jar:na]
at com.atlassian.oauth.serviceprovider.internal.servlet.OAuthFilter.doFilter(OAuthFilter.java:79) ~[na:na]
at com.atlassian.analytics.client.filter.DefaultAnalyticsFilter.doFilter(DefaultAnalyticsFilter.java:32) ~[na:na]
at com.atlassian.analytics.client.filter.AbstractHttpFilter.doFilter(AbstractHttpFilter.java:32) ~[na:na]
at com.atlassian.stash.internal.web.auth.BeforeLoginPluginAuthenticationFilter.doBeforeBeforeLoginFilters(BeforeLoginPluginAuthenticationFilter.java:89) ~[BeforeLoginPluginAuthenticationFilter.class:na]
at com.atlassian.stash.internal.web.auth.BeforeLoginPluginAuthenticationFilter.doFilter(BeforeLoginPluginAuthenticationFilter.java:75) ~[BeforeLoginPluginAuthenticationFilter.class:na]
at com.atlassian.stash.internal.request.DefaultRequestManager.doAsRequest(DefaultRequestManager.java:85) ~[stash-service-impl-3.7.0.jar:na]
at com.atlassian.stash.internal.hazelcast.ConfigurableWebFilter.doFilter(ConfigurableWebFilter.java:38) ~[ConfigurableWebFilter.class:na]
at net.bull.javamelody.MonitoringFilter.doFilter(MonitoringFilter.java:198) ~[jira-javamelody-1.53.0.jar:na]
at net.bull.javamelody.MonitoringFilter.doFilter(MonitoringFilter.java:176) ~[jira-javamelody-1.53.0.jar:na]
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [na:1.7.0_17]
at java.lang.Thread.run(Unknown Source) [na:1.7.0_17]
... 205 frames trimmed
Caused by: org.hibernate.NonUniqueResultException: query did not return a unique result: 2
at org.hibernate.internal.AbstractQueryImpl.uniqueElement(AbstractQueryImpl.java:975) ~[hibernate-core-4.3.6.Final.jar:4.3.6.Final]
at org.hibernate.internal.AbstractQueryImpl.uniqueResult(AbstractQueryImpl.java:966) ~[hibernate-core-4.3.6.Final.jar:4.3.6.Final]
at com.atlassian.stash.internal.auth.trusted.HibernateTrustedApplicationDao.getByApplicationId(HibernateTrustedApplicationDao.java:41) ~[stash-dao-impl-3.7.0.jar:na]
at com.atlassian.stash.internal.auth.trusted.TrustedApplicationsManagerImpl.getTrustedApplication(TrustedApplicationsManagerImpl.java:105) ~[stash-service-impl-3.7.0.jar:na]
... 23 common frames omitted

 

If I delete the application link from Stash, I get a message that says:

There are existing Trusted Applications or OAuth relationships that should be upgraded to Application Links. Click here to upgrade.

When I follow the link to upgrade I see a list with two items:

Trusted Applications Certificate jira:10909871 Upgrade to Application Link | Delete
Trusted Applications Certificate jira:10909871 Upgrade to Application Link | Delete

But if I attempt to delete either one of them I get:

Failed to delete orphaned trust certificate: A database error has occurred.

I assume there's some corrupted or old data in Stash's database that's causing these problems, but I haven't been able to find any info on manually deleting application links from stash. I found an article on deleting links from jira, but the tables are sufficiently different that it can't be easily translated to stash.

1 answer

0 votes

Hello Nathan,

Thank you for your question.

Please, refer to Errors from trusted application link or Unable to delete application link for further information.

If you find this answer useful, I would kindly ask you to accept it so the same will be visible to others who might be facing the same issue you have inquired.

Thank you for your understanding.

Kind regards,
Rafael P. Sperafico
Atlassian Support

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Aug 21, 2018 in Bitbucket

Branch Management with Bitbucket

As a project manager, I have discovered that different developers want to bring their previous branching method with them when they join the team. Some developers are used to performing individual wo...

2,287 views 9 12
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you