HTTP Error "GET /mvc/error500 HTTP/1.1" c.a.s.i.web.ErrorPageController There was an unhandled exception loading [/plugins/servlet/repocommits/projects/TPROJ/repos/testrepo/commits/XXXX]

Hi,

Can someone please help ?

I have developed a bit-bucket plugin for performing some operations on bitbucket repos (listing commits within merged commits etc…)

My plugin runs well in the Atlassian SDK (bitbucket 5.8)
/var/atlassian/application-data/bitbucket/log$ atlas-version

ATLAS Version:    6.3.10
ATLAS Home:       /usr/share/atlassian-plugin-sdk-6.3.10
ATLAS Scripts:    /usr/share/atlassian-plugin-sdk-6.3.10/bin
ATLAS Maven Home: /usr/share/atlassian-plugin-sdk-6.3.10/apache-maven-3.2.1
AMPS Version:     6.3.15
--------
Executing: /usr/share/atlassian-plugin-sdk-6.3.10/apache-maven-3.2.1/bin/mvn --version -gs /usr/share/atlassian-plugin-sdk-6.3.10/apache-maven-3.2.1/conf/settings.xml
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=256M; support was removed in 8.0
Apache Maven 3.2.1 (ea8b2b07643dbb1b84b6d16e1f08391b666bc1e9; 2014-02-14T17:37:52+00:00)
Maven home: /usr/share/atlassian-plugin-sdk-6.3.10/apache-maven-3.2.1
Java version: 1.8.0_171, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-8-oracle/jre
Default locale: en_GB, platform encoding: UTF-8
OS name: "linux", version: "4.15.10-041510-generic", arch: "amd64", family: "unix"

But when I upload the plugin onto the Bitbucket server, I get the error and the “An error occurred
Something went wrong while trying to serve your request. Try reloading the page.” and the below exception

