ef-labs / stash-hook-mirror

An Atlassian Stash repository hook for mirroring to one or more remote git repositories.
MIT License
77 stars 58 forks source link

Mirror-Hook stopped working after upgrade to 3.2.0 #83

Closed sderungs closed 3 years ago

sderungs commented 3 years ago

We tried to upgrade to the most recent version today (3.2.0) running on Bitbucket Server 7.4.0. However, neither updating existing repository hooks nor creating new ones work. The error message shown is: 2020-08-26 16:47:45,909 ERROR [https-jsse-nio-8443-exec-5] @JT1TD7x1007x16834x0 1h4e7m4 172.20.249.1 "PUT /rest/api/latest/projects/ZPSS/repos/atlassian---app-configurations/settings/hooks/com.englishtown.stash-hook-mirror%3Amirror-repository-hook/enabled HTTP/1.1" c.e.b.hook.MirrorRepositoryHook Error running MirrorRepositoryHook validate. java.lang.ClassCastException: com.englishtown.bitbucket.hook.MirrorRequest cannot be cast to com.englishtown.bitbucket.hook.MirrorRequest at com.atlassian.stash.internal.concurrent.HazelcastBucketedExecutor.schedule(HazelcastBucketedExecutor.java:63) at com.atlassian.stash.internal.concurrent.DelegatingInternalBucketedExecutor.schedule(DelegatingInternalBucketedExecutor.java:24) at com.englishtown.bitbucket.hook.MirrorRepositoryHook.lambda$schedulePushes$0(MirrorRepositoryHook.java:177) at java.util.ArrayList.forEach(ArrayList.java:1259) at com.englishtown.bitbucket.hook.MirrorRepositoryHook.schedulePushes(MirrorRepositoryHook.java:177) at com.englishtown.bitbucket.hook.MirrorRepositoryHook.validate(MirrorRepositoryHook.java:138) at com.atlassian.stash.internal.hook.repository.DefaultRepositoryHookService.validateSettings(DefaultRepositoryHookService.java:896) at com.atlassian.stash.internal.hook.repository.DefaultRepositoryHookService.lambda$enable$0(DefaultRepositoryHookService.java:203) at java.util.Optional.ifPresent(Optional.java:159) at com.atlassian.stash.internal.hook.repository.DefaultRepositoryHookService.enable(DefaultRepositoryHookService.java:203) at com.atlassian.plugin.util.ContextClassLoaderSettingInvocationHandler.invoke(ContextClassLoaderSettingInvocationHandler.java:26) at org.eclipse.gemini.blueprint.service.importer.support.internal.aop.ServiceInvoker.doInvoke(ServiceInvoker.java:56) at org.eclipse.gemini.blueprint.service.importer.support.internal.aop.ServiceInvoker.invoke(ServiceInvoker.java:60) at org.eclipse.gemini.blueprint.service.util.internal.aop.ServiceTCCLInterceptor.invokeUnprivileged(ServiceTCCLInterceptor.java:70) at org.eclipse.gemini.blueprint.service.util.internal.aop.ServiceTCCLInterceptor.invoke(ServiceTCCLInterceptor.java:53) at org.eclipse.gemini.blueprint.service.importer.support.LocalBundleContextAdvice.invoke(LocalBundleContextAdvice.java:57) at com.atlassian.stash.internal.rest.hook.RepositoryHookResourceHelper.enableHook(RepositoryHookResourceHelper.java:71) at com.atlassian.stash.internal.rest.hook.RepositoryHookRepositoryResource.enableHook(RepositoryHookRepositoryResource.java:116) 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.zuehlke.ams.pss.servlet.filter.CORSFilter.doFilter(CORSFilter.java:68) at com.zuehlke.ams.pss.servlet.filter.LogFilter.doFilter(LogFilter.java:59) at com.atlassian.analytics.client.filter.UniversalAnalyticsFilter.doFilter(UniversalAnalyticsFilter.java:75) at com.atlassian.analytics.client.filter.AbstractHttpFilter.doFilter(AbstractHttpFilter.java:48) at com.atlassian.bitbucket.internal.xcode.web.XcodeUserAgentFilter.doFilter(XcodeUserAgentFilter.java:36) at com.atlassian.stash.internal.spring.lifecycle.LifecycleJohnsonServletFilterModuleContainerFilter.doFilter(LifecycleJohnsonServletFilterModuleContainerFilter.java:42) at com.atlassian.bitbucket.internal.ratelimit.servlet.filter.RateLimitFilter.doFilter(RateLimitFilter.java:75) at com.resolution.atlasplugins.samlsso.servlet.RedirectToSsoFilter.doFilter(RedirectToSsoFilter.java:60) 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.web.auth.AuthorizationFailureInterceptor.doFilterInternal(AuthorizationFailureInterceptor.java:39) 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:37) at com.atlassian.analytics.client.filter.DefaultAnalyticsFilter.doFilter(DefaultAnalyticsFilter.java:26) at com.atlassian.analytics.client.filter.AbstractHttpFilter.doFilter(AbstractHttpFilter.java:48) 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:84) 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) ... 312 frames trimmed

adrianluisgonzalez commented 3 years ago

This line makes me think you have multiple copies of the plugin jar on your file system:

java.lang.ClassCastException: com.englishtown.bitbucket.hook.MirrorRequest cannot be cast to com.englishtown.bitbucket.hook.MirrorRequest

This looks like the java type loader has found an old version of the jar. Can you verify the old version was properly uninstalled and the jar is gone?

sderungs commented 3 years ago

Thanks for the fast feedback. We updated through the regular "Update" button under "Manage apps". Interestingly, after a server reboot it worked. So it seems like Bitbucket didn't cleanup old files properly(?).

Thanks for the fast feedback!