2018-08-20 15:15:00,499 ERROR [http-nio-7990-exec-5] @1MKHKFIx915x519x0 hdrbtf 0:0:0:0:0:0:0:1 "GET /mvc/error500 HTTP/1.1" c.a.s.i.web.ErrorPageController There was an unhandled exception loading [/plugins/servlet/repocommits/projects/TPROJ/repos/testrepo/commits/60a8b47c8cf52260b2361ec52656b33409e011b7]
com.atlassian.bitbucket.scm.CommandFailedException: '/usr/bin/git branch --contains 60a8b47c8cf52260b2361ec52656b33409e011b7' exited with code 128 saying: fatal: not a git repository (or any of the parent directories): .git
	at com.atlassian.bitbucket.scm.DefaultCommandExitHandler.onError(DefaultCommandExitHandler.java:46)
	at com.atlassian.bitbucket.scm.git.command.GitCommandExitHandler.evaluateThrowable(GitCommandExitHandler.java:104)
	at com.atlassian.bitbucket.scm.git.command.GitCommandExitHandler.onError(GitCommandExitHandler.java:201)
	at com.atlassian.bitbucket.scm.DefaultCommandExitHandler.onExit(DefaultCommandExitHandler.java:31)
	at com.atlassian.bitbucket.scm.BaseCommand.callExitHandler(BaseCommand.java:153)
	at com.atlassian.bitbucket.scm.BaseCommand$CommandFuture.internalGet(BaseCommand.java:287)
	at com.atlassian.bitbucket.scm.BaseCommand$CommandFuture.get(BaseCommand.java:251)
	at com.atlassian.bitbucket.scm.BaseCommand.call(BaseCommand.java:87)
	at isode.git.RepositoryCommitsServlet.getCommitBranches(RepositoryCommitsServlet.java:435)
	at isode.git.RepositoryCommitsServlet.doGet(RepositoryCommitsServlet.java:108)
	at com.atlassian.applinks.core.rest.context.ContextFilter.doFilter(ContextFilter.java:24)
	at com.atlassian.applinks.core.rest.context.ContextFilter.doFilter(ContextFilter.java:24)
	at com.atlassian.applinks.core.rest.context.ContextFilter.doFilter(ContextFilter.java:24)
	at com.atlassian.applinks.core.rest.context.ContextFilter.doFilter(ContextFilter.java:24)
	at com.atlassian.applinks.core.rest.context.ContextFilter.doFilter(ContextFilter.java:24)
	at com.atlassian.analytics.client.filter.UniversalAnalyticsFilter.doFilter(UniversalAnalyticsFilter.java:92)
	at com.atlassian.analytics.client.filter.AbstractHttpFilter.doFilter(AbstractHttpFilter.java:39)
	at com.atlassian.stash.internal.spring.lifecycle.LifecycleJohnsonServletFilterModuleContainerFilter.doFilter(LifecycleJohnsonServletFilterModuleContainerFilter.java:42)
	at com.opensymphony.sitemesh.webapp.SiteMeshFilter.obtainContent(SiteMeshFilter.java:181)
	at com.opensymphony.sitemesh.webapp.SiteMeshFilter.doFilter(SiteMeshFilter.java:85)
	at com.atlassian.plugin.connect.plugin.auth.scope.ApiScopingFilter.doFilter(ApiScopingFilter.java:81)
	at com.atlassian.stash.internal.spring.lifecycle.LifecycleJohnsonServletFilterModuleContainerFilter.doFilter(LifecycleJohnsonServletFilterModuleContainerFilter.java:42)
	at com.atlassian.stash.internal.spring.security.StashAuthenticationFilter.doFilter(StashAuthenticationFilter.java:85)
	at com.atlassian.stash.internal.web.auth.BeforeLoginPluginAuthenticationFilter.doInsideSpringSecurityChain(BeforeLoginPluginAuthenticationFilter.java:112)
	at com.atlassian.stash.internal.web.auth.BeforeLoginPluginAuthenticationFilter.doFilter(BeforeLoginPluginAuthenticationFilter.java:75)
	at com.atlassian.security.auth.trustedapps.filter.TrustedApplicationsFilter.doFilter(TrustedApplicationsFilter.java:94)
	at com.atlassian.oauth.serviceprovider.internal.servlet.OAuthFilter.doFilter(OAuthFilter.java:67)
	at com.atlassian.stash.internal.spring.lifecycle.LifecycleJohnsonServletFilterModuleContainerFilter.doFilter(LifecycleJohnsonServletFilterModuleContainerFilter.java:42)
	at com.atlassian.plugin.connect.plugin.auth.oauth2.DefaultSalAuthenticationFilter.doFilter(DefaultSalAuthenticationFilter.java:69)
	at com.atlassian.plugin.connect.plugin.auth.user.ThreeLeggedAuthFilter.doFilter(ThreeLeggedAuthFilter.java:109)
	at com.atlassian.jwt.internal.servlet.JwtAuthFilter.doFilter(JwtAuthFilter.java:32)
	at com.atlassian.analytics.client.filter.DefaultAnalyticsFilter.doFilter(DefaultAnalyticsFilter.java:38)
	at com.atlassian.analytics.client.filter.AbstractHttpFilter.doFilter(AbstractHttpFilter.java:39)
	at com.atlassian.stash.internal.spring.lifecycle.LifecycleJohnsonServletFilterModuleContainerFilter.doFilter(LifecycleJohnsonServletFilterModuleContainerFilter.java:42)
	at com.atlassian.stash.internal.web.auth.BeforeLoginPluginAuthenticationFilter.doBeforeBeforeLoginFilters(BeforeLoginPluginAuthenticationFilter.java:90)
	at com.atlassian.stash.internal.web.auth.BeforeLoginPluginAuthenticationFilter.doFilter(BeforeLoginPluginAuthenticationFilter.java:73)
	at com.atlassian.stash.internal.request.DefaultRequestManager.doAsRequest(DefaultRequestManager.java:89)
	at com.atlassian.stash.internal.hazelcast.ConfigurableWebFilter.doFilter(ConfigurableWebFilter.java:38)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.lang.Thread.run(Thread.java:748)
	... 226 frames trimmed
Caused by: com.atlassian.utils.process.ProcessException: Non-zero exit code: 128

I looked at various threads, some hint towards an incompatible version of JDK. But I am not sure if this is the case for me. Can anyone provide any hint as to how I can overcome this problem.

As per https://confluence.atlassian.com/bitbucketserverkb/unable-to-view-commit-details-779171233.html
I have updated the bit bucket version in pom.xml when testing on the bit-bucket server, but still encounted the same error.

Thanks in advance.

Regards,

Hi @kshi.korde,

It looks like it’s trying to run a git command in a directory that’s not a git repository.

Could it be that your app is choosing the wrong working directory?

1 Like

Hi Pvandevoorde,

Thanks for your reply.

I was initially confused about the HTTP 500 error, but it is just a consequence of the error related to the incorrect repository. I am continuing to investigate around the same.

Regards,
Kshi

@pvandevoorde

On the atlassian SDK the URL for the HTTP request is

http://ubox:7990/bitbucket/projects/PROJECT_1/repos/rep_1/commits/0a943a29376f2336b78312d99e65da17048951db

Where as on the actual bitbucket server the URL is

http://localhost:7990/projects/TPROJ/repos/testrepo/commits/60a8b47c8cf52260b2361ec52656b33409e011b7

This was causing my API to fail as “bitbucket” is not present in the URL
repositoryService.getBySlug(components[3], components[5]);
modified this to
repositoryService.getBySlug(components[2], components[4]);
and now it works the right way.

Thanks for the hint. Cheers !!

1 Like